The Little Man Computer (LMC) is an instructional model of a computer, created by Dr. Stuart Madnick in 1965. It models the architecture of a simple computer and has all the basic features. See en.wikipedia.org/wiki/Little_man_computer for more information.
The original concept was that inside the CPU is a tiny man who runs around executing instructions encoded in a list. Inside the CPU there are:
The Program Counter holds only 2 digits (0 to 99) and the Accumulator holds 3 digits and a sign (-999 to 999). The Output area holds a certain amount of information in two columns and then scrolls (and old information disappears).
When an instruction is read from memory the top digit is used to decide what to do. To help us write programs more easily each instruction type is given a name which the ASSEMBLE function converts to the corresponding code. The bottom two digits are used as an address associated with the instruction. The instructions are:
| Code | Name | Description | ||||
| 0 | HLT | Stop (Little Man has a rest). | ||||
| 1 | ADD | Add the contents of the memory address to the Accumulator | ||||
| 2 | SUB | Subtract the contents of the memory address from the Accumulator | ||||
| 3 | STA | Store the value in the Accumulator in the memory address given. | ||||
| 4 | This code is unused and gives an error. | |||||
| 5 | LDA | Load the Accumulator with the contents of the memory address given | ||||
| 6 | BRA | Branch - use the address given as the address of the next instruction | ||||
| 7 | BRZ | Branch to the address given if the Accumulator is zero | ||||
| 8 | BRP | Branch to the address given if the Accumulator is zero or positive | ||||
| 9 | INP | Input. Put the value from Input into the Accumulator. | ||||
| 9 | OUT | Output. Put the value from the Accumulator into Output. | ||||
| DAT | Used to indicate a location that contains data. |
Note that the LMC computer cannot tell whether memory locations contain instructions or data. Most modern computers can segment their memory but there has to be a way for the output from one program the become the instructions of another. DAT is a fake instruction to tell the assembler that this location contains data.
Note that the LMC computer cannot tell whether memory locations contain instructions or data. Most modern computers can segment their memory but there has to be a way for the output from one program the become the instructions of another. DAT is a fake instruction to tell the assembler that this location contains data.
This webpage was modified from https://peterhigginson.co.uk/lmc/help_new.html