Tools · AQA A Level
Write and run programs in the AQA A Level assembly language instruction set.
Supports all AQA instructions: LDR, STR, ADD, SUB, MOV, MVN, CMP, AND, ORR, EOR, LSL, LSR,
B, BEQ, BNE, BGT, BLT and HALT. Registers R0–R12, Zero and Negative flags displayed.
Use PRINT Rn to output register values.
Free, no account needed.
Use PRINT Rn to output a register value
op2 = Rn (register) or #n (immediate value)
AQA supplies this instruction set in the exam, so the goal is not to memorise the syntax
but to be fluent in reading and writing it. Operand2 below can be either a
register such as R3 or an immediate value written with a hash, such as
#17.
| Instruction | What it does |
|---|---|
LDR Rd, <memory ref> | Load the value stored at the given memory location into register d. |
STR Rd, <memory ref> | Store the value in register d into the given memory location. |
ADD Rd, Rn, <operand2> | Add operand2 to the value in Rn and store the result in Rd. |
SUB Rd, Rn, <operand2> | Subtract operand2 from the value in Rn and store the result in Rd. |
MOV Rd, <operand2> | Copy operand2 into register d. |
CMP Rn, <operand2> | Compare Rn with operand2 by subtracting and setting the flags. Rn is unchanged. |
B <label> | Branch unconditionally to the instruction at the label. |
BEQ / BNE / BGT / BLT | Branch to the label only if the last comparison was equal, not equal, greater than or less than. |
AND Rd, Rn, <operand2> | Bitwise AND of Rn and operand2, result into Rd. |
ORR Rd, Rn, <operand2> | Bitwise OR of Rn and operand2, result into Rd. |
EOR Rd, Rn, <operand2> | Bitwise exclusive OR of Rn and operand2, result into Rd. |
MVN Rd, <operand2> | Bitwise NOT of operand2, result into Rd. |
LSL Rd, Rn, <operand2> | Logical shift left of Rn by operand2 places, result into Rd. |
LSR Rd, Rn, <operand2> | Logical shift right of Rn by operand2 places, result into Rd. |
HALT | Stop execution. |
ADD R1, R0, 5 is
not valid — it must be #5. Without the hash the 5 reads as a register
reference.
Questions come in three shapes: explain what this program does, complete the missing instruction, or write a short routine. For the first, trace it with a table of register values — the same discipline as a trace table in a high-level language. For the third, plan the structure before writing any mnemonics: load the values, compare, branch, calculate, store, halt.
It is worth noting that this is a different instruction set from the Little Man Computer used at GCSE. LMC has a single accumulator and ten instructions; the AQA set has thirteen registers and explicit operands. If you learned LMC first, the register model is the main adjustment.
Operand2 can be either a register such as R3, or an immediate value written with a hash, such as #17. This is why ADD R1, R0, #5 and ADD R1, R0, R2 are both valid — the first adds the literal five, the second adds whatever is currently in R2.
LDR loads a value from a memory location into a register. MOV copies a value that is already available — either an immediate constant or the contents of another register — into a register. LDR touches memory; MOV does not. Mixing them up is one of the most common errors in written answers.
CMP compares a register with operand2 by subtracting one from the other and setting the condition flags based on the result. The register itself is left unchanged — CMP exists purely to set the flags so that a following conditional branch such as BEQ or BGT knows what to do.
No. AQA provides the instruction set in the exam as part of the question paper insert, so you do not need to recall the exact syntax from memory. What you do need is fluency in using it — being able to read a short program and say what it does, and to write one that performs a given task.
This simulator implements the assembly language instruction set defined by AQA A Level Computer Science 7517. It is not the same as the Little Man Computer used at GCSE, which has a much smaller instruction set and a single accumulator rather than registers R0 to R12.