Machine code is a system of instructions that can be executed directly by the processor in your computer. Each type of processor has it’s own machine code, so Z80 machine code will not run directly on an Intel x86 processor.

It’s a bit like The Matrix; it’s all 1’s and 0’s and generally does not make much sense to normal mortals. Assembly language is a more readable rendition of machine code which uses mnemonic codes to represent machine code instructions.

Binary Design

Your average Z80 processor will know what to do with this:

00000110 0000001 11001001

Does it make any sense to you. Of course not. But in assembly language it looks a little clearer:

LD B,1        (00000110 00000001)
RET           (11001001)

The utility for turning assembly language text into machine code binary is called an assembler.

“Why assembly language?”, I hear you cry. “Isn’t BASIC sufficient?”

BASIC’s strength is that is it is very easy to learn. It’s weakness is that the computer has to interpret every line of code; this is very slow. Imagine reading Harry Potter to your neighbours children, who are Welsh. Problem is you don’t speak Welsh, so you have to look up each word and translate it with an English to Welsh dictionary. You get my drift, I hope.

Assembly language’s strength is that there is no translation, so the programs can run much faster. It’s weakness is that assembly language listings can be intimidating, harder to read and more difficult to debug for the novice programmer.

Assembly language used to be the only way to develop games on home computers; a situation where programmers had to squeeze every ounce of power out of a slow processor.

There are still circumstances where assembly language could be a benefit, such as writing software on embedded systems.

I’ve started assembling some useful resources (excuse the pun).