LMC Addition and Subtraction

Teach any GCSE Computer Science class

We have put together a full GCSE Computer Science curriculum that will give you all the teaching materials you need to teach any topic.

Whether you’re a brand new Computer Science teacher, or you’ve been teaching ICT for years, our resources will save you hours and hours of lesson preparation every single week.

View the resources →

The following program will demonstrate the ADD and SUB instructions of the LMC instruction set.

Running the program: when prompted, INPUT a set of three numbers. The program should add the first two numbers and output the answer, then subtract the first number from the third and output the answer.
INP
STA first
INP
ADD first
OUT
INP
SUB first
OUT
HLT
first DAT 0 INP
1 STA 9
2 INP
3 ADD 9
4 OUT
5 INP
6 SUB 9
7 OUT
8 HLT
9 DAT 0
Instructions

    This content is restricted to subscribers