💻 Paper 1 · 1.3 Processor Fundamentals
1.3.3 Cambridge Assembly Language Instruction Set
Cambridge 9618 · International A Level Computer Science · ~16 min read
Notes
Video
Slides
Quiz
Worksheet

Cambridge 9618 Assembly Language

Cambridge 9618 uses a specific assembly instruction set that you must know for the exam. This is a simplified single-accumulator architecture. All arithmetic and logical operations act on the Accumulator (ACC). The Index Register (IX) is used for indexed addressing.

The Instruction Set

Data Movement Instructions

MnemonicExampleEffectAddressing mode
LDMLDM #42Load the literal value 42 into ACCImmediate (value)
LDDLDD 100Load the value stored at address 100 into ACCDirect
LDILDI 100The value at address 100 is used as the address; load the value at THAT address into ACCIndirect
LDXLDX 100Load value at address (100 + IX) into ACCIndexed
LDRLDR #42Load the literal value 42 into IXImmediate (for IX)
STOSTO 200Store value in ACC to address 200Direct
MOVMOV IXMove value in ACC to register IX (or ACC to IX)Register

Arithmetic Instructions

MnemonicExampleEffect
ADDADD 100 or ADD #5Add value at address 100 (or literal #5) to ACC
SUBSUB 100 or SUB #5Subtract value at address 100 (or literal #5) from ACC
INCINC ACC or INC IXIncrement ACC or IX by 1
DECDEC ACC or DEC IXDecrement ACC or IX by 1

Comparison Instructions

MnemonicExampleEffect
CMPCMP 100 or CMP #5Compare ACC with value at address 100 (or literal #5) — sets flags (equal/not equal etc.) but does NOT change ACC
CMICMI 100Compare ACC with value at the address stored at 100 (indirect compare)

Jump Instructions

MnemonicExampleEffect
JMPJMP LOOPUnconditional jump — PC is set to address of label LOOP
JPEJPE LOOPJump to LOOP if the result of previous CMP was Equal
JPNJPN LOOPJump to LOOP if the result of previous CMP was Not equal
JGTJGT LOOPJump if greater than (ACC > operand from CMP)
JLTJLT LOOPJump if less than (ACC < operand from CMP)

Bitwise / Logical Instructions

MnemonicExampleEffect
ANDAND #B01001111Bitwise AND of ACC with operand (used for masking)
OROR #B00001111Bitwise OR of ACC with operand
XORXOR #B11111111Bitwise XOR of ACC with operand
LSLLSL #3Logical Shift Left by 3 bits (bits shifted off end are lost; 0s fill from right)
LSRLSR #2Logical Shift Right by 2 bits (bits shifted off end are lost; 0s fill from left)

I/O and Control Instructions

MnemonicEffect
INRead a character from keyboard into ACC (ASCII code stored in ACC)
OUTWrite the character in ACC (as ASCII) to the screen
ENDHalt the program (stop execution)

Addressing Modes — Summary

ModePrefixMeaningExample
Immediate#The value following # is the data itselfLDM #42 → ACC = 42
DirectnoneThe number is a memory address; fetch value from that addressLDD 100 → ACC = Mem[100]
Indirectnone (use LDI)The number is an address; that address holds another address; fetch from the second addressLDI 100 → ACC = Mem[Mem[100]]
Indexednone (use LDX)Effective address = operand + IXLDX 100 (if IX=3) → ACC = Mem[103]

Example Program — Counting Loop

LDM#0; Load 0 into ACC (initialise counter)
STOCOUNT; Store 0 at address COUNT
LOOP:LDDCOUNT; Load current counter value
CMP#10; Compare ACC with 10
JPEDONE; Jump to DONE if equal (counter = 10)
INCACC; Increment counter
STOCOUNT; Store updated counter
JMPLOOP; Go back to LOOP
DONE:END; Halt
COUNT:0; Data storage location

Bit Manipulation with Masking

Bitwise operations are used to manipulate specific bits without affecting others:

  • AND to clear bits (masking off): e.g. AND #B11110000 clears the lower 4 bits
  • OR to set bits: e.g. OR #B00001111 sets the lower 4 bits
  • XOR to toggle bits: e.g. XOR #B11111111 inverts all bits
  • LSL #n is equivalent to multiplying by 2ⁿ (for unsigned integers)
  • LSR #n is equivalent to dividing by 2ⁿ (for unsigned integers)
Exam tip: The # prefix means immediate (literal value). Without #, the number is a memory address. Cambridge questions test whether you know the difference between LDM #5 (load value 5) vs LDD 5 (load the value stored at address 5). Always check which instruction is being asked about. LDR loads a literal into IX (not ACC).
⚠️ Common Mistakes
  • Using LDD #5 instead of LDM #5 — LDD uses address 5, LDM uses literal 5
  • Confusing LDI and LDX — LDI is indirect (address of address); LDX uses IX as offset
  • Forgetting that CMP does NOT change ACC — it only sets flags
  • Using LDR to load into ACC — LDR loads into IX, not ACC
  • LSL shifts left = multiplies (×2 per shift); LSR shifts right = divides (÷2 per shift) — opposite of what some students think
✅ Notes completed!
Video coming soon
Click slide or press arrow keys to navigate

Worksheet — 1.3.3 Assembly Language

8 questions · instantly marked · Cambridge 9618 standard

Q1Explain the difference between the instructions LDM #50 and LDD 50.[2]
✅ Mark scheme
Mark scheme
LDM #50 loads the literal (immediate) value 50 into the ACC [1]; LDD 50 loads the value stored at memory address 50 into the ACC [1].
Q2If address 200 contains the value 300, and address 300 contains the value 42, what value is loaded into ACC by LDI 200?[2]
✅ Mark scheme
Mark scheme
LDI uses indirect addressing: the value at address 200 (= 300) is used as the second address [1]; the value at address 300 (= 42) is loaded into ACC [1]. Answer: 42.
Q3If IX = 4 and address 104 contains the value 99, what value is loaded into ACC by LDX 100?[2]
✅ Mark scheme
Mark scheme
LDX uses indexed addressing: effective address = 100 + IX = 100 + 4 = 104 [1]; the value at address 104 (= 99) is loaded into ACC [1]. Answer: 99.
Q4Write a short assembly program to add the values stored at addresses NUM1 and NUM2 and store the result at address RESULT.[4]
✅ Mark scheme
Mark scheme
LDD NUM1 [1]; ADD NUM2 [1]; STO RESULT [1]; END [1]. Award 3 marks if END omitted but rest correct.
Q5The ACC contains the value 11001010 (binary). What is in the ACC after executing AND #B00001111?[2]
✅ Mark scheme
Mark scheme
11001010 AND 00001111 = 00001010 [1]; this operation masks off the upper 4 bits (sets them to 0) and preserves the lower 4 bits [1]. Answer: 00001010.
Q6What does the instruction CMP #10 do? Does it change the value in ACC?[2]
✅ Mark scheme
Mark scheme
CMP compares the value in ACC with the literal value 10 and sets condition flags (equal/not equal/greater/less) [1]; it does NOT change the value stored in ACC [1].
Q7The ACC holds the value 00000100 (binary = 4). What decimal value is in ACC after LSL #2?[2]
✅ Mark scheme
Mark scheme
LSL #2 shifts the bits left by 2 positions: 00000100 → 00010000 [1]; binary 00010000 = decimal 16 (which is 4 × 2² = 4 × 4 = 16) [1].
Q8Explain what the instruction LDR #6 does. How is this different from LDM #6?[2]
✅ Mark scheme
Mark scheme
LDR #6 loads the literal value 6 into the Index Register (IX) [1]; LDM #6 loads the literal value 6 into the Accumulator (ACC) — the difference is the destination register [1].
Topic Quiz
Question 1 of 15
You scored
out of 15
Card 1 of 12
Click to reveal definition
🎉
All cards reviewed!
MnemonicMeaning & Use
🎯

Mini Test — 1.3.3 Assembly Language

10 questions · 10 marks · 10 minutes

← 1.3.2 FDE Cycle
20 of 82 · Cambridge 9618
1.3.4 Input/Output Devices →
🔒
Pro lesson
Upgrade to CSZone Pro to access all Cambridge 9618 A Level lessons.
Upgrade to Pro →