Tools · AQA A Level

AQA Assembly Language Simulator

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.

AQA Assembly ; for comments  ·  LABEL:
Output (PRINT Rn)

Use PRINT Rn to output a register value

Registers
R0 0
R1 0
R2 0
R3 0
R4 0
R5 0
R6 0
R7 0
R8 0
R9 0
R10 0
R11 0
R12 0
PC
0
Z flag
0
N flag
0
AQA Instruction Set
LDR Rd, addr – Load mem[addr] → Rd
STR Rd, addr – Store Rd → mem[addr]
ADD Rd, Rn, op2 – Rd = Rn + op2
SUB Rd, Rn, op2 – Rd = Rn − op2
MOV Rd, op2 – Rd = op2
MVN Rd, op2 – Rd = NOT op2
CMP Rn, op2 – Set Z/N flags (Rn − op2)
AND/ORR/EOR Rd,Rn,op2 – Bitwise ops
LSL/LSR Rd,Rn,op2 – Shift left/right
B/BEQ/BNE/BGT/BLT label – Branch
HALT – Stop execution
PRINT Rn – Output Rn (simulator only)

op2 = Rn (register) or #n (immediate value)

The AQA instruction set

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.

InstructionWhat 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 / BLTBranch 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.
HALTStop execution.

Mistakes I see most often as an examiner

  • Confusing LDR with MOV. LDR fetches from a memory location; MOV copies an immediate value or a register. Using LDR where MOV is meant, or the reverse, is the single most frequent error on this topic.
  • Omitting the hash on immediate values. ADD R1, R0, 5 is not valid — it must be #5. Without the hash the 5 reads as a register reference.
  • Expecting CMP to change the register. It does not. CMP only sets the condition flags so that the branch which follows can act on them.
  • Branching without comparing first. A conditional branch acts on flags set by the most recent CMP. A BEQ with no preceding comparison behaves unpredictably and will not score.
  • Forgetting HALT. Without it, execution continues past the intended end of the program into whatever follows.

How assembly questions are usually asked

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.

Frequently asked questions

What is operand2 in AQA assembly language?

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.

What is the difference between LDR and MOV?

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.

How does CMP work?

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.

Do I have to memorise the AQA instruction set for the exam?

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.

Which specification is this for?

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.