![]() |
The different instruction types give the machine architecture more power. The following subsections explain |
| the different possible instruction categories (Mostafa Abd-El-Barr, Hesham El-Rewini, (2004)). | |
![]() |
These instructions move the data among CPU registers and main memory. Table 3.1 shows the common data |
| transfer instructions. |
| Data movement instructions | Meaning |
| MOVE | Move data from a given source (a register or a memory) to a given destination |
| LOAD | Load data from memory to a register |
| STORE | Store data into memory from a register |
| PUSH | Store data from a register to stack |
| POP | Retrieve data from stack into a register |
![]() |
Arithmetic and logical instructions perform arithmetic and logical operation on data in registers or main |
| memory. | |
![]() |
Table 3.2 lists the arithmetic and Table 3.3 lists the logical instructions. |
| Arithmetic instructions | Meaning |
| ADD | Perform the arithmetic sum of two operands |
| SUBTRACT | Perform the arithmetic difference of two operands |
| MULTIPLY | Perform the product of two operands |
| DIVIDE | Perform the division of two operands |
| INCREMENT | Add one to the contents of a register |
| DECREMENT | Subtract one from the contents of a register |
| Logic instructions | Meaning |
| AND | Perform the logic AND of two operands |
| OR | Perform the logic OR of two operands |
| XOR | Perform the logic XOR of two operands |
| NOT | Perform the complement of an operand |
| COMPARE | Perform logical comparison of two operands and set flag accordingly |
| SHIFT | Perform logical shift (right or left) of the content of a register |
| ROTATE | Perform logical shift (right or left) with wraparound of the content of a register |
![]() |
Control (sequencing) instructions are used to change the instructions execution sequence by changing the |
| program counter register contents. | |
![]() |
This type of instructions has the following categories: unconditional jump, conditional jump and call subroutine. |
![]() |
The unconditional jump changes the execution sequence to a new address which holds the next instruction |
| to be executed. | |
![]() |
The unconditional jump changes the PC contents to this new address. |
![]() |
The conditional jump will perform the jump based on the condition of the flag bits. |
| Table 3.4 has some flag examples. | |
![]() |
The flags may change based on the result of the execution of every instruction. |
| Flag name | Meaning |
| Negative(N) | Set to 1 if the result of the most recent operation is negative, it is 0 otherwise |
| Zero(Z) | Set to 1 if the result of the most recent operation is 0, it is 0 otherwise |
| Overflow(V) | Set to 1 if the result of the most recent operation causes an overflow, it is 0 otherwise |
| Carry(C) | Set to 1 if the most recent operation results in a carry, it is 0 otherwise |
![]() |
The third type is calling a subroutine which causes the execution sequence to jump to the first instruction of |
| this subroutine. | |
![]() |
Input/output instructions are used to perform data transfer from/to peripheral devices. |
![]() |
The INPUT instruction is used to transfer data from the input device to the processor. |
![]() |
The OUTPUT instruction is used to transfer data from the processor to the output device. |