Made byBobr AI

Little Man Computer (LMC) Guide: Architecture & Assembly

Learn computer science fundamentals with this guide to the Little Man Computer (LMC), covering Von Neumann architecture, instruction sets, and assembly.

#little-man-computer#computer-architecture#assembly-programming#von-neumann#cpu-design#computer-science#lmc-tutorial
Watch
Pitch

Little Man Computer (LMC)

A Beginner's Guide to Computer Architecture & Assembly Programming

Computer Science Fundamentals

CPU Chip Illustration
Made byBobr AI

What We'll Cover

A step-by-step journey through the architecture, instruction set, and programming of the LMC.

1
What is the Little Man Computer?
2
LMC Architecture Overview
3
The Instruction Set
4
Memory & Registers
5
How Programs Execute
6
Writing LMC Assembly Programs
7
Example Programs (Add, Subtract, Loops, Conditionals)
8
LMC vs Real CPUs
Made byBobr AI

What is the Little Man Computer?

Educational Model

Created by Dr. Stuart Madnick in 1965 as a simplified model to teach computer architecture.

Fundamental Concepts

Designed to teach how CPUs work at a foundational level with a simple assembly-like instruction set.

Von Neumann Architecture

It accurately models real computer architecture in an accessible, simple way.

The β€œLittle Man” Metaphor

Imagine a tiny man inside the computer fetching, reading, and executing instructions.

Computer Science Fundamentals

LMC CPU Metaphor
Made byBobr AI

LMC Architecture Overview

A conceptual diagram of the Little Man Computer's key components and data flow.

CENTRAL PROCESSING UNIT (CPU)
πŸ“₯
Input Basket
INPUT DATA
πŸ“€
Output Tray
OUTPUT DATA
Program Counter (PC)
Address Bus
Instruction Register (IR)
Instruction Bus
Calculator (ALU)
Accumulator (ACC)
Data Bus
MAILBOXES (MEMORY) - 100 SLOTS
00
901
01
399
02
901
03
199
04
902
05
000
06
000
07
000
...
99
000

Computer Architecture Fundamentals

Made byBobr AI

Memory & Registers

Memory (Mailboxes)

100 mailboxes numbered 00–99

Each stores a 3-digit number (000–999)

Holds both instructions AND data

Addressed by a 2-digit number

Mailboxes (RAM)
00
901
01
399
98
042
99
911

Registers

ACC
Accumulator (ACC)
Main working register, stores results
PC
Program Counter (PC)
Points to the next instruction address
IR
Instruction Register (IR)
Holds the currently executing instruction
Made byBobr AI

The LMC Instruction Set

Mnemonic Opcode Description
ADD 1xx Add value at address xx to Accumulator
SUB 2xx Subtract value at address xx from Accumulator
STA 3xx Store Accumulator value into address xx
LDA 5xx Load value from address xx into Accumulator
BRA 6xx Branch (jump) always to address xx
BRZ 7xx Branch to xx if Accumulator = 0
BRP 8xx Branch to xx if Accumulator ≥ 0
INP 901 Read input into Accumulator
OUT 902 Output value of Accumulator
HLT 000 Stop the program
DAT Declare a data value in memory
Made byBobr AI

The Fetch-Decode-Execute Cycle

A step-by-step deep dive into how the Little Man Computer processes instructions.

1

FETCH

The Little Man looks at the Program Counter, goes to that mailbox, and picks up the instruction. PC increments by 1.

2

DECODE

The instruction is placed in the Instruction Register. The Little Man figures out what to do (which operation and which address).

3

EXECUTE

The Little Man carries out the instruction (e.g., adds a number, stores a value, jumps to a new address).

This cycle repeats until a HLT instruction is reached.

Computer Architecture β€’ Instruction Cycle

Made byBobr AI

Writing LMC Programs β€” The Basics

Programs are written as a list of mnemonics (one per line)

Labels can be used to name memory addresses (e.g., NUM DAT 5)

Instructions are assembled into 3-digit opcodes in memory

Programs start executing from address 00

Always end with HLT

Computer Science Fundamentals

program.lmc
β–Ά00
01
02
03
04
05
06
INP
// Read a number from input
STA NUM
// Store it at address labeled NUM
INP
// Read another number
ADD NUM
// Add the stored number
OUT
// Output the result
HLT
// Stop
NUM
DAT
// Mem location for storing a number
Made byBobr AI

Example 1: Add Two Numbers

LMC Program Code
      INP        
      STA FIRST  
      INP        
      ADD FIRST  
      OUT        
      HLT        
FIRST DAT        
Input: 5, 3 β†’ Output: 8
Step Instruction ACC Notes
1 INP 5 User enters 5
2 STA FIRST 5 5 stored in FIRST
3 INP 3 User enters 3
4 ADD FIRST 8 3 + 5 = 8
5 OUT 8 Output: 8
6 HLT β€” Program ends
Made byBobr AI

Example 2: Subtract Two Numbers

A worked example showing an LMC program that reads two numbers and outputs the difference (first minus second).

LMC Program

sub.lmc
      INP        
      STA FIRST  
      INP        
      STA SECOND 
      LDA FIRST  
      SUB SECOND 
      OUT        
      HLT        
FIRST  DAT       
SECOND DAT       

Execution Trace Table

Input: 10, 4 β†’ Output: 6
Step Instruction ACC Notes
1 INP 10 User enters 10
2 STA FIRST 10 Stored in FIRST
3 INP 4 User enters 4
4 STA SECOND 4 Stored in SECOND
5 LDA FIRST 10 ACC = 10
6 SUB SECOND 6 10 − 4 = 6
7 OUT 6 Output: 6
8 HLT Program ends
Made byBobr AI

Example 3: Counting Loop

INP
STA COUNT
LOOP LDA COUNT
OUT
SUB ONE
STA COUNT
BRZ END
BRA LOOP
END HLT
COUNT DAT
ONE DAT 1

Program Execution Flow

1
User inputs a number (e.g., 3)
2
Store it in COUNT
3
Load COUNT into ACC
4
Output ACC
5
Subtract 1 from ACC
6
Store back in COUNT
7
If ACC = 0, jump to END (BRZ)
8
Otherwise, go back to LOOP (BRA)
9
HLT when done
MOCK SYSTEM OUTPUT
> Output for input 3: "3, 2, 1" then stops.
Made byBobr AI

Branching & Conditionals in LMC

BRA (Branch Always)

Unconditional jump

Always goes to the given address

Used for: loops

BRZ (Branch if Zero)

Jump only if ACC = 0

Used for: checking equality, loop termination

Equivalent to:

if (acc == 0) goto label

BRP (Branch if Positive)

Jump only if ACC β‰₯ 0

Used for: checking if a number is positive or not negative

Equivalent to:

if (acc >= 0) goto label
πŸ’‘

Tip: Negative numbers in LMC are represented using values > 500 (two's complement style)

Made byBobr AI

LMC vs Real CPUs β€” A Comparison

Feature
LMC
Real CPU
Memory
100 mailboxes (3-digit)
Billions of bytes (RAM + Cache)
Registers
1 (Accumulator)
Dozens (general-purpose, special)
Instruction Set
~10 simple instructions
Hundreds of instructions (CISC/RISC)
Addressing
Simple 2-digit address
Complex modes (direct, indirect, base+offset)
Data Size
3 digits (000–999)
32-bit or 64-bit integers and beyond
I/O
Simple IN/OUT
Complex device drivers and buses
Clock Speed
N/A (conceptual)
Billions of cycles per second (GHz)
Purpose
Teaching / Learning
Real-world computation
i

Despite its simplicity, LMC demonstrates ALL the core principles of real computer architecture: fetch-decode-execute, registers, memory addressing, and branching.

Made byBobr AI

Key Takeaways

πŸ–₯️

LMC is a simplified model of a Von Neumann computer β€” great for learning

🏠

Memory = 100 mailboxes; each stores a 3-digit number (data or instruction)

βš™οΈ

Only one register: the Accumulator (ACC), used for all calculations

πŸ”„

The Fetch-Decode-Execute cycle is how every instruction is processed

πŸ“‹

~10 simple instructions: ADD, SUB, LDA, STA, INP, OUT, BRA, BRZ, BRP, HLT

πŸŒ‰

LMC bridges the gap between high-level programming and real hardware

πŸ’‘ Try writing your own LMC programs at: peterhigginson.co.uk/lmc/ or cpulator.01xz.net

Questions?

Made byBobr AI
Bobr AI

DESIGNER-MADE
PRESENTATION,
GENERATED FROM
YOUR PROMPT

Create your own professional slide deck with real images, data charts, and unique design in under a minute.

Generate For Free

Little Man Computer (LMC) Guide: Architecture & Assembly

Learn computer science fundamentals with this guide to the Little Man Computer (LMC), covering Von Neumann architecture, instruction sets, and assembly.

Little Man Computer (LMC)

A Beginner's Guide to Computer Architecture & Assembly Programming

Computer Science Fundamentals

What We'll Cover

A step-by-step journey through the architecture, instruction set, and programming of the LMC.

What is the Little Man Computer?

LMC Architecture Overview

The Instruction Set

Memory & Registers

How Programs Execute

Writing LMC Assembly Programs

Example Programs (Add, Subtract, Loops, Conditionals)

LMC vs Real CPUs

What is the Little Man Computer?

Educational Model

Created by Dr. Stuart Madnick in 1965 as a simplified model to teach computer architecture.

Fundamental Concepts

Designed to teach how CPUs work at a foundational level with a simple assembly-like instruction set.

Von Neumann Architecture

It accurately models real computer architecture in an accessible, simple way.

The β€œLittle Man” Metaphor

Imagine a tiny man inside the computer fetching, reading, and executing instructions.

Computer Science Fundamentals

LMC Architecture Overview

A conceptual diagram of the Little Man Computer's key components and data flow.

Computer Architecture Fundamentals

Memory & Registers

Memory (Mailboxes)

100 mailboxes numbered 00–99

Each stores a 3-digit number (000–999)

Holds both instructions AND data

Addressed by a 2-digit number

Registers

Accumulator (ACC)

Main working register, stores results

Program Counter (PC)

Points to the next instruction address

Instruction Register (IR)

Holds the currently executing instruction

901

399

042

911

The LMC Instruction Set

Mnemonic

Opcode

Description

The Fetch-Decode-Execute Cycle

A step-by-step deep dive into how the Little Man Computer processes instructions.

FETCH

The Little Man looks at the Program Counter, goes to that mailbox, and picks up the instruction. PC increments by 1.

DECODE

The instruction is placed in the Instruction Register. The Little Man figures out what to do (which operation and which address).

EXECUTE

The Little Man carries out the instruction (e.g., adds a number, stores a value, jumps to a new address).

This cycle repeats until a HLT instruction is reached.

Computer Architecture β€’ Instruction Cycle

Writing LMC Programs β€” The Basics

Programs are written as a list of mnemonics (one per line)

Labels can be used to name memory addresses (e.g., NUM DAT 5)

Instructions are assembled into 3-digit opcodes in memory

Programs start executing from address 00

Always end with HLT

Computer Science Fundamentals

Example 1: Add Two Numbers

LMC Program Code

INP STA FIRST INP ADD FIRST OUT HLT FIRST DAT

Input: 5, 3 β†’ Output: 8

Example 2: Subtract Two Numbers

A worked example showing an LMC program that reads two numbers and outputs the difference (first minus second).

INP STA FIRST INP STA SECOND LDA FIRST SUB SECOND OUT HLT FIRST DAT SECOND DAT

Input: 10, 4 β†’ Output: 6

Example 3: Counting Loop

User inputs a number (e.g., 3)

Store it in COUNT

Load COUNT into ACC

Output ACC

Subtract 1 from ACC

Store back in COUNT

If ACC = 0, jump to END (BRZ)

Otherwise, go back to LOOP (BRA)

HLT when done

Output for input 3: "3, 2, 1" then stops.

Branching & Conditionals in LMC

BRA (Branch Always)

Unconditional jump

Always goes to the given address

Used for:

loops

BRZ (Branch if Zero)

Jump only if ACC = 0

Used for:

checking equality, loop termination

Equivalent to:

if (acc == 0) goto label

BRP (Branch if Positive)

Jump only if ACC β‰₯ 0

Used for:

checking if a number is positive or not negative

Equivalent to:

if (acc >= 0) goto label

Tip:

Negative numbers in LMC are represented using values > 500 (two's complement style)

LMC vs Real CPUs β€” A Comparison

LMC

Real CPU

Memory

100 mailboxes (3-digit)

Billions of bytes (RAM + Cache)

Registers

1 (Accumulator)

Dozens (general-purpose, special)

Instruction Set

~10 simple instructions

Hundreds of instructions (CISC/RISC)

Addressing

Simple 2-digit address

Complex modes (direct, indirect, base+offset)

Data Size

3 digits (000–999)

32-bit or 64-bit integers and beyond

I/O

Simple IN/OUT

Complex device drivers and buses

Clock Speed

N/A (conceptual)

Billions of cycles per second (GHz)

Purpose

Teaching / Learning

Real-world computation

Despite its simplicity, LMC demonstrates ALL the core principles of real computer architecture: fetch-decode-execute, registers, memory addressing, and branching.

Key Takeaways

LMC is a simplified model of a Von Neumann computer β€” great for learning

Memory = 100 mailboxes; each stores a 3-digit number (data or instruction)

Only one register: the Accumulator (ACC), used for all calculations

The Fetch-Decode-Execute cycle is how every instruction is processed

~10 simple instructions: ADD, SUB, LDA, STA, INP, OUT, BRA, BRZ, BRP, HLT

LMC bridges the gap between high-level programming and real hardware

Try writing your own LMC programs at: peterhigginson.co.uk/lmc/ or cpulator.01xz.net

Questions?

  • little-man-computer
  • computer-architecture
  • assembly-programming
  • von-neumann
  • cpu-design
  • computer-science
  • lmc-tutorial