What is machine code structure and how do addressing modes find operands?
Understand the structure of a machine code instruction (opcode and operand), immediate and direct addressing modes, and the relationship between assembly language and machine code.
A focused answer to AQA A-Level Computer Science 4.7.4 and 4.7.5, covering the structure of a machine code instruction (opcode and operand), the immediate and direct addressing modes, and the relationship between assembly language and machine code.
Reviewed by: AI editorial process; not yet individually human-reviewed
Have a quick question? Jump to the Q&A page
Jump to a section
What this dot point is asking
AQA wants you to describe the structure of a machine code instruction (opcode and operand), explain immediate and direct addressing, and relate assembly language mnemonics to machine code.
Structure of a machine code instruction
| opcode | operand |
ADD value or address
The opcode is a fixed-width binary code that the control unit decodes to know which operation to carry out; the operand field is the rest of the instruction. A crucial point is that the same operand bits can mean completely different things depending on the addressing mode in force, which is exactly why addressing modes exist and why exam questions test the distinction so often.
Immediate and direct addressing
The trade-off mirrors a wider theme in architecture: immediate addressing trades flexibility for speed (the value is baked into the instruction and instantly available), while direct addressing trades a little speed for flexibility (the value lives in memory and can be updated, but must be fetched). Choosing between them is the same kind of decision as choosing a constant versus a variable in a high-level program.
Assembly language and machine code
Because the mapping is essentially one-to-one, a single assembly statement such as LDA 6 corresponds to exactly one machine code instruction with its opcode and operand. This is the practical link between this dot point and the fetch-execute cycle: the instruction the processor fetches and decodes is precisely this opcode-operand pair, and the addressing mode tells the execute stage how to obtain the operand.
Exam-style practice questions
Practice questions written in the style of AQA exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.
AQA 20194 marksMemory location 6 contains the value 20. A processor executes the instruction LDA followed by an operand of 6, first using immediate addressing and then using direct addressing. State the value loaded into the accumulator in each case and explain the difference.Show worked answer →
With immediate addressing the operand is the actual value to be used, so LDA with operand 6 loads the literal 6 into the accumulator. The accumulator holds 6.
With direct addressing the operand is a memory address, so LDA with operand 6 loads the contents of memory location 6, which is 20, into the accumulator. The accumulator holds 20.
The difference is in how the operand is interpreted: immediate treats it as the value itself (no memory access), while direct treats it as the address of the value (one extra memory access to fetch the data).
Markers reward the value 6 for immediate, 20 for direct, and the explanation that the addressing mode changes how the same operand is interpreted.
AQA 20213 marksDescribe the structure of a machine code instruction and explain the relationship between assembly language and machine code.Show worked answer →
A machine code instruction has two parts: an opcode, which specifies the operation to perform (such as load, add or store), and an operand, which holds the data to operate on or information about where that data is, interpreted according to the addressing mode. Some instructions have no operand.
Assembly language uses human-readable mnemonics (such as LDA, ADD, STA) in place of the binary opcodes, with each mnemonic mapping almost one-to-one onto a machine code instruction. An assembler translates the assembly into the binary machine code the processor executes, so assembly is a readable representation of machine code rather than a higher-level language.
Markers reward the opcode-plus-operand structure and the near one-to-one mnemonic-to-machine-code relationship translated by an assembler.
Related dot points
- Understand the components of the processor (ALU, control unit, registers), the fetch-decode-execute cycle, the role of each register, and the factors affecting processor performance.
A focused answer to AQA A-Level Computer Science 4.7.3, covering the components of the processor (ALU, control unit, registers), the fetch-decode-execute cycle, the role of each register, and the factors affecting processor performance.
- Understand the stored program concept, the Von Neumann architecture, the Harvard architecture, and the differences between them.
A focused answer to AQA A-Level Computer Science 4.7.2, covering the stored program concept, the Von Neumann architecture, the Harvard architecture, and the differences between them.
- Understand the classification of programming languages by level (low and high) and by paradigm (imperative, object-oriented, declarative and functional), and the use of machine code and assembly language.
A focused answer to AQA A-Level Computer Science 4.6.4, covering the classification of programming languages by level (low and high) and by paradigm (imperative, object-oriented, declarative and functional), and the use of machine code and assembly language.
- Understand the internal components of a computer, the role of the processor, main memory and buses, and the difference between RAM, ROM and cache memory.
A focused answer to AQA A-Level Computer Science 4.7.1, covering the internal components of a computer, the role of the processor, main memory and the system buses, and the differences between RAM, ROM and cache memory.
- Understand assemblers, compilers and interpreters, the differences between them, the stages of compilation (lexical analysis, syntax analysis, code generation and optimisation), and intermediate code.
A focused answer to AQA A-Level Computer Science 4.6.5, covering assemblers, compilers and interpreters and their differences, the stages of compilation (lexical analysis, syntax analysis, code generation and optimisation), and intermediate code such as bytecode.
Sources & how we know this
- AQA A-level Computer Science (7517) specification — AQA (2015)