LMC Conditional Structures

46 Computer Science Topics

We’ve created 46 modules covering every Computer Science topic needed for GCSE level. These are transferable across AQA, CIE, Edexcel, CIE & Internationally. Suitable for teachers or home educators alike.

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 show the use of branch instructions to create an IF/ELSE/ENDIF conditional structure in a program.

Running the program: when prompted, INPUT two numbers, if they are different then the program will OUTPUT a 0 (FALSE) and if they are the same then the program will OUTPUT a 1 (TRUE),

NOTE: The 'if' label has no function and is added to aid clarity.

STA value1
SUB value1
if BRZ else
   LDA false
BRA endif
else LDA true
endif HLT
value1 DAT
true DAT 1
false . . .

This content is restricted to subscribers