sim8085 is a lightweight 8085-ish assembler + interactive simulator built to run classic microprocessor lab programs from this repo:
src/school/*.asmsrc/personal/*.asm
It’s designed to be:
- ✅ Easy to understand
- ✅ Great for learning / teaching
- ✅ Hackable and extendable
- ✅ Perfect for running real 8085 lab sheets
This is an instruction-level simulator (not cycle-accurate). It focuses on executing the logic of programs correctly rather than emulating exact machine timings.
- Interactive terminal REPL
- Loads existing
.asmtemplates from this repo - Label support (
LOOP:,JNZ LOOP, etc.) - Simulated registers:
A B C D E H L,SP,PC - Flags:
S Z P CY - Full 64KB memory space
- Breakpoints, stepping, memory inspection
- Designed around real 8085 lab exercises
From the repo root:
python simulator/main.py
You should see:
8085>
List available templates:
8085> templates
Load a program by fuzzy-matching its filename:
8085> loadtpl school bubble
Seed memory:
8085> setmem 7050H 0AH
Run until HLT:
8085> run
Inspect registers:
8085> regs
Inspect memory:
8085> mem 7050H 40
Bubble sort expects:
7050H= size7051H..= array data
Example session:
8085> loadtpl school bubble
8085> setmem 7050H 0AH
8085> setmem 7051H 09H
8085> setmem 7052H 02H
8085> setmem 7053H 0AH
8085> setmem 7054H 01H
8085> setmem 7055H 07H
8085> setmem 7056H 03H
8085> setmem 7057H 08H
8085> setmem 7058H 04H
8085> setmem 7059H 06H
8085> setmem 705AH 05H
8085> run
8085> mem 7051H 0A
After running, memory block 7051H..705AH will be sorted.
load <path> Load an .asm file
templates List available templates
loadtpl <school|personal> <name>
run [max_steps] Run until HLT or breakpoint
step [n] Step instruction(s)
regs Show registers and flags
mem <addr> [len] Dump memory
setmem <addr> <byte> Write memory byte
bp <addr> Toggle breakpoint
bps List breakpoints
pc <addr> Set PC
reset Reset CPU and memory
help Show help
quit Exit
Data movement
MOV, MVI, LXILDA, STALHLD, SHLDLDAX, STAXXCHG
Arithmetic / logic
- `XRA, ADD, ADC, ADI
SUB, SBB, SUIANI, CMP, CPI- `INR, DCR
DAA, CMA
Rotate / flags
RRC, RAR, RLCSTC, CMC
16-bit / pointers
INX, DCX, DAD
Control flow
MP, JZ, JNZ, JC, JNCCALL, RETHLT
Assembler features
- Labels (
LOOP:) ORGdirective (optional, assembler-dependent)
Opcode execution lives in:
bash
simulator/sim8085/cpu.py
Add new instructions by extending the _exec() dispatcher. The assembler lives in:
bash
simulator/sim8085/assembler.py
src/
school/ # School lab programs
personal/ # Personal practice programs
simulator/
main.py # Entry point
sim8085/
assembler.py # Parser / label resolver
cpu.py # CPU + memory + flags
repl.py # Interactive terminal
::contentReference[oaicite:0]{index=0}