Machine Instructions
1. Data Transfer Instructions :
Data transfer instructions are used to transfer of data from one address to another without changing the contents.
Data Transfer Instructions
Eight Addressing Modes for the Load Instruction
Mode Assembly Convention Register Transfer
Mode |
Assembly Convention |
Register Transfer |
Direct address |
LD ADR |
AC ← M[ADR] |
Indirect address |
LD @ADR |
AC ← M[M[ADR]J |
Relative address |
LD $ADR |
AC ← M[PC + ADR] |
Immediate operand |
LD #NBR |
AC ← NBR |
Index addressing |
LD ADR(X) |
AC ← M[ADR + XR] |
Register |
LD R1 |
AC ← R1 |
Register indirect |
LD (R1) |
AC ← M[R1] |
Autoincrement |
LD (R1) |
+ AC ← M[R1], R1 ← R1 + 1 |
Abbreviations used has meaning as follows : ADR=address, NBR=number/operand, X=index register, AC=Accumulator, R1=General purpose register, @=indirect addressing mode, $=relative address to the PC,
Data Manipulation Instructions
Data manipulation instructions perform various operations on data and provide the computational capabilities for the computer. We can further classify the Data Manipulation Instructions in following 3 types :
I. Arithmetic Instructions:
It includes addition, subtraction, multiplication, and division. Following table shows various arithmetic instructions in a typical computer:
Typical Arithmetic Instructions
Name |
Mnemonic |
Increment |
INC |
Decrement |
DEC |
Add |
ADD |
Subtract |
SUB |
Multiply |
MUL |
Divide |
DIV |
Add with carry |
ADDC |
Subtract with borrow |
SUBB |
Negate (2’s complement) |
NEG |
II. Logical and Bit Manipulation Instructions:
Logical instructions include bitwise AND, bitwise OR etc. Logical and bit manipulation instructions in a typical computer are as follows :
Typical Logical and Bit Manipulation Instructions
Name |
Mnemonic |
Clear |
CLR |
Complement |
COM |
AND |
AND |
OR |
OR |
Exclussive-OR |
XOR |
Clear carry |
CLRC |
Set carry |
SETC |
Complement carry |
COMC |
Enable interrupt |
EI |
Disable interrupt |
DI |
III. Shift Instructions:
These instructions are used to move the bits of a Memory Word or register in a particular directions. Shift instructions have many variants like : logical shifts, arithmetic shifts, or circular shifts. In either case the shift may be to the right or to the left. Various shift instructions in a typical computer are as follows :
Typical Shift Instructions
Name |
Mnemonic |
Logical shift right |
SHR |
Logical shift left |
SHL |
Arithmetic shift right |
SHRA |
Arithmetic shift left |
SHLA |
Rotate right |
ROL |
Rotate left |
RORC |
Rotate right through carry |
ROLC |
Rotate left through carry |
ROLC |
- Logical Shifts :
These instructions insert 0 at the last bit position and shift all the bits of the memory word in specified direction by one bit position. - Arithmetic shifts :
These instructions are meant for signed-2’s complement numbers. These instructions preserve the sign bit in the leftmost position. - Circular Shifts :
These instructions treat the bit sequence as a circular list. It means that the rightmost bit position is treated adjacent to the leftmost bit.