Skip to main content
WalesComputer ScienceSyllabus dot point

How does low-level assembly language work, and how do addressing modes let instructions reach their operands?

Describe low-level programming: machine code and assembly language, the instruction set, and addressing modes.

A focused answer to WJEC A-Level Computer Science Unit 4 low-level programming, covering machine code and assembly language, the instruction set, the structure of an instruction, and addressing modes such as immediate and direct.

Generated by Claude Opus 4.812 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. The answer
  3. Examples in context
  4. Try this

What this dot point is asking

WJEC wants you to describe low-level programming: machine code and assembly language, the processor's instruction set, the structure of an instruction (opcode and operand), and the common addressing modes. This is the low-level strand of Unit 4 and complements the high-level paradigms of Unit 3. Expect questions on the opcode and operand and on addressing modes (especially immediate versus direct), which reward precise, worked answers.

The answer

Machine code and assembly language

Assembly is far easier to read and write than raw binary, yet stays close to the hardware, which is why it is used where direct control of the processor matters.

The structure of an instruction

Knowing this split is the key to reading any low-level instruction: first what to do (opcode), then what to do it to (operand, as interpreted by the addressing mode).

Addressing modes

Addressing modes decide how the operand is interpreted. In immediate addressing the operand is the actual value to use. In direct addressing the operand is the memory address holding the value. In indirect addressing the operand is the address of a location that itself holds the address of the data. In indexed addressing an index register is added to the operand to find the address, which suits stepping through an array.

Working through addressing

Examples in context

Example 1. Why a device driver is written in assembly
A driver controlling specific hardware registers needs exact, predictable control over the processor and timing, which assembly provides instruction by instruction. A high-level language would hide this detail behind the compiler, so for this narrow, hardware-close task assembly's control outweighs its difficulty, illustrating where low-level programming is justified.
Example 2. Indexed addressing stepping through an array
Summing an array, a program loads each element using indexed addressing: the base address plus an index register that increments each pass. This is exactly why indexed addressing exists, and it shows how addressing modes map to common high-level operations like iterating over a collection.
Example 3. The cost of machine specificity
A finely tuned assembly routine for one processor must be rewritten for a different architecture, because the instruction set and registers differ. This is the practical price of assembly's control and the reason most software is written in portable high-level languages and only the most performance-critical parts, if any, in assembly.

Try this

Q1. State the role of the opcode in a machine instruction. [1 mark]

  • Cue. It specifies the operation to be carried out (such as load, add or store).

Q2. In direct addressing, what does the operand contain? [1 mark]

  • Cue. The memory address of the data to be used (not the data itself).

Exam-style practice questions

Practice questions written in the style of WJEC exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

WJEC 20204 marksAn instruction is made up of an opcode and an operand. Explain the role of each, and explain the difference between immediate and direct addressing.
Show worked answer →

State what each part of the instruction does, then contrast the two addressing modes.

The opcode specifies the operation to be carried out (such as load, add or store). The operand is the data the operation acts on, or a reference to where that data is.

In immediate addressing, the operand is the actual value to be used, so the instruction works on the operand directly. In direct addressing, the operand is the memory address of the data, so the processor goes to that address to fetch the value to use.

Markers reward the opcode as the operation and the operand as the data or its reference, and the immediate (operand is the value) versus direct (operand is the address of the value) distinction.

WJEC 20224 marksExplain why a programmer might use assembly language rather than a high-level language, and state one disadvantage of assembly language.
Show worked answer →

Give a genuine reason to choose assembly, then a real disadvantage.

Reasons to use assembly language: it gives direct control over the hardware and the processor's registers, allowing highly optimised, fast and compact code, which matters for device drivers, embedded systems and time-critical routines. Each assembly instruction maps closely to one machine instruction, so the programmer controls exactly what the processor does.

Disadvantage: assembly language is machine-specific (tied to one processor's instruction set), harder and slower to write, and harder to read and maintain than a high-level language, so it is not portable.

Markers reward a valid reason such as hardware control or optimised, compact code, and a valid disadvantage such as being machine-specific or hard to write and maintain.

Related dot points

Sources & how we know this