Assembly program
Use // for comments
Assembled into memory
Machine code 507
opcode = what to do
operand = which address
| Addr | Label | Instruction | Opcode | Operand | Code |
|---|
Instruction set
| Code | Mnemonic | What it does |
|---|---|---|
| 1xx | ADD | ACC ← ACC + value at address xx |
| 2xx | SUB | ACC ← ACC − value at address xx |
| 3xx | STA | Store ACC in memory at address xx |
| 5xx | LDA | Load the value at address xx into ACC |
| 6xx | BRA | Branch always: PC ← xx |
| 7xx | BRZ | Branch if ACC is zero |
| 8xx | BRP | Branch if ACC is zero or positive |
| 901 | INP | Input a number into ACC |
| 902 | OUT | Output the value in ACC |
| 000 | HLT | Stop the program |
| — | DAT | Not an instruction: reserves a memory location for data |
Ready
Ready to fetch
INP: type a whole number from −999 to 999.
Output
Quiz score
0 / 0
Explore the diagram
Click any part of the CPU, a bus, a memory location or the Little Man to see what it does.