teach-ict.com logo

THE education site for computer science and ICT

2. Instruction sets and assembly language

In order to understand how registers relate to one another we need to first understand a little bit about instruction sets and assembly language

Instruction Set

An instruction set is a collection of instructions that the CPU uses to carry out its tasks. For example, an instruction might look like: 'Add ACC, 3'. This instruction tells the CPU to add 3 to the accumulator.

Each make of CPU will have its own unque instruction set which will contain hundreds of complex instructions.

A single CPU instruction consists of a binary number, this is called machine code. The machine code is denoted in Hexadecimal format, for example Hex '04D3'

 

Assembly Language

Programming in machine code is very difficult because it just looks like a set of numbers making it hard for a human to read and understand.

To make things easier for programmers, the chip makers provide an 'Assembly Language' for their CPU which means that programming code can be written in a readable form. For example:

Machine Code Assembly Language
04D3 ADD #3

The command ADD #3 tells the CPU to add 3 to the current value in the accumulator. This is clearly easier to understand compared to '04D3'.

The programmer writes their code in assembly language and this file is then applied through a linker and translator to create the machine code which is loaded into the CPU.

Each command in assembly language is called a 'mnemonic'.

Challenge see if you can find out one extra fact on this topic that we haven't already told you Click on this link: Machine code assembly language