Photo AI

Last Updated Sep 27, 2025

Assembly Language & Little Man Computer Simplified Revision Notes

Revision notes with simplified explanations to understand Assembly Language & Little Man Computer quickly and effectively.

user avatar
user avatar
user avatar
user avatar
user avatar

239+ students studying

Assembly Language & Little Man Computer

Overview

Assembly Language is a low-level programming language that provides a way to write instructions directly for a computer's CPU. It operates close to the hardware, allowing precise control over memory and CPU operations. Assembly language is specific to a computer's architecture, making it more efficient but harder to write and understand than high-level languages. One tool to learn assembly language concepts is the Little Man Computer (LMC), a simple educational model that mimics the CPU's basic operations. LMC uses a limited set of instructions to illustrate how assembly works.

Purpose and Need for Assembly Language

  • Direct Hardware Control: Assembly allows programmers to control hardware at a granular level, ideal for tasks that require high efficiency and precision.
  • Efficient Resource Use: Assembly code can be highly optimised, which is critical in systems with limited memory or processing power, such as embedded systems.
  • Understanding CPU Operations: Learning assembly provides insights into how CPUs execute instructions, memory addressing, and program control flow.

Little Man Computer (LMC)

The Little Man Computer is a simplified CPU model that helps beginners understand assembly language concepts without the complexities of a real CPU. It uses an imaginary "little man" who follows basic instructions to perform tasks with a limited set of commands, representing core concepts in assembly programming.

LMC Components

  • Mailbox (Memory): A set of numbered storage locations, or "mailboxes," where data and instructions are stored. Each mailbox holds a 3-digit instruction or data value.
  • Accumulator (Calculator): A single register where arithmetic calculations are performed and results are stored.
  • Program Counter: A register that keeps track of the address of the next instruction to execute.
  • Input/Output: Used to simulate simple input and output operations for reading and displaying data.

LMC Instruction Set

Here are the basic instructions for LMC, each represented by a 3-digit code:

MnemonicInstruction CodeDescription
ADD1XXAdd the value at address XX to the accumulator.
SUB2XXSubtract the value at address XX from the accumulator.
STA3XXStore the value from the accumulator into address XX.
LDA5XXLoad the value at address XX into the accumulator.
BRA6XXBranch always (jump) to address XX.
BRZ7XXBranch to address XX if the accumulator is zero.
BRP8XXBranch to address XX if the accumulator is positive.
INP901Input a value into the accumulator.
OUT902Output the value in the accumulator.
HLT000Halt the program.

Example Programs in LMC

infoNote

Simple Addition Program

This program adds two numbers entered by the user and outputs the result.

INP       // 901 - Input first number into the accumulator
STA 10    // 310 - Store the first number at address 10
INP       // 901 - Input second number into the accumulator
ADD 10    // 110 - Add the number at address 10 to the accumulator
OUT       // 902 - Output the result
HLT       // 000 - Halt the program

Explanation:

  • The first input value is stored in mailbox 10.
  • The second input is added to the value in mailbox 10, with the result displayed.
infoNote

Simple Subtraction Program

This program subtracts one user-entered number from another.

INP       // 901 - Input the first number
STA 10    // 310 - Store the first number in address 10
INP       // 901 - Input the second number
SUB 10    // 210 - Subtract the number at address 10 from the accumulator
OUT       // 902 - Output the result
HLT       // 000 - Halt the program

Explanation:

  • The first number is stored, and then the second input is subtracted from it, with the result displayed.
infoNote

Loop Example: Count Down to Zero

This program accepts a positive integer and counts down to zero, displaying each number.

INP       // 901 - Input a number
STA 10    // 310 - Store the input in address 10
LDA 10    // 510 - Load the value at address 10 into the accumulator
OUT       // 902 - Output the current number
SUB 12    // 212 - Subtract 1 (at address 12) from the accumulator
STA 10    // 310 - Store the updated value back in address 10
BRP 06    // 806 - Branch to address 06 if the accumulator is positive
HLT       // 000 - Halt the program

// Data
12 DAT 1  // Stores the value 1 to decrement the counter

Explanation:

  • The input number is repeatedly decremented and displayed until it reaches zero, using the BRP instruction to check for a positive number.

Tracing LMC Programs

Tracing a program involves following each instruction step-by-step, noting changes to the accumulator and mailbox values. Here's an example trace for the Simple Addition Program above, assuming inputs 4 and 3.

StepInstructionAccumulatorMailbox 10Output
1INP (901)4
2STA 10 (310)44
3INP (901)34
4ADD 10 (110)74
5OUT (902)747
6HLT (000)---

Note Summary

infoNote

Common Mistakes

  • Incorrect Addresses: Using incorrect addresses in LMC can result in unexpected behaviour, as it could reference or modify data.
  • Forgetting to Halt: If the HLT command is missing, the program may continue running, leading to errors.
  • Accumulator Overflow: Since LMC typically simulates limited memory, very large numbers or unanticipated results can cause overflow errors.
infoNote

Key Takeaways

  • Assembly Language is a low-level language used for efficient hardware control, suitable for systems programming and performance-critical applications.
  • Little Man Computer (LMC) provides a simplified way to learn the principles of assembly language, focusing on a limited set of instructions.
  • LMC Programs use basic commands like ADD, SUB, STA, and LDA to manipulate values in memory and control the flow of execution.
  • Tracing and debugging assembly language code requires careful attention to each instruction and the changes it makes to memory and registers.
Books

Only available for registered users.

Sign up now to view the full note, or log in if you already have an account!

500K+ Students Use These Powerful Tools to Master Assembly Language & Little Man Computer

Enhance your understanding with flashcards, quizzes, and exams—designed to help you grasp key concepts, reinforce learning, and master any topic with confidence!

40 flashcards

Flashcards on Assembly Language & Little Man Computer

Revise key concepts with interactive flashcards.

Try Computer Science Flashcards

4 quizzes

Quizzes on Assembly Language & Little Man Computer

Test your knowledge with fun and engaging quizzes.

Try Computer Science Quizzes

29 questions

Exam questions on Assembly Language & Little Man Computer

Boost your confidence with real exam questions.

Try Computer Science Questions

27 exams created

Exam Builder on Assembly Language & Little Man Computer

Create custom exams across topics for better practice!

Try Computer Science exam builder

12 papers

Past Papers on Assembly Language & Little Man Computer

Practice past papers to reinforce exam experience.

Try Computer Science Past Papers

Other Revision Notes related to Assembly Language & Little Man Computer you should explore

Discover More Revision Notes Related to Assembly Language & Little Man Computer to Deepen Your Understanding and Improve Your Mastery

96%

114 rated

Types of Programming Language

Programming Paradigms

user avatar
user avatar
user avatar
user avatar
user avatar

290+ studying

199KViews

96%

114 rated

Types of Programming Language

Procedural Programming

user avatar
user avatar
user avatar
user avatar
user avatar

230+ studying

192KViews

96%

114 rated

Types of Programming Language

Modes of Addressing

user avatar
user avatar
user avatar
user avatar
user avatar

228+ studying

181KViews
Load more notes

Join 500,000+ A-Level students using SimpleStudy...

Join Thousands of A-Level Students Using SimpleStudy to Learn Smarter, Stay Organized, and Boost Their Grades with Confidence!

97% of Students

Report Improved Results

98% of Students

Recommend to friends

500,000+

Students Supported

50 Million+

Questions answered