The LMC (Little Man Computer) is a simplified model of the Von Numann architecture, the memory is made out of 100 “mailboxes” each of which can hold a 3 digit decimal number which can be either an instruction or data, labelled 0 through 99.
Note that it is possible to write a program that re-writes itself with this model.
| Name | Description |
|---|---|
| ACC (Accumulator) | The accumulator is used for general mathematical operations. |
| PC (Program Counter) | Holds the memory address of the next instruction to execute. |
| CIR (Current Intruction Register) | Holds the currect instruction to be executed. |
| MAR (Memory Address Register) | Holds the address to load from or store to. |
| MDR (Memory Data Register) | Holds the value loaded from memory or to be written to memory. |
| in-box | Is used to store the input from the user/operator. |
| out-box | Is used to hold the output from the program. |
| Instruction | Mnemonic | Name | Explanation |
|---|---|---|---|
| 000 | HLT | Halt | Halts execution. |
| 1XX | ADD | Add | Add the value at memory address XX to the accumulator. |
| 2XX | SUB | Subtract | Subtracts the value at memory address XX from the accumulator. |
| 3XX | STA | Store | Stores the value of the accumulator at memory address XX. |
| 5XX | LDA | Load | Load the value from memory address XX into the accumulator. |
| 6XX | BRA | Branch Always | Set PC to memory address XX, effectively jumping to XX. |
| 7XX | BRZ | Branch on Zero | Same as BRA but only if the contents of the accumulator is zero. |
| 8XX | BRP | Branch on Positive | Same as BRA but only if the contents of the accumulator is positive or zero. |
| 901 | INP | Input | Requests input from the in-box and puts the value into the accumulator. |
| 902 | OUT | Output | Outputs the contents of the accumulator to the out-box. |