AQA A-Level Computer Science 7517
Fundamentals of Programming
Fundamentals of Data Structures
Fundamentals of Algorithms
Theory of Computation
Fundamentals of Data Representation
Fundamentals of Computer Systems
Fundamentals of Computer Organisation and Architecture
Fundamentals of Communication and Networking
Consequences of Uses of Computing
Systematic Approach to Problem Solving
Fundamentals of Databases
Big Data
Fundamentals of Computer Organisation and Architecture
Addressing modes
- 2 things to know
- Paper 2
Overview
Recall questions on immediate against direct addressing, what ADD 20 does under each, their relative speed and flexibility, and why a loop counter needs direct addressing.
What you need to know
Answer each one before you reveal it.
Compare immediate and direct addressing for flexibility, and say when each is appropriate.
Questions from this subtopic
Each one with the model answer underneath.
- 1
Which two addressing modes are used here, and what does an addressing mode mean?
Model answer
Immediate addressing and direct addressing. An addressing mode is the rule for how the operand of an instruction is to be interpreted, that is, how the processor works out from the operand bits where the actual datum it must use is to be found.
- 2
Define immediate addressing.
Model answer
In immediate addressing the operand is the datum. The value written in the operand field is the actual value to be used, so the processor uses it directly without going to memory to look anything up.
- 3
Define direct addressing.
Model answer
The operand field does not hold the value to be worked on; it holds the location at which that value is kept, so the processor must make a further access to go and collect the datum from there before it can use it. The location may be a main memory address or a register. Under this mode the instruction LDA 100 leaves the accumulator holding whatever is currently stored at address 100 — not the number 100 itself, which is what an immediate operand would have given.
- 4
Take the instruction ADD 20. What does it do under each addressing mode?
Model answer
Under immediate addressing it adds the number 20 to the accumulator. Under direct addressing it fetches whatever is currently stored in memory location 20 and adds that to the accumulator; if location 20 happened to hold 3, it would add 3. The written instruction looks nearly identical, so the addressing mode entirely determines what the instruction means.
- 5
How is immediate addressing usually written in assembly language, and why is the notation important?
Model answer
The operand is preceded by a hash symbol, as in ADD R1, R1, #20, whereas a direct operand is written as a plain address or a register name, as in LDR R1, 20. The notation matters because it is the only thing distinguishing 'the number twenty' from 'the contents of location twenty', and omitting the hash is one of the commonest mistakes in written answers.
- 6
Compare immediate and direct addressing for speed.
Model answer
Immediate addressing is faster because the datum arrives inside the instruction itself, so the execute stage needs no memory access at all. Direct addressing requires an additional read: the operand must be placed in the memory address register and the value fetched over the buses into the memory buffer register before the operation can proceed, which costs extra clock cycles.
Other ways to work this
The same content, four other ways.
What is inside Levo
Six ways to work the same material.
Every question in Fundamentals of Computer Organisation and Architecture, on a schedule.
Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.
Or £46 a year, about £3.83 a month. Cancel anytime.