The Little Man Computer
A simple imaginary computer for teaching beginners how a computer works.
Most computers in used today have what we call the von Neumann architecture, name after the brilliant mathematician John von Neumann, who is credited with coming up with the concept, although the credit really belongs to German engineer Konrad Zuse who built the first computer the Z1, on these principles.
Computers where too expensive in the early days to have in home or class rooms, so Dr. Stuart Madnick came up with a simplified paper version of imaginary version of such a computer called the Little Man Computer.
I have actually written about this concept before: Learn Assembly Programming the Fun Way.
That was about various games to learn assembly programming. Several of these are based on the Little Man Computer (LMC) concept. But here will use two LMC simulators. We got two of these:
- 101 Computing Simulator. The most fancy looking of the two.
- Robo Writer Simulator. Plain and primitive looking, but this one lets you assemble programs with another tool and load up the generated machine code.
The image below shows the 101 Computing Simulator. On the left you see the assembly program to run. In the green boxes in the middle you got the inputs and the output to the computer. On the right you can see the contents of all the 100 memory cells of the LMC computer.

For instance I have written a LMC assembler, disassembler and simulator in Julia called LittleManComputer.jl. You can install this package and use it to assemble LMC programs which you can run in the Robo Writer Simulator later.
How the Little Man Computer Works
Usually the little man computer is described as little guy walking around carrying out tasks. Here is an excerpt from wikipedia explaining it:
The LMC model is based on the concept of a little man shut in a closed mail room (analogous to a computer in this scenario). At one end of the room, there are 100 mailboxes (memory), numbered 0 to 99, that can each contain a 3 digit instruction or data (ranging from 000 to 999). Furthermore, there are two mailboxes at the other end labeled INBOX and OUTBOX which are used for receiving and outputting data. In the center of the room, there is a work area containing a simple two function (addition and subtraction) calculator known as the Accumulator and a resettable counter known as the Program Counter.
However I will attempt to explain it in terms more similar to how I have explained e.g. by decimal RISC processors: Calcutron-33: A Decimal Based RISC Microprocessor
The Calcutron-33 was also my basis for: How Does a Modern Microprocessor Work?
I will explain the Little Man Computer here using similar kinds of diagrams. We got colored arrows representing copper wires sending data or signals from one functional unit to another. These are marked in gray boxes.
Let us give an overview of the responsibilities of the different gray boxes:
- Memory — contains 100 memory cells where we can store our executing program and data we want to operate on. Each memory cell can store one instruction.
- Input/Output — This is where we read and write to the outside world. This is similar to a tape drive. Numbers are read in sequentially and written out sequentially.
- Program Counter — Keeps track of where we are in the program. It contains the address of the memory cell to fetch the next instruction from. It starts at 0 and gets incremented every time an instruction has finished executing.
- Instruction Register — Last instruction fetched is stored here.
- Decoder — Reads content of instruction register. This is kind of analogous to our little man. Depending on instruction red, it will use the red lines to enable or disable other functional units.
- Accumulator — Stores results from calculations as well as data read fro memory or input.
- ALU — The Arithmetic Logic Unit which performs additions and subtractions.
Let us say some words about the colored data and control lines. Instructions and data pass along the blue lines. In principle data can go from any gray box to any other. It is really up to the Decoder to use its red control signals to open two different functional units to make data flow between them.
The green arrows is the address bus. It is used to select what memory cell to read from.

Executing a Program
Let us look at a very simple program to get a sense of how programs are run on the LMC computer. This program read in two numbers add them together and write out result to ouput.
INP // read from input and put in accumulator
STA total // store this at address 'total'
INP // read another number into accumulator
ADD total // add content of 'total' to accumulator
OUT // write accumulator content to output
HLT // halt program
total DAT 0 // area storing a number
You could place this program into a LMC simulator and see it run. The program advances forward in steps. The yellow arrows below show how data flows from one functional unit to another. We can also see which red control lines are enabled which allows data to flow in this direction.
When the program starts the decoder will enable Memory and the Instruction Register. The Program Counter starts with the value 0, causing instruction at memory location 0 to be selected. That instruction is INP
which flows into the Instruction Register. INP
is shot of Input.

The next illustration to the right shows the effects of INP
. When The Decoder
reads the Instruction Register
it toggles on the Accumulator
and Input
. This causes data to flow from Input to the Accumulator.
The next instruction read is the STA total
instruction. The Decoder decodes it and enabled the Accumulator fore reading and the Memory for writing. This the content of the accumulator (containing what we just read from input) flow into a memory cell. Which cell? It goes into total
, which is a just a placeholder for the memory cell with address 6.

Next we read another number into the accumulator. The next instruction shown in the rightmost diagram is ADD
. When the decoder reads ADD
it causes the decoder to enable the memory for reading. But it also enables the accumulator so its content can be read. Finally the decoder selects the ADD
operation on the Arithmetic Logic Unit (ALU).
Now that we have some sense of how the LMC works, let us do a more thorough coverage of the instruction-set of the LMC.
LMC Instruction-Set Overview
Each instruction is a 3-digit number. But usually when programming one deals with letter abbreviations which are easier to remember. Here is a tip on how to read the description below. The Add
instruction is described as having the number 1xx
. What this really means is that the xx
are where you put your operand (argument). So 142
is the instruction for adding the contents of memory cell 42 to the contents of the accumulator.
ADD
1xx add content at addressxx
in memory to accumulator.SUB
2xx subtract contents of addressxx
from what is stored in the accumulator. Store result in accumulator.STA
3xx store accumulator at addressxx
in memory.LDA
5xx load accumulator with contents at addressxx
in memory.BRA
6xx jump to locationxx
in program.BRZ
7xx jump if accumulator is zeroBRP
8xx jump if accumulator is zero or higher (positive).INP
901 fill accumulator with number from input.OUT
902 push value in accumulator into output queue.HLT
000 stop program
Example of LMC Programs
A common example program which the simulators often come preloaded with is one where a count down is performed. We read a single number from the input and then we write all the numbers from that value down to zero.
INP
OUT
LOOP BRZ QUIT // Jump to QUIT if accumulator is 0
SUB ONE // Subtract from accumulator what is stored in ONE
OUT
BRA LOOP // Jump to the memory address labeled LOOP
QUIT HLT // Label this memory address as QUIT
ONE DAT 1 // Store 1 in this memory address.
Thus if you give 4 as input then what you will get written as output is:
4 3 2 1 0