(This is the older material - click here - for current specification content)

2. Machine Code and Assembler

Every CPU has to have its processing instructions in machine code (an alternative term for machine code is 'object code).

Four separate machine code instructions look like this:

Machine Code

B80200

BB0400

01D8

CD20

These instructions happen to be shown in hexadecimal notation. (hexadecimal is a very popular way of writing down a number in the computing world), but each of these instructions is actually a string of binary 1's and 0's.

Machine code is loaded into the Instruction Register of the CPU before being executed (see the 'Fetch-Decode-Execute mini-web for more details).

The chip designers know that writing in raw machine code is too difficult, so they provide a more people-friendly 'Mnemonic code' for each machine instruction. Instead of the programmer having to remember that 'B8' will load register AX, they can write the command MOV AX,0002 (which happens to load '2' into the AX register).

This collection of mnemonic codes together form an 'assembly language'.

Machine Code
Raw Machine code Mnemonic Code

B80200

BB0400

01D8

CD20

MOV AX,0002

MOV BX,0004

ADD AX, BX

INT 20

 

Each CPU has a different assembly language that comes with it. Yet another reason for not wanting to write in assembly language. Imagine how hard it is to learn the assembly language of every CPU family!

For example, the assembly language for the Intel Core 2 Duo is entirely different to the assembly language of the AMD Athlon 64.

So more people-friendly computer languages were developed that made writing software much easier. These languages are called 'high level' languages and there are many of them.

But a statement written in any high level language still has to end up as machine code.

This is the role of the 'compiler'.

 

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

Click on this link: Assembly Language

 

 

 

 

Copyright © www.teach-ict.com