top of page

Little Man Computer (LMC) Editor

You can use this simple Little Man Computer (LMC) editor below to check any LMC code you have written to ensure it outputs correctly.

 

Use the reminders on the right for the 11 commands needed in the OCR A-Level specification. LMC is a simplified form of assembly language.

This page is under active development.

noun-under-construction-7744129e.png

INP is used without a label to input a number. The number is temporarily stored in the accumulator. Example: INP

OUT will output the current value of the accumulator. Example: OUT

STA stores the value that is currently in the accumulator into a named memory location. Example: STA num1

ADD is used to add the value of a named memory location to the value currently stored in the accumulator. Example: ADD num1

SUB takes away the value of a named memory location from the value currently stored in the accumulator. Example: SUB num1

LDA is used to load the value of a stored variable into the accumulator.

Example: LDA num1

BRZ is used to branch to a labelled line of code if the value in the accumulator is exactly 0. Example: BRZ ifzero

BRP is used to branch if the value in the accumulator is currently positive (including 0). Example: BRP repeat

BRA is used to branch regardless of the accumulator's current value. Example: BRA loop

HLT will stop the program. Example: HLT

DAT defines and stores data in memory. It creates a variable or memory location that can hold a specific value. It is written after the final HLT command. Example: fifty DAT 50

© CSNewbs 2025

The written, video and visual content of CSNewbs is protected by copyright. © 2025
bottom of page