Community resourceWorksheet

OCR H446 1.2.4 LMC machine, mnemonics and tracing

Part 3 of 10 · H446 1.2.4 · Types of programming language

The Little Man Computer is the model H446 1.2.4 uses to make low-level execution visible. Students build that state model, trace a complete routine instruction by instruction and complete a working mnemonic listing, so the accumulator, mailboxes and output are read as changing state rather than memorised from a table.

Students will:

  • describe the input, accumulator, mailbox, instruction and output parts of the LMC model
  • trace a short routine through to HLT, recording the accumulator, changed mailboxes and each output
  • distinguish a DAT data location from an executable instruction
  • complete the missing mnemonics and operands so a sensor routine works end to end
  • explain the state changes caused by a load, add and store sequence on named mailboxes

Inside: 6 explanation cells, 1 multiple-choice question, 2 fill-in-the-blanks cells, 1 written answer and 1 trace table. 14 marks, about 40 to 50 minutes.

Series: H446 1.2.4 · Types of programming language, part 3 of 10.

Shared by Coding PathwayVerified teacher

  • 11 cells
  • About 45 minutes
  • CC BY-SA 4.0
  • Shared 31 Aug 2026
  • Updated 3 Sept 2026

Preview

The whole resource, exactly as a class sees it. Answers and marking are held back.

LMC machine, mnemonics and tracing

Little Man Computer is a conceptual low-level machine. It makes instruction, accumulator, memory and input/output state visible without pretending to be a modern processor.

The state model

Little Man Computer state modelinputaccumulatorworking valuenumbered mailboxesinstructions or datalabels name locationsoutputTrace instruction → accumulator → changed mailbox/output → next instruction until HLT.

The mnemonic is the operation; an operand commonly names a mailbox. LDA X copies the value at X into the accumulator. STA X copies the accumulator into X. ADD X and SUB X update the accumulator. INP and OUT cross the machine boundary. HLT stops execution. DAT reserves a data mailbox and may give it an initial value.

BRA, BRZ and BRP change which instruction runs next. PL04 develops those branches.

Worked trace: add a fixed fee

        INP
        ADD FEE
        STA TOTAL
        OUT
        HLT
FEE     DAT 4
TOTAL   DAT 0

With input 9: accumulator becomes 9, then 13; mailbox TOTAL changes from 0 to 13; OUT emits 13; HLT terminates. The DAT lines are data, not instructions that should be executed after the halt.

Trace table4 marks

Trace the program with input 12. Track the instruction, accumulator, changed mailboxes and output through HLT.

Record values only when they change. Record outputs in order and include the terminating state.

Use one row for each instruction carried out. Fill in a box only when that value changes on that row, and leave the rest blank. Put the address of the instruction being carried out in the Address column.

Input: "12"

ProgramLMC assembly
00INP01SUB FEE02STA RESULT03OUT04HLT05FEEDAT 506RESULTDAT 0
Trace table with 4 columns
RowAddressACCRESULTOutput
1
2
3
4
5
6
Multiple choice1 mark

What is the role of RESULT DAT 0 in the traced program?

  • AIt outputs 0
  • BIt branches to RESULT
  • CIt resets the accumulator after HLT
  • DIt reserves a labelled data mailbox initially containing 0

Complete a working LMC listing

A sensor routine must input a reading, add the value stored in OFFSET, store the corrected reading, output it once and halt. Complete the mnemonic and operand gaps so the whole program works.

Fill in the blanks4 marks
        gap 1
        ADD gap 2
        gap 3 CORRECTED
        OUT
        gap 4
OFFSET  DAT 3
CORRECTED DAT 0

Apply the model independently

The remaining tasks change the context or reduce the support. Complete them without copying the worked model, then check that each explanation connects a mechanism to its consequence.

Written answer5 marks

Explain the state changes caused by LDA CREDIT, ADD BONUS, STA CREDIT when CREDIT starts at 18 and BONUS stores 3.

State accumulator and mailbox values after each instruction. Distinguish copying from moving.

Students type their answer here.

Fill in the blanks4 marks
An LMC instruction contains an operation called a checkpoint gap 1 and may contain an checkpoint gap 2. The main working value is held in the checkpoint gap 3. A labelled checkpoint gap 4 line reserves data.

Review your understanding

Before submitting, check that you can explain the main distinction in your own words, apply it in an unfamiliar context and justify each consequence rather than only naming a feature.