Types of Addressing Mode

We already know Why we need Addressing mode

Types of Addressing mode:-

1. Implied Mode:-

It is also called an Implicit mode. Here the address is given in the instruction Itself. ex. INCA. it means to increment the content of A. A is an accumulator.

 

2. Immediate mode:

  • The direct value of the operand is given directly with the instruction. ex.    Add 10. here there is no need for further calculation.
  • This mode deals with constant. 

3. Register Direct Mode:-

 Here we put the operand in a special box and in the instruction we give that box number. That special box is called a register.Ex.

 Add R1, it means Add the content of Accumulator with the content present in box R1 and store the end value in the accumulator. 

 AC <-- AC + (R1)

 

4.Register Indirect Mode:-

We put the operand in a safe house and keep the address of that safe house in our special box and In instruction, we give that special box serial number.

Here safe house means some memory address and the special box is our register. Ex:

    Add R1, it means

   AC <-- AC + M [(R1)]

from R1 we take the address of memory address and then we go to that memory and fetch the operand.

 

5. Direct Mode:

  • This is also called as Absolute mode.
  • It is used with variables.

We put our operand in a safe house and In instruction, we directly give that safe house address. Ex.

Add X, it means

AC <-- AC + M[X]

You go to memory location X and fetch the opcode and add it with the content present in the accumulator and store the end result back to the accumulator.

 

6. Indirect Mode:

  • It is used to implement pointer.
  • Use to implement parameter passing.

Story: Queen's diamond has been stolen and James bond has been assigned a task to search the diamond. James Bond has been provided an address AD52 by Felix Leiter.

When James bond reaches to AD52 he got an envelope that contains some address E96. When he reached E96 finally he got queen's diamond.

This is the concept of Indirect Addressing Mode.

Here Address of effective address is given with instructions.

Example: Add X it means 

     A <-- A + M [ M[X] ]

 

7. Relative addressing mode:

Use to implement branch instruction.

Uses a program counter for implementation. 

Example:  A relative address might be A+15, A is the base address and 15 the distance (called the offset).

let's assume the current address is 400 and you have to go to a branch of  -20 so what is destination address?

Solution :

 The time at which address 400 is being executed, the program counter will contain 401  

So -20 displacement is =  401 + (-20) =381

 

8.Indexed Addressing Mode:-

  • It is useful when we are trying to access an element in the array.
  • You are provided the base address and you have to calculate the designated address.

 

Contributor's Info

Created:
0Comment
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:

  1. 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
  2. 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.
  3.  Immediate addressing mode : operand is part of instruction.
    Example : ADD #12 // adds 12 to the contents of accumulator.
    Fastest mode.
    No memory access is required.
  4. 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.
  5. 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]]
  6. 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.
  7. 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.
  8. Base register addessing mode : EA = A + BR // BR is base register and A is address.
    Mostly used in segmentation.

Contributor's Info

Created: Edited:
0Comment