teach-ict.com logo

THE education site for computer science and ICT

3. Assembly language (low level language)

Machine code is made up of a set of binary instructions like this

                                Line 1:  10101010    (99 in Hex)
                                Line 2:  01011100    (5C in Hex)
                                Line 3:  00111010    (3A in Hex)

Each line is a single instruction acting on some data. We have shown them as binary and hex numbers above.

Assembly language is made up of a predetermined set of commands that can be read by a human (such as ADD). Each command translates directly into a machine code number. So these commands are basically mnemonics used by humans to more easily remember, read, and write instructions for the computer.

Assembly language is called a low level language because it is almost the same as machine code. It has a low level of abstraction i.e. there is a direct link between an instruction in assembly and the machine code which it represents.

The complete set of commands available is called the instruction set of the CPU. And each type of CPU has its own instruction set.

The instructions within an assembly language are called 'mnemonics' as they are much easier to remember than a binary number.

Assembly language consists of a set of mnemonic instructions, each of which has a machine code equivalent.

The table below shows the machine code and the equivalent mnemonic in assembly language. You won't need to know these - it is just to give an example of what they might look like.

2403 ADD AL,3
4000 INC AX
2C02 SUB AL,2

Programming in assembly

Programming in assembly language is still quite difficult as the programmer needs to know a lot about the hardware details inside the CPU. Another issue is that the code only works on a specific CPU family. If you use a different CPU, you need to rewrite the code using a different version of assembly language.

The main advantage of assembly language is that programs in Assembly run fast compared to programs written in a high level language, because there is less code overall.

An example of a program that is typically written in assembly is a device driver, used to directly control hardware such as a graphics card. Drivers need to be as fast and efficient as possible and so assembly language is often used to create it.

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: What is a low-level language?