Skip to topic
    ← Back to course topics

    Addressing modes — AQA A-Level Computer Science

    Addressing modes dictate how the operand field of a machine-code instruction identifies the data to be used, whether as a literal constant, memory address, or offset. In AQA A-Level Computer Science, mastering immediate, direct, indirect, and indexed addressing is essential for assembly language comprehension and understanding processor architecture.

    Addressing modes explained

    This statement requires you to understand two addressing modes and to apply them to work out what an instruction does.

    Read the full explanation

    In immediate addressing, the operand is the actual data value to be used, so the instruction contains the value itself. In direct addressing, the operand is the memory address where the data is stored, so the processor must fetch the value from that location. Applying the modes means reading an instruction, deciding which mode it uses from the form of its operand, and then tracing the result. For example, if the operand 20 is used immediately, the value 20 is used directly; if it is used directly, the processor reads the contents of memory address 20 and uses that value instead. Always state clearly whether the operand is a value or an address before carrying out the calculation.

    Your focus

    1. Understand and apply immediate and direct addressing modes.

    Which command word is this?

    State the operational mechanics of the addressing mode clearly, detailing how the processor locates the operand without needing evaluation.

    Addressing modes exam tips

    Topic Overview

    Addressing modes define the rules used by the central processing unit to interpret the operand field within machine-code instructions. Understanding these modes reveals how low-level programs manipulate literals, access variables in main memory, and traverse structured datasets efficiently.

    In the AQA A-Level specification, students must distinguish between immediate, direct, indirect, and indexed addressing modes. Mastery of this topic connects low-level Fetch-Execute mechanics with high-level programming constructs such as arrays, pointers, and dynamic memory allocation.

    Key Concepts
    • →Immediate Addressing: The operand field contains the actual data value to be used by the instruction, requiring no memory access.
    • →Direct (Absolute) Addressing: The operand field contains the memory address where the target data is held, requiring one memory read.
    • →Indirect Addressing: The operand field contains the memory address of a location that holds the target effective address, requiring two memory reads.
    • →Indexed Addressing: The effective address is calculated dynamically at runtime by adding a constant base address to the contents of the Index Register (IX).
    Marking Points
    • Defines immediate addressing as the operand being the data value itself.
    • Defines direct addressing as the operand being the memory address where the data is held.
    • Applies immediate addressing by using the operand value directly in the calculation.
    • Applies direct addressing by fetching the contents of the stated memory address.
    • Distinguishes the two modes by whether the operand is treated as a value or an address.
    Examiner Tips
    • 💡Identify the mode first by asking whether the operand is a value or an address, then carry out the calculation.
    • 💡Show the memory lookup step explicitly in direct addressing questions.
    • 💡Use the terms immediate and direct consistently with the definitions in the specification.
    • 💡Look out for assembly prefix conventions: '#' almost always denotes immediate addressing, whereas parentheses or brackets such as '(100)' denote indirect addressing in AQA exam papers.
    • 💡When explaining indexed addressing, always write out the formula 'Effective Address = Base Address + Index Register' to guarantee marks.
    • 💡In scenario questions involving arrays, always recommend indexed addressing and explain that incrementing the Index Register allows sequential element access in a loop.
    Common Mistakes
    • Treats the operand as a memory address in immediate addressing; correct by using the operand as the data value itself.
    • Uses the operand value in direct addressing without reading the memory location; correct by fetching the contents of that address.
    • Confuses direct addressing with indirect addressing; correct by noting direct addressing uses the operand as the address itself.
    • Believing immediate addressing uses memory: Students often write that immediate addressing looks up address 0 or a register, rather than using the literal value provided within the instruction itself.
    • Confusing indirect addressing with indexed addressing: Students often mix up looking up a pointer (indirect) with adding an offset via the Index Register (indexed).
    • Overlooking the performance penalty of indirect addressing: Students frequently forget that indirect addressing incurs an extra memory read cycle, degrading execution speed relative to direct addressing.
    Revision Plan
    1. 1Day 1: Define all four addressing modes (immediate, direct, indirect, indexed) and sketch memory lookup diagrams for each.
    2. 2Day 2: Complete trace tables and memory lookup questions calculating the accumulator value for identical operand numbers across different modes.
    3. 3Day 3: Practice AQA past paper questions focusing on the benefits and trade-offs of indirect versus direct addressing.
    4. 4Day 4: Implement a mock assembly loop traversing an array using indexed addressing and an increment instruction on the Index Register.
    Exam Question Types
    • 📋Trace and Calculate: Given a memory map and a series of instructions using various addressing modes, calculate the values loaded into registers.
    • 📋Definitions and Comparisons: Short-answer questions asking for concise definitions of specific modes and comparisons between their execution speed and memory limits.
    • 📋Application Scenarios: Explaining which addressing mode is most appropriate for a given task (e.g. declaring a mathematical constant vs. iterating over an array).
    Command Word Expectations (AQA)
    Describe

    State the operational mechanics of the addressing mode clearly, detailing how the processor locates the operand without needing evaluation.

    Explain

    Provide technical reasoning, such as why a particular mode is selected for an array or the performance impact of multi-stage memory lookups.

    Compare

    Identify explicit similarities and differences between two modes, addressing factors like memory access cycles, execution speed, and addressable range.

    How Students Lose Marks (Examiner Pitfalls)
    Pitfall: Confusing direct and indirect addressing by failing to trace the second memory access required by indirect addressing.
    ❌ Weak Answer (Loses Marks):Indirect addressing means you get the value stored at the address given in the instruction.
    Example improved answer:In direct addressing, the operand specifies the memory address where the target data is held. In indirect addressing, the operand specifies a memory location that contains the effective address of the data, requiring two sequential memory accesses to retrieve the actual operand.
    Examiner Tip: Draw pointer diagrams during revision. Explicitly state 'the memory address of the memory address' to guarantee full marks when defining indirect addressing.
    Pitfall: Miscalculating the effective address in indexed addressing by multiplying instead of adding the base address and index register value.
    ❌ Weak Answer (Loses Marks):Indexed addressing uses an index register to multiply the base address to jump to a point in an array.
    Example improved answer:Indexed addressing calculates the effective address of the operand by adding the contents of the Index Register (IX) to the base address specified in the instruction's operand field (Effective Address = Base Address + IX).
    Examiner Tip: Always state the mathematical relationship 'Effective Address = Base Address + Index Register' and emphasize its use in traversing contiguous linear data structures like arrays.
    Step-by-Step Worked Solutions

    Question: A computer uses a 16-bit instruction format. Memory location 200 contains the value 450. Memory location 450 contains the value 88. The Index Register (IX) currently stores the denary value 5. Determine the value loaded into the accumulator (ACC) by each of the following assembly instructions: (a) LOAD #200 (b) LOAD 200 (c) LOAD (200) (d) LOAD 200, IX

    1. 1.Step 1: Identify the addressing mode indicated by the syntax for each instruction: # denotes immediate, a bare number denotes direct, brackets denote indirect, and IX denotes indexed.
    2. 2.Step 2: For (a) LOAD #200 (Immediate): The operand itself is the data value, so 200 is loaded directly into ACC.
    3. 3.Step 3: For (b) LOAD 200 (Direct): The operand 200 is the memory address; look up location 200, which holds 450. Thus, 450 is loaded into ACC.
    4. 4.Step 4: For (c) LOAD (200) (Indirect): Location 200 holds 450, which is treated as an address. Look up location 450, which holds 88. Thus, 88 is loaded into ACC.
    5. 5.Step 5: For (d) LOAD 200, IX (Indexed): Calculate effective address by adding base address 200 to IX (5), giving 205. If location 205 is uninitialized or not stated, show the formula. Assuming location 205 contains its own look-up, state: Effective Address is 205, value loaded is contents of memory location 205.
    Final Answer: (a) 200, (b) 450, (c) 88, (d) Contents of memory address 205 (Effective Address = 200 + 5 = 205).

    Question: Explain one advantage and one disadvantage of using indirect addressing compared to direct addressing in assembly programming.

    1. 1.Step 1: Identify the structural constraints of direct addressing (limited address space determined by the bit-width of the operand field).
    2. 2.Step 2: Contrast this with indirect addressing, noting that the location pointed to can utilize the full word length of memory, allowing access to a larger address space.
    3. 3.Step 3: Consider the operational overhead, specifically the extra Fetch-Execute cycle needed to retrieve the effective address before fetching the operand.
    Final Answer: Advantage: Indirect addressing expands the accessible address range beyond the bit-limit of the instruction's operand field, allowing a program to address any word in memory. Disadvantage: It requires an additional memory access cycle to fetch the effective address, resulting in slower execution times compared to direct addressing.
    Active Recall Memory Test
    What addressing mode is being used in the instruction 'MOV R0, #25' and what does # indicate?
    Key Fact: Immediate addressing; the '#' symbol indicates that 25 is a literal numeric constant to be loaded directly into R0.
    How is the effective address calculated when using indexed addressing?
    Key Fact: Effective Address = Base Address (from operand) + Contents of the Index Register (IX).
    Why does indirect addressing require two memory access cycles during operand fetch?
    Key Fact: The first access retrieves the effective address stored at the pointer location; the second access retrieves the actual data held at that effective address.
    Which addressing mode is most efficient for accessing elements in a continuous array inside a loop, and why?
    Key Fact: Indexed addressing, because the base address marks the array start and the Index Register can be incremented each iteration.
    Frequently Asked Questions
    What is the difference between direct and immediate addressing?
    In immediate addressing, the operand field contains the actual data value to be used directly by the CPU, requiring zero additional memory fetches. In direct addressing, the operand field contains a memory address, meaning the CPU must perform a memory read cycle to retrieve the data located at that address.
    Why would a programmer use indirect addressing instead of direct addressing?
    Direct addressing is constrained by the bit-width of the operand field in the instruction word, which limits the maximum memory address that can be referenced. Indirect addressing overcomes this limitation because the target address is stored inside a full memory word, enabling programs to reference any location across the entire address space. It also simplifies dynamic data structures and pointer referencing.
    How does indexed addressing work with arrays?
    Indexed addressing sets the operand field to the start (base address) of the array in memory. The Index Register (IX) holds the offset or index of the desired element. By incrementing the Index Register in a loop, the program steps through consecutive array elements without needing to rewrite or modify the instruction code.
    Does immediate addressing ever access RAM to fetch data?
    No. The data value in immediate addressing is loaded as part of the instruction itself during the instruction fetch phase. Once the instruction is decoded in the Current Instruction Register (CIR), the operand value is already in the processor, so no secondary RAM access is needed.