Addressing Modes : Types of Addressing Modes

An addressing mode specifies how to calculate the effective memory address of an operand by using information held in registers and or constants contained within a machine instruction or elsewhere. Now lets see how is the address of an operand specified, and how are the bits of an instruction organized to define the operand addresses and operation of that instruction. The most common addressing techniques are:

  • Immediate addressing mode
  • Direct addressing mode
  • Indirect addressing mode
  • Register addressing mode
  • Register Indirect addressing mode
  • Displacement addressing mode
  • Stack addressing mode


But, before discussing various addressing modes, here some notations that will use in throughout of this section. These are:

A     =      Contents of an address field in the instruction
R     =      Contents of an address field in the instruction that refers to a register 
EA  =       Effective Address(Actual address) of location containing the referenced operand.
(X)  =      Contents of memory location x or register X.

Types of Addressing Modes are : 


Immediate addressing mode : 

It is the easiest addressing mode, in which the operand is specified in the instruction itself. In other words, an immediate addressing mode instruction has an operand field rather than an address field, which contain actual operand to be used in conjunction with the operand specified in the instruction. 

        OPERAND   =   A

That is, in this mode, the format of instruction is:


This technique can be used to define and use constants or for assigning the initial values of variables. For example, the instructions :

        ADD 04    ; Add 04 to the content of accumulator


Direct Addressing mode : 

Direct Addressing Mode is also known as “Absolute Addressing Mode”. In this mode the address of data(operand) is specified in the instruction itself. That is, in this type of mode, the operand resides in memory and its address is given directly by the address field of the instruction. Means, in other words, in this mode, the address field contain the Effective Address of operand.

        EA = A

It requires only one memory reference and no special calculation. And also note that the Instruction Format of Direct addressing mode consists of 3-bit opcode, 12-bit address and a mode bit. The mode bit is zero for Direct Address and 1 for Indirect Address.


At above we can see that in it memory Address = Operand. The direct addressing was common in earlier years and is still found its use on a number of small computer systems. it needs only one memory reference and no special calculation. With the limitation that it gives us only a limited address space. For example, the instruction :

         ADD A    ; ADD contents of cell A to accumulator

Its look like as shown below :



Indirect Addressing mode :

In this mode, the address field of instruction gives the memory address where on, the operand is stored in memory. That is, in this mode, the address field of the instruction gives the address where the “Effective Address” is stored in memory. 

        EA = (A)

Means, here, Control fetches the instruction from memory and then uses its address part to access memory again to read Effective Address. The Instruction Format of Direct addressing mode consists of 3-bit opcode, 12-bit address and a mode bit. The mode bit is one for Indirect Address and zero for Direct Address.


For example, the instruction :

         ADD (A)    ; Adds the content of cell pointed to contents of A to Accumulator

Its look like as shown below :


Register Addressing mode :

In Register Addressing Mode, the operands are in registers that reside within the CPU. That is, in this mode, instruction specifies a register in CPU, which contain the operand. It is like Direct Addressing Mode, the only difference is that the address field refers to a register instead of memory location.

        EA = R

For example, the below instructions :

MOV AX, CX ; Move content of register CX to AX
ADD AX, BX ; Add content of register BX to AX

Its look like as shown below :



Register Indirect Addressing mode :

In Register Indirect Addressing Mode, the instruction specifies a register in CPU whose contents give the operand in memory. In other words, the selected register contain the address of operand rather than the operand itself.That is

        EA = (R)

Register indirect addressing uses one less memory reference than indirect addressing. Because, the first information is available in a register which is nothing but a memory address. From that memory location, we use to get the data or information. In general, register access is much more faster than the memory access. Its look like as shown below :


For example, the instruction :

        MOV AX, [BX]    ; move the contents of memory location, addressed by the register BX to the                                             ; register AX


Displacement Addressing Mode :

Displacement Addressing Mode is a powerful addressing mode as it is a combination of direct addressing and register indirect addressing mode.

        EA = A + (R)

Displacement addressing requires that the instruction have two address fields, at least one of which is explicit. The value contained in one address field (value = A) is used directly. The other address field, or an implicit reference based on opcode, refers to a register whose contents are added to A to produce the effective address. The general format of Displacement Addressing is shown in the below Figure


The Displacement Addressing Modes are of three types, which are:

1. Relative Addressing Mode
2. Base Register Addressing Mode
3. Indexing Addressing Mode


1. Relative Addressing Mode : In Relative Addressing Mode , the contents of program counter is added to the address part of instruction to obtain the Effective Address. That is, in Relative Addressing Mode, the address field of the instruction is added to implicitly reference register Program Counter to obtain effective address.

        EA = A + PC

It look like below figure :


2. Base Register Addressing Mode :  In this mode, the content of the Base Register is added to the direct address part of the instruction to obtain the effective address. Means, in it the register indirect address field point to the Base Register and to obtain EA, it is added to direct address part of the instruction.

        EA = A + BR

It look like below figure :


3. Indexing Addressing Mode :  In indexed addressing mode, the content of Index Register is added to direct address part of instruction to obtain the effective address. Means, in it, the register indirect addressing field of instruction point to Index Register, which is a special CPU register  that contain an Indexed value, and direct addressing field contain base address.

        EA = A + IR (Index register)

It look like below figure :



Stack Addressing Mode : 

A stack is a linear array of address.  It is also known as a push-down list or last-in-first-out queue. The stack is previously saved block of addresses. Items are always added to the top of the stack so that, at any given time, the block is filled in parts. The stack posses a pointer whose value is the address of the top of the stack. The top two elements of the stack may be in CPU registers, in which case the stack pointer points to the third element of the stack. The stack pointer is carried in a register. So, references to stack locations in memory are actually a register indirect addresses. The stack mode of addressing is a form of implied addressing. The machine instructions need not include a memory reference but implicitly operate on the top of the stack.


Next Topic :

No comments:

Post a Comment