teach-ict.com logo

THE education site for computer science and ICT

2. Machine code anatomy

Instructions are always given to the CPU in machine code.

Let us look at the arrangement of a typical machine code instruction :


The machine code is divided into two parts - the operation code (or opcode) and the operand.


The opcode contains two items, first is the CPU instruction.

And the second part (orange above) includes the address mode. This tells the CPU what kind of memory addressing it should use for this instruction. For example the 01 code might mean 'index mode'. Another code such as 11 might mean 'relative addressing' - each CPU family has a different set of codes for its addressing modes.


The operand may be the actual data to be used, or it may be an address. Which one it is depends on which memory mode is being used. In modes where it contains an address, the operand is often called the address field.

On modern CPUs, some machine code instructions include more than one operand.


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

Click on this link: CPU Machine code formats