LMC Branching – Instructions To Implement Decisions

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 use of the three branch instructions: BRZ, BRP and BRA.

Running the program: INPUT a number and the program will OUTPUT a sequence of numbers, starting at 1 and finishing with the INPUT number. The program will continue until a 0 is entered.

start LDA zero
STA count
BRZ finish
STA maxNumber
loopTop LDA count
ADD step
STA count
SUB maxNumber
BRP endLoop
BRA loopTop
endLoop BRA . . .

This content is restricted to subscribers