- Digital computers are versatile because they can be fed different
instructions to make them do different things
- These instructions are run by the processor and are the most
primitive instructions that a computer can run
- Each instruction performs a very specific task, typically either an
operation on a unit of data (in a register or in memory) or a jump
operation (deciding which instruction executes next)
- Machine code is often hardware-dependent
- It is possible to write programs in machine code, but because of
the tedious difficulty in managing CPU resources, it is rarely
done
- The instruction is broken down into:
- Op-Code
- The op-code or operation code is the operation to carry out
- Operand
- The operand is the data required by the instruction
- Not every instruction uses an operand
- To halt the program, we don’t need to specify any data
- Can be further broken down into two parts:
- The actual data
- The addressing mode
- Tells the processor how to use the operand
- E.g. we might want to add a number stored in a
different memory location
- To do this, the op-code ADD is used with an
operand specifying the memory address
- Equally the operand could just contain the
value to add
- Instruction sets
- The instruction set is the set of instructions on which the
processor has been built to carry out
- Each instruction is unique and a pre-built set of
transistors is organised to carry out the instruction
- Every single thing that the computer can do is formed of these
instructions
- When the processor is designed, the manufacturer, allocates
which instruction bits are allocated to the op-code and which to
the operand
- They have to be standardised or programs written for one
processor will break on another
- E.g. if we had a processor capable of addressing and
processing 32-bit instructions
- We could allocate 8-bits for the op-code
- The remaining 24-bits could be used for the operand