Addressing modes

Addressing modes are the ways through which operands are specified.  

The address field in a typical instruction formats are relatively small.

This address field is used to reference the operand in the memory.

Different addressing modes are:

  1. Immediate addressing mode
  2. Direct addressing mode
  3. Indirect addresing mode
  4. Register direct addressing mode
  5. Register indirect addressing mode
  6. Displacement addressing mode

1. Immediate addressing mode:

In immediate addressing mode the operand value is present in the instruction.

Operand = A

Advantage of immediate addressing mode: No memory reference other than the instruction fetch is required to obtain the operand.

Disadvantage of immediate addressing mode: Size of the number is restricted to the size of the address field.

2. Direct addressing mode:

In direct addressing mode the address field contains the effective address of the operand.

EA = A

Advantage of direct addressing mode:

It requires only one memory reference and no special calculation.

Disadvantages od direct addressing mode: It provides only a limited address space.

3. Indirect addressing mode:

In indirect addressing mode the address field refer to the address of a word in memory, which contains a full-length address of  the operand.

EA = (A)

Here, the parentheses are to be interpreted as meaning contents of.

Advantage of indirect addressing mode: Address range is not limited by address field.

Disadvantage of indirect memory address: Instruction execution requires two memory references to fetch the operand: one to get its address and a second to get its value.

4. Register direct addressing mode:

Register direct addressing mode is similar to direct addressing mode. The only difference is that the  address field refers to a register rather than a main memory address.

EA = R

Advantages of register direct addressing mode: Only a small address field is needed in the instruction, and no time consuming memory references are required.

Disadvantag f register direct addressing mode: Address space is very limited.

5. Register indirect addressing mode:

Register indirect addressing mode is similar to indirect addressing mode.The only difference is that the  address field refers to a register than a main memory.
EA = (R)

The advantages and disadvantages of register indirect addressing mode are basically the same as for indirect addressing mode.

6. Displacement addressing mode:

Displacement addressing mode combines the capabilities of direct addressing mode and register indirect addressing mode.
EA = A + (R)

Difference betwenn Register Direct Addressing Mode and Register Indirect Addressing Mode:

Register Direct Addressing ModeRegister Indirect Addressing Mode
1.       Operand is placed in register.Operand is placed in Main memory.
2.      Registers are used to store operands.Registers are used to store address of operand in main memory.
3.      Address field contains effective address of operand.Address field contains reference to the effective address of operand.
4.      One register reference for operand.Two register reference for operand.
5.      FastSlow
6.      Easier to access dataComplex
7.      Limitation of address field to store operand address.There is no such limit.

Difference betwenn Direct Addressing Mode and Indirect Addressing Mode:

Direct Addressing ModeIndirect Addressing Mode
1.       Address field contains effective address of operand.Address field contains memory location where effective address is present
2.      One memory reference to access operandTwo memory reference to access operand
3.      FastSlow
4.      Address size of operand is limited to size of address field.No such limitation. Because operand address is stored in main memory.
5.      Less calculation to access operandMore calculation to access operand.

Difference betwenn Immediate Addressing Mode and Direct Addressing Mode:

Immediate Addressing ModeDirect Addressing Mode
1.       Address field contains operandAddress field contains effective address of operand
2.      Operand is in address fieldOperand is present in main memory
3.      No memory referenceOne memory reference
4.      FastSlow
  5.   Operand size depends on size of address fieldNo limitation on operand size

Difference between Immediate Addressing Mode and Indirect Addressing Mode:

Immediate Addressing ModeIndirect Addressing Mode
1.       Address field contains operandAddress field contains memory reference of operand
2.      There is no memory referenceThere is two memory reference
3.      Operand size depends on size of address field in instructionThere is no such limit on operand size
4.      FastSlow
5.      Operand present in address fieldOperand is present in main memory

Q1. There is more than one addressing mode, than how processor determine which addressing mode to use?

Ans.  By using mode field. One or more bits in the instruction format can be used as a mode field. The value of the mode field determines which addressing mode is to be used.

Q2. What is effective address ?

Ans. In a system without virtual memory, the effective address will be either a main memory address or a register. In a virtual memory system, the effective address is a virtual address or a register.