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
Mnemonic
Example
Effect
Addressing mode
LDM
LDM #42
Load the literal value 42 into ACC
Immediate (value)
LDD
LDD 100
Load the value stored at address 100 into ACC
Direct
LDI
LDI 100
The value at address 100 is used as the address; load the value at THAT address into ACC
Indirect
LDX
LDX 100
Load value at address (100 + IX) into ACC
Indexed
LDR
LDR #42
Load the literal value 42 into IX
Immediate (for IX)
STO
STO 200
Store value in ACC to address 200
Direct
MOV
MOV IX
Move value in ACC to register IX (or ACC to IX)
Register
Arithmetic Instructions
Mnemonic
Example
Effect
ADD
ADD 100 or ADD #5
Add value at address 100 (or literal #5) to ACC
SUB
SUB 100 or SUB #5
Subtract value at address 100 (or literal #5) from ACC
INC
INC ACC or INC IX
Increment ACC or IX by 1
DEC
DEC ACC or DEC IX
Decrement ACC or IX by 1
Comparison Instructions
Mnemonic
Example
Effect
CMP
CMP 100 or CMP #5
Compare ACC with value at address 100 (or literal #5) — sets flags (equal/not equal etc.) but does NOT change ACC
CMI
CMI 100
Compare ACC with value at the address stored at 100 (indirect compare)
Jump Instructions
Mnemonic
Example
Effect
JMP
JMP LOOP
Unconditional jump — PC is set to address of label LOOP
JPE
JPE LOOP
Jump to LOOP if the result of previous CMP was Equal
JPN
JPN LOOP
Jump to LOOP if the result of previous CMP was Not equal
JGT
JGT LOOP
Jump if greater than (ACC > operand from CMP)
JLT
JLT LOOP
Jump if less than (ACC < operand from CMP)
Bitwise / Logical Instructions
Mnemonic
Example
Effect
AND
AND #B01001111
Bitwise AND of ACC with operand (used for masking)
OR
OR #B00001111
Bitwise OR of ACC with operand
XOR
XOR #B11111111
Bitwise XOR of ACC with operand
LSL
LSL #3
Logical Shift Left by 3 bits (bits shifted off end are lost; 0s fill from right)
LSR
LSR #2
Logical Shift Right by 2 bits (bits shifted off end are lost; 0s fill from left)
I/O and Control Instructions
Mnemonic
Effect
IN
Read a character from keyboard into ACC (ASCII code stored in ACC)
OUT
Write the character in ACC (as ASCII) to the screen
END
Halt the program (stop execution)
Addressing Modes — Summary
Mode
Prefix
Meaning
Example
Immediate
#
The value following # is the data itself
LDM #42 → ACC = 42
Direct
none
The number is a memory address; fetch value from that address
LDD 100 → ACC = Mem[100]
Indirect
none (use LDI)
The number is an address; that address holds another address; fetch from the second address
LDI 100 → ACC = Mem[Mem[100]]
Indexed
none (use LDX)
Effective address = operand + IX
LDX 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!
Mnemonic
Meaning & Use
🎯
Mini Test — 1.3.3 Assembly Language
10 questions · 10 marks · 10 minutes
⏱ 10:00
10 marks
Section A — Multiple Choice [5 marks]
Q1What does LDM #25 do?
Q2Which instruction loads a value into the Index Register IX?
Q3After CMP #10, does the value in ACC change?
Q4ACC = 00001000 (binary = 8). After LSL #1, what decimal value is in ACC?
Q5Which instruction performs an unconditional jump?
Section B — Short Answer [5 marks]
Q6Explain the difference between direct and indirect addressing, giving an example of each.
Mark schemeDirect: LDD 100 — the number is a memory address, load value from Mem[100] [1]. Indirect: LDI 100 — the value at Mem[100] is itself used as an address, load from Mem[Mem[100]] [1]. Award 1 if distinction clear without examples.
Q7Write assembly code to subtract the value at address B from the value at address A and store the result at address C.
Mark schemeLDD A; SUB B; STO C; END [1 mark for correct sequence].
Q8The ACC holds 11110000. What is the result after AND #B00111100? Show your working.
Mark scheme11110000 AND 00111100 = 00110000 [1 mark]. Accept binary or decimal equivalent (48).
Q9Explain what JPE and JPN instructions do, and when each is used.
Mark schemeJPE (Jump if Equal): jumps to the specified address if the previous CMP result showed equality (ACC = operand) [1]. JPN (Jump if Not equal): jumps if the previous CMP showed inequality [1].
Q10State what the IN and OUT instructions do in Cambridge 9618 assembly language.
Mark schemeIN: reads a character from the keyboard and stores its ASCII code in ACC [1]. OUT: outputs the character whose ASCII code is currently in ACC to the screen [1].