โ† Back to all tools

๐Ÿ—๏ธ Little Man Computer (LMC)

See how a CPU fetches, decodes and executes instructions โ€” one step at a time. This is the model used in your GCSE exam to explain how processors work.

Designed with the WJEC specification in mind
CS GCSE ยง1.1.1CS A-Level Unit 4
๐Ÿ“

Program

๐Ÿ’ก This program takes two numbers as input and adds them together.
One instruction per line. Labels before the mnemonic. Comments after //
๐Ÿ“ค

Output

Ready. Click โš™๏ธ Assemble, then โ–ถ Run to see the program execute.
๐Ÿ“–

Instruction Set

MnemonicCodeDescription
INP901Input from user โ†’ Accumulator
OUT902Output Accumulator value
LDA xx5xxLoad from address xx โ†’ Accumulator
STA xx3xxStore Accumulator โ†’ address xx
ADD xx1xxAdd value at address xx to Accumulator
SUB xx2xxSubtract value at address xx from Accumulator
BRA xx6xxBranch always to address xx
BRZ xx7xxBranch to xx if Accumulator = 0
BRP xx8xxBranch to xx if Accumulator โ‰ฅ 0
HLT000Halt the program
DAT xxxxReserve memory with optional initial value
Fetch
Get instruction from memory
Decode
Work out what it means
Execute
Carry out the instruction
๐Ÿ”ง

Registers

PC
Program Counter
0
ACC
Accumulator
0
MAR
Memory Address Register
-
MDR
Memory Data Register
-
CIR
Current Instruction Register
-
Flag
Status indicator
-
๐Ÿ“ฆ

Memory (100 mailboxes)

๐Ÿ“ฅ

Input Queue