AS Level · Topic 4.2
A-Level Computer Science 9618 / Topic 4 / AS

Where is the value?

The same operand, 200, can mean the number 200, the value stored at address 200, or something stored somewhere else entirely. The addressing mode decides which. Learn the five modes in the 9618 syllabus and work out exactly what each instruction loads.

The key idea

An addressing mode tells the processor how to use the operand to find the data. Immediate: the operand is the value (LDM #n). Direct: the operand is the address of the value (LDD). Indirect: the operand is an address that holds the address of the value (LDI, CMI). Indexed: the address is the operand plus the contents of the index register (LDX). Relative: the address is an offset number of locations away from the address of the current instruction.

same operand, different modes (IX holds 2) 200 | 203 201 | 50 202 | 7 203 | 18 204 | 25 LDM #200ACC = 200 LDD 200ACC = 203 LDX 200ACC = 7 LDI 200ACC = 18 immediate: the operand is the valuedirect: the operand is the address indexed: 200 + IX = 202indirect: 200 holds 203, use 203
Fig. 1: one operand, 200, gives four different values in four different modes
Section 01

Five modes.

In the lab, choose a mode, change the operand and the index register, and watch which memory location is used. Then fix each definition in your memory with its 9618 instruction.

ModeHow the operand is used9618 example
ImmediateThe operand is the actual value to use.LDM #200 loads the number 200
DirectThe operand is the address of the value.LDD 200 loads the contents of address 200
IndirectThe operand is an address; the contents of that address is the address of the value.LDI 200 loads the contents of the address stored in 200
IndexedThe address is the operand + the contents of the index register (IX).LDX 200 with IX = 2 loads the contents of 202
RelativeThe address is an offset from the address of the current instruction.An instruction at 150 with offset 6 uses address 156
Examiner trap

The # is what makes LDM, LDR, ADD #n, SUB #n and CMP #n immediate. Without it, ADD 5 means "add the contents of address 5", not "add 5".

Section 02

Work out the value.

The usual exam question gives a block of memory, a value in IX and several instructions, and asks what ends up in the accumulator. Draw an arrow for every step you follow.

Address200201202203204
Contents2035071825

The index register (IX) holds 2.

Worked example Four loads
Using the memory above, give the contents of the ACC after each instruction: LDM #200, LDD 200, LDX 200, LDI 200.
  1. LDM #200 is immediate: the operand is the value, so ACC = 200.
  2. LDD 200 is direct: load the contents of address 200, so ACC = 203.
  3. LDX 200 is indexed: address = 200 + IX = 200 + 2 = 202, which holds 7, so ACC = 7.
  4. LDI 200 is indirect: address 200 holds 203, so use address 203, which holds 18, so ACC = 18.
Answer: 200, 203, 7, 18
Your turn
Using the same memory, but with IX now holding 1, give the ACC after LDX 202, and state whether CMI 200 followed by JPE would jump if the ACC held 18.
Examiner trap

Indexed and indirect are easy to swap. Indexed adds IX to the operand; indirect looks up a second address in memory.

Stage 1 · Learn

Check what the sim just showed you

Four quick checks. Each correct answer earns XP and records this skill on your profile.

Quick check+10 XP

In which mode is the operand the actual value to be used?

Quick check+10 XP

In the lab, IX holds 3. Which address does LDX 210 use?

Quick check+10 XP

Address 200 holds 203 and address 203 holds 18. What does LDI 200 load?

Quick check+10 XP

Which mode works out the address as an offset from the current instruction?

Section 03

Why each mode exists.

Questions also ask why a mode is useful. Link each mode to the job it makes easy.

100  LDR #0
101  LDX 300
102  OUT
103  INC IX
104  ...

LDR #0 sets IX to 0; LDX 300 loads the contents of 300 + IX; INC IX moves on to the next element, so the next time round the loop LDX 300 reads 301, then 302, and so on.

Your turn
A list of five characters is stored at addresses 300 to 304. Explain why LDX 300 inside a loop is better than writing LDD 300, LDD 301, LDD 302 and so on.
Stage 2 · Exam

Exam-style questions

Unlocks once the four checks above are done. Worth more XP, written to AS Paper 1 and Paper 2 standard.

Finish the four checks above to unlock the exam questions
Exam style+20 XP

Address 80 holds 85, address 85 holds 4 and IX holds 5. Which instruction loads 4 into the ACC?

Exam style+20 XP

Which instruction uses immediate addressing?

Exam style+20 XP

Why is indexed addressing useful?

Exam style+20 XP

Which is an advantage of relative addressing?

Skill unlocked

Addressing modes, mastered.

This skill is now recorded on your profile. Keep the chain going.

-Rank -Level -Score -Topics
Go deeper · practice
Six original Cambridge-style questions
Immediate, direct, indirect, indexed and relative addressing, and the value each 9618 load instruction puts in the accumulator.