Each instruction needs data on which it has to perform the specified operation. The data may be in the accumulator, GPR (general purpose registers) or in some specified memory location. The techniques of specifying the address of the data are known as addressing modes.
The important addressing modes are as follows:
(i) Direct Addressing
(ii) Register Addressing
(iii) Register Indirect Addressing
(iv) Immediate Addressing
(v) Relation Addressing
(i) Direct Addressing : In this, the address of the data is specified within the instruction itself. Example of direct addressing is:
(a) STA 2500H : store the contents of accumulator in the memory location 2500H.
(ii) Register Addressing: In register addressing, the operands are located in the general purpose registers. In other words the contents of the register are the operands. Therefore only this name of the register is to be specified in the instruction. E.g. of register addressing are:
(a) MOV A, B : Transfer the contents of register B to register A.
(iii) Register Indirect Addressing : In this, the address of the operand is given directly. The contents of a register or a registers pairs are the address of the operand. Example : LX1 H, 2400H--> load H-L pair with 2400 H.
(a) MOV A, M : Move the contents of the memory location whose address is in H-L pair to the accumulator.
(iv) Immediate addressing : In this the operand in given in the instruction itself. E.g.
(a) MVI A, 06 : Move 06 to accumulator.
(v) Relation Addressing : In this a signed displacement is added to the current value of the program counter to form the effective address. This is also known as PC relative addressing.