# Little Man Computer

Description| How to Use| LMC Programs| How it works

This app is a simple to understand but functionally realistic simulation of a computer based on von Neumann architecture. It is a great tool for learning how a CPU works and for an appreciation of Assembly Language. The tool comes with the simulation file (.xlsm) and sample LMC programs (.lmc files).

.zip file (1.1 MB)

## What is the Little Man Computer

The Little Man Computer consists of a closed room, in which the Little Man lives. The Little Man can interact with the external world through 2 windows, one called "Input" through which he can recieve instructions and another called "Output" through which he can send out messages. Inside the room, the little man has access to 100 storage locations, an accumulator (basic calculator) and a counter. Finally, he has a little corner to relax. See picture below.

The job of the little man is to execute programs from the memory, one step at a time. The little man has a counter to keep track of the steps. When asked to execute a programme, the Little Man goes to the memory location '00' and starts by executing the instruction located there. Once he is done, he increments the counter and proceeds to the next memory location and so on till he is asked to relax. All data and instructions are in the form of 3 digit numbers. The first digit represents an instruction and the last 2 digits can specify a memory location, depending on the instruction. The instruction codes for the Little Man are as follows:

0 - Relax

1 - Add: Add the value at the location specified by the last 2 digits to the value in the accumulator

2 - Subtract: Subtract the value at the location specified by the last 2 digits from the value in the accumulator

3 - Store: Put the value in the accumulator into the specified memory location

4 - Input: Take the value in the input and place it into the accumulator

5 - Load: Load value at the location specified by the last 2 digits into the accumulator

6 - Branch: Jump to the memory address specified by the last 2 digits and execute the instruction kept there in the next step

7 - Branch if zero: If the number in the accumulator is 0, jump to the memory address specified by the last 2 digits and execute the instruction kept there in the next step

8 - Branch if positive: If the number in the accumulator is positive, jump to the memory address specified by the last 2 digits and execute the instruction kept there in the next step

9 - Output: Copy the value in the accumulator into the output

A user can write a programme using the instructions above and load it into the Little Man Computer's memory for execution. See the How to use page for more details.

## The LMC and a real Computer

The relationship between the LMC model and a physical computer is as follows:

1. The mailboxes represent the Random Access Memory (RAM) which is used for loading programs and data for immediate use by the CPU

2. The calculator represents the Arithmetic Logic Unit (ALU) of the CPU

3. The Little Man himself is like the control unit of the CPU

4. The input tray represents the various inputs connected to the CPU, which include keyboard, mouse, hard drive connections and so on.

5. The output tray represents the various outputs connected to the CPU, which include monitors, speakers and so on.

The LMC programme is like assembly language that a CPU understands.

## Also See:

Image Processing

Simulation of a logic circuit for alarming

Binary Coded Decimal (BCD) to 7 segment display circuit

Simulation of Diffusion in 1 Dimension