Tools · GCSE & A Level
Write LMC assembly programs, assemble them, and step through execution one instruction at a time. Watch the accumulator, program counter and all 100 mailboxes update as the fetch-decode-execute cycle runs. Free, no account needed.
Output will appear here when OUT is executed
The Little Man Computer is a deliberately tiny model of a von Neumann machine, designed in 1965 to make processor execution visible. The metaphor is a little man in a room containing 100 numbered mailboxes, a calculator (the accumulator), and a counter telling him which mailbox to read next.
It matters because it strips the CPU back to something you can hold in your head. The fetch-decode-execute cycle stops being three words to memorise and becomes something you can watch happen, one instruction at a time.
Every instruction is three digits. The first digit is the opcode; the remaining two are the mailbox address it operates on. Opcode 4 is unused.
| Code | Mnemonic | What it does |
|---|---|---|
1xx | ADD | Add the contents of mailbox xx to the accumulator. |
2xx | SUB | Subtract the contents of mailbox xx from the accumulator. |
3xx | STA | Store the accumulator into mailbox xx. Overwrites what was there. |
5xx | LDA | Load the contents of mailbox xx into the accumulator. |
6xx | BRA | Branch always — jump to mailbox xx unconditionally. |
7xx | BRZ | Branch if zero — jump to xx only if the accumulator is exactly 0. |
8xx | BRP | Branch if positive — jump to xx if the accumulator is zero or greater. |
901 | INP | Read a value from the input into the accumulator. |
902 | OUT | Output the value currently in the accumulator. |
000 | HLT | Halt — stop the program. |
— | DAT | Not an instruction: reserves a mailbox to hold data, optionally with a starting value. |
The same errors cost marks year after year on this topic, and every one of them is avoidable once you have seen it.
ADD 5 does not add
five. It adds the contents of mailbox 5. To add a constant you must first store
that constant in a mailbox with DAT.
Questions usually take one of three forms: trace this program and state the output, write a program to do X, or explain what this program does. For tracing, build a table with a column for the accumulator, one for each data mailbox, and one for output — then fill in a row per instruction executed. It is slower than tracking it in your head, and it is why students who use a table score better.
For writing programs, start from the structure rather than the instructions: get the input, do the comparison, branch, produce the output, halt. Fill in the mnemonics afterwards.
The Little Man Computer (LMC) is a simplified model of a von Neumann computer, created by Stuart Madnick in 1965 to teach how processors actually execute instructions. It has 100 numbered mailboxes for storage, a single accumulator, a program counter, and a small instruction set. Because it is deliberately tiny, it lets you see the fetch-decode-execute cycle happening without the complexity of a real CPU.
The standard set is ADD (1xx), SUB (2xx), STA (3xx), LDA (5xx), BRA (6xx), BRZ (7xx), BRP (8xx), INP (901), OUT (902) and HLT (000), plus DAT to reserve a mailbox for data. Opcode 4 is unused. Each instruction is three digits: the first is the opcode, the remaining two are the mailbox address.
Yes — and this catches students out constantly. BRP means "branch if positive", but in the Little Man Computer zero counts as positive, so BRP jumps when the accumulator is zero or greater. If you need to branch only on a value strictly greater than zero, you have to subtract one first or combine BRP with BRZ.
They move data in opposite directions. LDA loads a copy from a mailbox into the accumulator, leaving the mailbox unchanged. STA stores the accumulator into a mailbox, overwriting whatever that mailbox held. The accumulator keeps its value after STA.
LMC appears most prominently in OCR GCSE Computer Science J277 and is widely used at A Level and in Key Stage 3 to introduce low-level programming and the fetch-decode-execute cycle. Even where it is not named in your specification, it is an effective way to understand assembly language and how the CPU actually works.