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 theinstruction itself. Example of direct addressing is :
STA 2500H: store the contents of accumulator in the memorylocation 2500H.
(ii) Register Addressing: In register addressing, the operands are located inthe 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 :
MOV A, B: Transfer the contents of register B to register A.
(iii) Register Indirect Addressing: In this, the address of the operand is givendirectly. 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.
MOV A, M: Move the contents of the memory location whose address isin H-L pair to the accumulator.
(iv) Immediate addressing: In this the operand in given in the instructionitself. E.g.
MVI A, 06: Move 06 to accumulator.
(v) Relation Addressing: In this a signed displacement is added to the currentvalue of the program counter to form the effective address. This is also known as PC relative addressing.
Addressing mode gives programming versatility to the user by providing facilities like pointers to memory, counter for loop control, indexing of data and program relocation. It reduces the number of bits in the addressing field of the instruction.