The Little Man Computer (LMC)

Tutorials on how to use the Little Man Computer (LMC), a simulator that uses the Von Neumann architecture to simulate the control unit of a CPU.

LMC Addition and Subtraction

The following program will demonstrate the ADD and SUB instructions of the LMC instruction set. Instructions Copy the ten line program above and paste it into the Program box. Click on the “Assemble Program” button. After the program is assembled you should see RAM addresses 0 to 8 contain the machine code instructions shown in …

Read moreLMC Addition and Subtraction

LMC Input and Output

The following program will demonstrate the INPUT and OUTPUT instructions of the LMC. Running the program: the program simply INPUTS a number, then OUTPUTS it. Instructions Copy the three-line program above and paste it into the Program box. Click on the “Assemble Program” button. After the program is assembled you should see RAM addresses 0 …

Read moreLMC Input and Output

LMC Load and Save

The following program will demonstrate the use of LDA and STA, the Load and Save instructions used in the . Running the program: when prompted, INPUT a set of two numbers. The program should then OUTPUT them in the same order that they were entered. INP STA first INP STA second LDA first OUT LDA …

Read moreLMC Load and Save

Little Man Computer

A Little Man Computer (LMC) is a simulator which has many of the basic features of a modern computer that uses the Von Neumann architecture.

Using Labels with the LMC Simulator

Labels are used to label a memory address. This makes it much easier to refer to memory addresses which hold data or instructions. Example 1 – using labels with data: data1 DAT Explanation: The memory address where this data is stored would be labelled data1. No data would initially be stored at this location. If …

Read moreUsing Labels with the LMC Simulator

The LMC Instruction Set

The LMC Instruction Set (summary table) Instruction Mnemonic ‘Machine Code’ Further information Load LDA 5xx Load the contents of address xx onto the accumulator. Note: the contents of the address are not changed. Store STA 3xx Store the contents of the accumulator to address xx. Note: the contents of the accumulator are┬ánot changed. Add ADD …

Read moreThe LMC Instruction Set

LMC Instruction Set Summary

Instruction Mnemonic Machine Code Load LDA 5xx Store STA 3xx Add ADD 1xx Subtract SUB 2xx Input INP 901 Output OUT 902 End HLT 000 Branch always BRA 6xx Branch if zero BRZ 7xx Branch if zero or positive BRP 8xx Data storage DAT NOTE: xx represents a memory address between 0 and 99 . …

Read moreLMC Instruction Set Summary

LMC Input and Output

The following program will demonstrate the INPUT and OUTPUT instructions of the LMC. Running the program: the program simply INPUTS a number, then OUTPUTS it. INP OUT HLT Instructions Copy the three-line program above and paste it into the Program box. Click on the “Assemble Program” button. After the program is assembled you should see …

Read moreLMC Input and Output

LMC Implementing Decisions

The following program will show the use of the BRP and BRA branch instructions in making decisions within a program. Running the program: when prompted, INPUT two numbers and the program will OUTPUT the biggest number of the two. INP STA first INP STA second SUB first BRP secondBig LDA first OUT BRA endProgram secondBig …

Read moreLMC Implementing Decisions

LMC Conditional Structures

The following program will show the use of branch instructions to create an IF/ELSE/ENDIF conditional structure in a program. Running the program: when prompted, INPUT two numbers, if they are different then the program will OUTPUT a 0 (FALSE) and if they are the same then the program will OUTPUT a 1 (TRUE), NOTE: The …

Read moreLMC Conditional Structures

LMC Addition and Subtraction

The following program will demonstrate the ADD and SUB instructions of the LMC instruction set. Running the program: when prompted, INPUT a set of three numbers. The program should add the first two numbers and output the answer, then subtract the first number from the third and output the answer. INP STA first INP ADD …

Read moreLMC Addition and Subtraction