GCSE · Computer Science · AQA · Spec 8525

Assembler

Your processor can't read LDA or ADD, only binary. So how does a program written in words ever run? Meet the simplest translator, and keep count.

Computer Science · Translators

Watch an assembler work

Here's the deal. A processor can only run machine code: instructions written in binary. Assembly language is the same kind of instructions written as short readable names called mnemonics, like LDA and ADD. The assembler is the translator that swaps one for the other.

Before you press Next: this program has 4 assembly lines. How many machine code instructions will the assembler hand to the processor? Commit to a number.

1 LDA 6
2 ADD 7
3 STO 8
4 HLT

Variables

assembly lines read=1machine instructions written=1

Output

0001 0110

Step 1: LDA 6 means 'load the value at address 6'. LDA is the mnemonic; 6 is the operand, the address it works on. The assembler swaps this one line for one instruction: 0001 is the code for LDA on this made-up processor, and 0110 is 6 in binary.

1 / 4

Press Next. The chips count lines read and instructions written, and the Output box is the machine code program growing, one instruction per line.

Step 1 of 4: LDA 6 means 'load the value at address 6'. LDA is the mnemonic; 6 is the operand, the address it works on. The assembler swaps this one line for one instruction: 0001 is the code for LDA on this made-up processor, and 0110 is 6 in binary..

Watch out: These binary codes belong to a made-up processor, so they're just for illustration. A real processor has its own codes. What carries over is the count: one assembly line, one machine code instruction.

Predict, then check

You've just watched an assembler handle one line at a time. Now put two very different lines through translation.

ADD 7 is one line of assembly language. total = a + b is one statement of high-level code. Both get translated into machine code. How many machine code instructions does each one become?

Assembly and the processor

?

Reason it through

Why will a program written in assembly language generally only run on one type of processor?

Link 1 of 4

First link · your turn

Every assembly instruction stands for one machine code instruction. Whose machine code instructions, though?

2
Locked — reveal the link above first
3
Locked — reveal the link above first
4
Locked — reveal the link above first

Computer Science · Translators

Which idea is closest to yours?

A student has written LDA 6, ADD 7, STO 8, HLT in assembly language and is about to run it on the processor.

Be honest: which of these is closest to what you think happens?
How sure are you?

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

The simplest translator of all, and why high-level code needs a different one.

What you need to know

  • A processor can only run machine code: binary instructions it executes directly.
  • Code in any other language has to be translated into machine code before the processor can run it.
  • Assembly language is low-level: each instruction is a short mnemonic, like LDA, ADD or STO, plus an operand.
  • Mnemonics are much easier for a person to read and write than rows of binary.
  • Have a goYour friend insists: 'LDA 6 is basically binary already, so the processor can just run it.' Put them right in one line.

    LDA is letters, not binary, so it has to be translated into machine code first.

    A mnemonic is a readable name that makes life easier for people; the processor only runs binary instructions, so looking close to machine code isn't the same as being it.

  • An assembler is the translator that turns an assembly language program into equivalent machine code.
  • Each assembly instruction becomes exactly one machine code instruction, so lines in equals instructions out.
  • Have a goAsha's assembly program has 7 instructions. She reckons the assembler will hand the processor 7 machine code instructions. Right or wrong?

    Right: 7 in, 7 out.

    An assembler swaps each instruction for exactly one machine code instruction; it never merges lines together or expands one line into several.

  • One high-level statement usually becomes several machine code instructions, so high-level code needs a compiler or interpreter instead.
  • Assembly is written for one processor's instruction set, so its machine code generally only runs on that type of processor.
  • Have a goA program is assembled for one type of processor. Predict: will the same machine code generally run on a processor of a different type?

    Generally not.

    The machine code is made from the first processor's instruction set; the other type has a different one. It's not about mnemonics, which the processor never sees.

  • Assembler, compiler and interpreter are the three kinds of translator; only the assembler works on assembly code.

The big picture

An assembler translates assembly language into machine code, swapping each assembly instruction for exactly one machine code instruction for one type of processor. Compilers and interpreters translate high-level code instead, where one statement becomes several machine code instructions.

Key points

1The processor runs only machine code, instructions written in binary.
2Assembly language uses mnemonics, readable names for machine code instructions, which people find far easier to work with than binary.
3An assembler swaps each assembly instruction for exactly one machine code instruction, so lines in equals instructions out.
4A compiler or interpreter turns one high-level statement into several machine code instructions, which is why high-level code needs one of them and not an assembler.
5Assembly language is written for one type of processor's instruction set, so assembled code generally only runs on that type of processor.

Worked example

Problem

A made-up processor uses these 4-bit codes: LDA = 0001, STO = 0011, HLT = 1111. An address is written as 4-bit binary, and HLT has no address so its address half is 0000. Assemble this program, then say how many lines go in and how many machine code instructions come out. LDA 5 STO 9 HLT

⚠ Watch out

Treating assembly language as machine code, or the assembler as just another compiler. Tempting, as assembly looks so close. But assembly is the readable form; machine code is the binary the processor runs. An assembler swaps one line for one instruction; a compiler or interpreter turns one high-level statement into several.

🧠

Memory hook

ONE in, ONE out. An assembler is like a phrasebook that swaps each word for exactly one word. (The picture breaks at one point: an assembler swaps into binary, for one type of processor.)

✓

Check yourself

No peeking: what goes into an assembler, what comes out, and why won't it generally run on another type of processor? (Assembly in, machine code out; different instruction set.)

Flashcards

(11)
What is the only kind of code a processor can run?
Machine code, which is instructions written in binary.
What is a mnemonic?
A short, readable name for a machine code instruction, such as LDA, ADD or STO.
What is assembly language?
A low-level language written with mnemonics and operands, a readable form of machine code. It has to be translated before the processor can run it.
What does an assembler do?
It translates assembly language into machine code.
How many machine code instructions does one assembly instruction become?
One. Lines in always equals instructions out.
What does a compiler or interpreter do with one high-level statement?
It turns it into several machine code instructions.
Name the three kinds of translator.
The assembler, the compiler and the interpreter.
Which translator takes assembly language as its input?
The assembler. Compilers and interpreters take high-level code.
In LDA 6, which part is the operand?
The 6, which is the address the instruction works on. LDA is the mnemonic.
What is an instruction set?
The set of machine code instructions that a particular type of processor can run.
Why does assembly generally run on only one type of processor?
It is written for that type's instruction set, and a different type of processor has a different instruction set.

Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.

Learning with Lightbulb is opening soon

You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.

Keep me posted

More AQA GCSE Computer Science topics

See the full AQA Computer Science curriculum →

How this lesson was checked. This AQA GCSE Computer Science (specification 8525)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 29 October 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.