Little Man Computer
The Little Man Computer (LMC) was created by Dr. Stuart Madnick. The LMC models a simple von Neumann architecture computer, so it has all of the basic features of a modern computer. The LMC can be programmed in machine or assembly code, and the following simulator will allow you to run your programs.
LMC Commands
LOAD mnemonic - LDA numerical/machine code - 5
Load the contents of the given mailbox onto the accumulator (calculator). Note: the contents of the mailbox are not changed.
STORE
mnemonic - STA
numerical/machine code - 3
Store the contents of the accumulator (calculator) to the mailbox of the given address. Note: the contents of the accumlator are not changed.
ADD
mnemonic - ADD
numerical/machine code - 1
Add the contents of the given mailbox onto the accumulator (calculator). Note: the contents of the mailbox are not changed, and the actions of the accumulator are not defined for add instructions that cause sums larger than 3 digits.
SUBTRACT
mnemonic - SUB
numerical/machine code - 2
Subtract the contents of the given mailbox from the accumulator (calculator). Note: the contents of the mailbox are not changed, and the actions of the accumulator are not defined for subtract instructions that cause negative results -- however, a negative flag will be set so that BRP can be used properly (see below).
INPUT
mnemonic - INP
numerical/machine code - 901
Copy the value from the "in box" onto the accumulator (calculator).
OUTPUT
mnemonic - OUT
numerical/machine code - 902
Copy the value from the accumulator (calculator) to the "out box". Note: the contents of the accumlator are not changed.
END
mnemonic - HLT
numerical/machine code - 000
Causes the Little Man Computer to stop executing your program.
BRANCH IF ZERO
mnemonic - BRZ
numerical/machine code - 7
If the contents of the accululator (calculator) are 000, the PC (program counter) will be set to the given address. Note: since the program is stored in memory, data and program instructions all have the same address/location format.
BRANCH IF ZERO OR POSITIVE
mnemonic - BRZ
numerical/machine code - 8
If the contents of the accululator (calculator) are 000 or positive (i.e. the negative flag is not set), the PC (program counter) will be set to the given address. Note: since the program is stored in memory, data and program instructions all have the same address/location format.
BRANCH ALWAYS
mnemonic - BRA
numerical/machine code - 6
Set the contents of the accululator (calculator) to the given address. Note: since the program is stored in memory, data and program instructions all have the same address/location format.