Pro Lesson
This lesson is part of the Cambridge 9618 Pro track. Upgrade to access all 82 lessons, worksheets, quizzes and mini tests.
Upgrade to Pro →
💻 Paper 1 · 1.4 Assembly Language Programming
1.4.2 Addressing Modes
Cambridge 9618 · International A Level Computer Science · ~12 min read
Notes
Video
Slides
Quiz
Worksheet

What is an Addressing Mode?

An addressing mode specifies how the operand of an instruction is interpreted — how to find the actual data the instruction will operate on. Different addressing modes offer trade-offs between speed, flexibility and memory usage.

Cambridge 9618 specifies four addressing modes:

Immediate
LDM #n
The operand IS the data. The value #n is loaded directly into ACC. No memory access needed.
LDM #42 ; ACC ← 42
Direct
LDD address
The operand is a memory address. The data stored AT that address is loaded into ACC.
LDD 200 ; ACC ← Mem[200]
Indirect
LDI address
The operand is a memory address. That address holds ANOTHER address. The data at that second address is loaded into ACC.
LDI 200 ; ACC ← Mem[Mem[200]]
Indexed
LDX address
The effective address = operand + Index Register (IX). Lets you traverse arrays by incrementing IX.
LDX 100 ; ACC ← Mem[100 + IX]

Immediate Addressing

In immediate addressing, the operand is the actual data value (not an address). The # symbol signals immediate mode. This is the fastest mode — no memory access is needed because the data is embedded in the instruction itself.

LDM#10; Load immediate value 10 into ACC — no memory needed
LDR#3; Load immediate value 3 into IX

Limitation: You can only use a fixed, known constant. If the data is variable or stored in memory, you need a different mode.

Direct Addressing

In direct addressing, the operand is a memory address, and the CPU fetches the data stored at that address. This is the standard mode for accessing named variables.

LDDCOUNT; Load value stored at address COUNT into ACC
ADDTOTAL; Add value at TOTAL to ACC
STORESULT; Store ACC to address RESULT

Indirect Addressing

In indirect addressing (LDI), the operand is an address that contains another address. The CPU first fetches the address stored at the operand, then uses that second address to fetch the actual data. This is used to implement pointers.

LDIPTR; Step 1: Read Mem[PTR] to get address X; Step 2: ACC ← Mem[X]
StepAction
1Read address stored at Mem[PTR] — call it X
2Load the value from Mem[X] into ACC

Use case: Indirect addressing is useful when the address of the data changes at runtime (e.g., implementing a linked list or pointer-based data structure).

Indexed Addressing

In indexed addressing (LDX), the effective address = base address + IX (Index Register). By incrementing IX, you can step through an array element by element without modifying the base address in the instruction.

LDR#0; IX = 0 (start at first element)
LDXARRAY; ACC = Mem[ARRAY + 0] = first element
INCIX; IX = 1
LDXARRAY; ACC = Mem[ARRAY + 1] = second element
INCIX; IX = 2
LDXARRAY; ACC = Mem[ARRAY + 2] = third element

Array loop pattern: Combine LDX with INC IX and CMP/JPN or JPE to loop through all elements of an array efficiently.

Comparison of Addressing Modes

ModeInstructionSource of dataMemory accessesUse case
ImmediateLDM #nOperand = data0 extraLoad a constant
DirectLDD addrMem[addr]1Load a named variable
IndirectLDI addrMem[Mem[addr]]2Pointer / dynamic address
IndexedLDX addrMem[addr + IX]1Array element access
Exam tip: Cambridge questions frequently ask you to state the addressing mode used in a given instruction and explain how the effective address (or data) is determined. Remember: # means immediate (operand IS the data), no # means direct (operand IS an address), LDI means indirect (two-step lookup), LDX means indexed (add IX to base address).
⚠️ Common Mistakes
  • Confusing direct and immediate — LDM #5 loads the value 5; LDD 5 loads whatever is stored at memory address 5
  • Saying indirect addressing has one memory access — it requires TWO: one to get the pointer, one to get the data
  • Forgetting that LDR loads IX (not ACC) — used to initialise the index register
  • Using INC ACC instead of INC IX when stepping through an array with indexed addressing
✅ Notes completed!
Video coming soon
Click slide or press arrow keys to navigate

Worksheet — 1.4.2 Addressing Modes

7 questions · instantly marked · Cambridge 9618 standard

Q1State the four addressing modes specified in the Cambridge 9618 syllabus and give the instruction used for each.[4]
✅ Mark scheme
Mark scheme
Immediate – LDM #n [1]; Direct – LDD [1]; Indirect – LDI [1]; Indexed – LDX [1].
Q2For the instruction LDD 300: state the addressing mode and describe how the value loaded into ACC is determined.[2]
✅ Mark scheme
Mark scheme
Direct addressing [1]; the value stored in memory at address 300 is loaded into ACC — ACC ← Mem[300] [1].
Q3Explain, with an example, why indirect addressing requires two memory accesses.[3]
✅ Mark scheme
Mark scheme
First access reads the value stored at the operand address — this value is treated as a second address [1]; second access reads the actual data from that second address [1]; e.g. LDI 200: first read Mem[200] to get address X; then ACC ← Mem[X] — two separate memory reads [1].
Q4IX = 5. The instruction LDX ARRAY is executed where ARRAY starts at address 1000. What address is accessed and what addressing mode is this?[2]
✅ Mark scheme
Mark scheme
Indexed addressing [1]; effective address = 1000 + 5 = 1005; ACC ← Mem[1005] [1].
Q5Explain why indexed addressing is particularly useful for processing arrays.[3]
✅ Mark scheme
Mark scheme
The base address (ARRAY) stays fixed in the instruction [1]; by incrementing IX, successive elements at consecutive addresses can be accessed without changing the instruction [1]; this allows a loop to process all array elements using INC IX and LDX ARRAY [1].
Q6State one advantage and one disadvantage of immediate addressing compared to direct addressing.[2]
✅ Mark scheme
Mark scheme
Advantage: faster — no memory access needed, the value is in the instruction itself [1]; Disadvantage: the value must be a fixed constant known at assembly time — it cannot be a variable stored in memory [1].
Q7Identify the addressing mode of each: (a) LDM #7 (b) LDD 500 (c) LDI PTR (d) LDX TABLE[4]
✅ Mark scheme
Mark scheme
(a) Immediate [1]; (b) Direct [1]; (c) Indirect [1]; (d) Indexed [1].
Q8Explain why direct addressing mode allows faster execution than indirect addressing mode. Give one scenario where indirect addressing is essential and explain why direct addressing cannot be used in that scenario.[4]
✅ Mark scheme
Direct addressing: the operand field contains the actual memory address, no further lookup needed — 1 mark; Indirect: the operand contains the address of a location holding the actual address, requiring an extra memory access — 1 mark; direct is faster as it requires one fewer memory access — 1 mark; indirect is essential when implementing pointers or dynamic data structures (e.g. linked lists) where the target address is not known at compile time and is stored as a variable — 1 mark.
Topic Quiz
Question 1 of 12
You scored
out of 12
Card 1 of 7
Click to reveal definition
🎉
All cards reviewed!
TermDefinition
🎯

Mini Test — 1.4.2 Addressing Modes

10 questions · 10 marks · 10 minutes

← 1.4.1 Assembly Programming
25 of 82 · Cambridge 9618
1.5.1 Operating System →