Addressing Mode
What is Addressing Mode?
In any microprocessor instruction, the source and the destination can be a register, memory content or an 8 bit number. In fact, these source and destination are operands. The various forms of specifying the operands are called the addressing mode.
Four types of addressing modes are explained in this article.
1. Immediate Addressing
2. Register Addressing
3. Direct Addressing
4. Indirect Addressing
1. Immediate Addressing
In immediate addressing mode, the operand is readily available with the instruction.
For example, in the following instruction,
MVI A, 05
The data, 05 is moving to accumulator.
2. Register Addressing
In this mode, operand is in any one of the general purpose register. So, the name of the register is given as operand. For example, in the following instruction,
MOV A, B
The data contained in the register, B is moving to accumulator, A.
3. Direct Addressing
In this mode, the operand is available in the memory. So, the address of the memory location should be given as operand. Normally, these types of instructions will have 3 bytes.
Consider the following instruction,
LDA 2050
It load the content of the memory location, 2050 to accumulator. Note that here the operand is indicated by its address.
4. Indirect Addressing
In this mode, the operand is available in memory but its address is indicated by any one of the register pair. Normally, the address is indicated by the HL (two parts of memory address) pair of memory. The name of the register pair is given as operand. Hence it is indirect.
MOV A, M
In the above instruction, M refers to HL pair. It moves the content of the memory location indicated by HL pair to accumulator.
The following instruction,
LDAX B
move the content of the memory location indicated by the register pair, BC.