LMC Simulator
Write Little Man Computer assembly programs, load them into memory, and step through execution with a visual accumulator and mailbox display.
Example Programs
Assembly Code
Labels supported · // comments
Load a program to begin.
Registers
ACC
000
Accumulator
PC
00
Program Counter
IR
---
Instruction Reg.
Input / Output
Input Queue (comma-separated)
Output
Memory (Mailboxes 0–99)
Instruction Set
| Mnemonic | Opcode | Description |
|---|---|---|
| ADD xx | 1xx | ACC = ACC + mailbox[xx] |
| SUB xx | 2xx | ACC = ACC − mailbox[xx] |
| STA xx | 3xx | mailbox[xx] = ACC |
| LDA xx | 5xx | ACC = mailbox[xx] |
| BRA xx | 6xx | PC = xx (always branch) |
| BRZ xx | 7xx | PC = xx if ACC = 0 |
| BRP xx | 8xx | PC = xx if ACC ≥ 0 |
| INP | 901 | ACC = next input value |
| OUT | 902 | Print ACC to output |
| HLT | 000 | Stop execution |
| DAT n | — | Define data; initial value n |
Tips
Labels — write a label before any instruction or DAT to give it a name. Labels are resolved to addresses at load time.
Negative accumulator — if ACC goes below 0, BRP will not branch. The accumulator is stored as a signed value internally.
Comments — anything after // on a line is ignored.
Blue highlight on mailbox = current PC position.
Input queue — enter comma-separated integers. Each INP instruction consumes the next value.