Typical Instruction Set
The instruction set is the set of machine code instructions built into the computer.
Instructions are needed to:
1 Transfer data within the computer.
2 Do arithmetic.
3 Carry out logical operations.
4 Branch from one instruction to another in the program.
The following examples are written in words. The actual machine code instructions are in binary.
Transfer of data-examples
1 LOAD ACCUMULATOR-transfer a value into the accumulator.
2 COPY A B-copy the contents of register A into register B.
Arithmetic-examples
1 ADD A-add a value to register A.
2 SUB B-subtract a value from register B.
Logical operations-examples
1 SHIFI LEFT-shirt all the bits in the accumulator 1 place to the left.
2 AND A,B-do the logical operation AND between the contents of A and the contents of B .
BRANCH INSTRUCTIONS
These are the instructions used to program the computer to make decisions. Usually the control unit fetches instructions one after another in the order they are stored. However. control can be transferred to another part of the program or to another program. This is done using a branch instruction (also known as a jump instruction).
A branch instruction is an instruction which causes a jump out of the normal sequence of a program.
There are two main types of branch instruction:
1 A conditional branch is an instruction which causes a jump only if some condition is met,
2 An unconditional branch is an instruction which always causes a jump.
Examples of branch instructions
I JUMP IF ZERO-jump if the contents of the accumulator is zero (this is a conditional branch).
2 JUMP TO SUBROUTINE-jump to a given subroutine (this is unconditional).