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 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 to …

Read more

LMC Load and Save

The following program will demonstrate the use of LDA and STA, the Load and Save instructions used in the LMC.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. INPSTA firstINPSTA secondLDA firstOUTLDA secondOUTHLTfirst DATsecond DAT 0 INP1 STA 92 …

Read more

LMC Addition and Subtraction

Introduction to 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 …

Read more

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.

LMC Iteration Structures: While/Endwhile Loop

The following program will show the use of branch instructions to create a WHILE/ENDWHILE iteration (loop) structure in a program. The WHILE/ENDWHILE iteration structure tests the condition at the beginning of a loop (in this program, the loop continues while value1 is not zero). This means that if this test result is false (value1 is …

Read more

LDA and STA Instructions – LMC Load and Save

The following program will demonstrate the use of LDA and STA, the Load and Save instructions used in the LMC. 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. INPSTA firstINPSTA secondLDA firstOUTLDA secondOUTHLTfirst DATsecond DAT 0 INP1 STA …

Read more

LMC Simulator: CPU Simulator – VB.NET Version

This MS Windows version can be downloaded with no restrictions (requires Microsoft.NET Framework 4): lmc.net.zip (version 3.3). There is also an installation guide for a lmc.exe version that might be more suitable for school networks. Features Loads and saves assembly language programs as text files. Supports labels for both branching and data. Supports indentation making …

Read more

Using Labels with the LMC Simulator

Labels are used to label a memory address. This makes it much easier to refer to memory addresses that hold data or instructions. Example 1 – using labels with data: Example 2 – using labels with branch instructions: (i.e. BRP, BRA & BRZ) An example program using labels with data and branch instructions (it outputs …

Read more

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 more

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. Further …

Read more

LMC Simulator VB.NET .exe Network Installation

A .exe version that is more suitable for network installations can be downloaded here: lmc.zip Thanks to Rudi Niemand of Tonbridge Grammar School for supplying the following network installation guide used in his school: The students are given access to a shared (read-only) folder that appears on their desktops.In there is a shortcut file (*.ink) …

Read more

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 more

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. INPSTA firstINPSTA secondSUB firstBRP secondBigLDA firstOUTBRA endProgramsecondBig LDA secondOUTendProgram HLTfirst DATsecond DAT 0 INP1 STA 122 …

Read more

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 more

LMC Branching – Instructions To Implement Decisions

The following program will demonstrate the use of the three branch instructions: BRZ, BRP and BRA. Running the program: INPUT a number and the program will OUTPUT a sequence of numbers, starting at 1 and finishing with the INPUT number. The program will continue until a 0 is entered. start LDA zero STA count INP …

Read more

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 more