Different types of Addressing Modes | Direct addressing | Indirect addressing | Immediate addressing mode | Register Direct addressing mode | Register Indirect addressing mode | Index addressing mode
Addressing mode in simple words, is a way to access operand(data) from memory and CPU registers.
Different types of Addressing Modes are:
- Direct addressing : Here, address field contains address of operand.
Single memory access is required .
Limited address space.
No extra calculations are required to mainpulate effective address.
Example : ADD B
- Indirect addressing : Use of pointer is required, which points to the address of the operand.
Larger address space.
Example : ADD (B) // adds contents of cell pointed to by contents of B to accumulator.
It may be nested , multilevel.
Example : ((B))
slower way of accessing operand as compared to direct addressing mode as multiple memory accesses are required.
Example: ADD @210 // adds contents of memory location 210 to accumulator.
- Immediate addressing mode : operand is part of instruction.
Example : ADD #12 // adds 12 to the contents of accumulator.
No memory access is required.
- Register Direct addressing mode : operand is present in register mentioned in addressing field.
no memory access required.
fastest way of execution.
very limited address space.
Example : ADD R1 // adds contents of Register R1 to the contents of accumulator.
- Register Indirect addressing mode : Here, address is present in register.
operand is in memory cell pointed to by contents of register.
larger address space.
one fewer memory access than indirect addressing mode.
Example : ADD @R1
can be written as, ACC <- [ACC] + [[R1]]
- Index addressing mode : effective address is obtained by adding an index value to the address given in the instruction.
Used for accessing arrays.
EA = A + I // here, I is index and A is address.
- Relative addressing mode : EA is obtained by adding contents of program counter to the constant value specified in the instruction given.
It is also known as Displacement addressing mode.
- Base register addessing mode : EA = A + BR // BR is base register and A is address.
Mostly used in segmentation.