• Specifies a rule for interpreting or modifying the address field of the instruction before the operand is actually
  • Computers use addressing mode techniques for the purpose of accommodating the following purposes:-
  • To give programming versatility to the user by providing such facilities as pointers to memory, counters for loop control, indexing of data and various other
  • To reduce the number of bits in the addressing field of the
    • Other computers use a single binary for operation & Address
    • The mode field is used to locate the
    • Address field may designate a memory address or a processor register.
    • There are 2 modes that need no address field at all (Implied & immediate modes).

Effective address (EA):


  • The effective address is defined to be the memory address obtained from the computation dictated by the given addressing
  • The effective address is the address of the operand in a computational-type instruction.

The most well known addressing mode are:

  • Implied Addressing
  • Immediate Addressing Mode
  • Register Addressing Mode
  • Register Indirect Addressing Mode
  • Auto-increment or Auto-decrement Addressing Mode
  • Direct Addressing Mode
  • Indirect Addressing Mode
  • Displacement Address Addressing Mode
  • Relative Addressing Mode
  • Index Addressing Mode
  • Stack Addressing Mode

Implied Addressing Mode:

  • In this mode the operands are specified implicitly in the definition of the instruction.

For example:- CMA - “complement accumulator” is an implied-mode instruction because the operand in the accumulator register is implied in the definition of the instruction. In fact, all register reference instructions that use an accumulator are implied-mode instructions.

Instruction

Advantage: no memory reference.    Disadvantage: limited operand

Immediate Addressing mode:


  • In this mode the operand is specified in the instruction In other words, an immediate-mode instruction has an operand field rather than an address field.
  • This instruction has an operand field rather than an address field. The operand field contains the actual operand to be used in conjunction with the operation specified in the
  • These instructions are useful for initializing register to a constant value; For example MVI B, 50H

Instruction

It was mentioned previously that the address field of an instruction may specify either a memory word or a processor register. When the address field specifies a processor register, the instruction is said to be in register-mode.

Advantage: no memory reference.    

Disadvantage: limited operand

Register direct addressing mode:


  • In this mode, the operands are in registers that reside within the CPU.
  • The particular register is selected from the register field in the instruction. For example MOV A, B

         

Advantage: no memory reference.    

Disadvantage: limited address space

Register indirect addressing mode:


  • In this mode the instruction specifies a register in the CPU whose contents give the address of the operand in the memory.
  • In other words, the selected register contains the address of the operand rather than the operand itself.
  • Before using a register indirect mode instruction, the programmer must ensure that the memory address of the operand is placed in the processor register with a previous instruction.

For example LDAX B

Advantage: Large address space.

The address field of the instruction uses fewer bits to select a register than would have been required to specify a memory address directly.

Disadvantage: Extra memory reference

Auto increment or Auto decrement Addressing Mode:

  • This is similar to register indirect mode except that the register is incremented or decremented after (or before) its value is used to access memory.
  • When the address stored in the registers refers to a table of data in memory, it is necessary to increment or decrement the registers after every access to the table.
  • This can be achieved by using the increment or decrement instruction. In some computers it is automatically accessed.
  • The address field of an instruction is used by the control unit in the CPU to obtain the operands from memory.
  • Sometimes the value given in the address field is the address of the operand, but sometimes it is the address from which the address has to be calculated.

Direct Addressing Mode


  • In this mode the effective address is equal to the address part of the instruction. The operand resides in memory and its address is given directly by the address field of the instruction.

For example LDA 4000H

Advantage: Simple.      

Disadvantage: limited address field

Indirect Addressing Mode


  • In this mode the address field of the instruction gives the address where the effective address is stored in memory.
  • Control unit fetches the instruction from the memory and uses its address part to access memory again to read the effective address.

Advantage: Flexibility

Disadvantage: Complexity

Displacement Addressing Mode


  • A very powerful mode of addressing combines the capabilities of direct addressing and register indirect addressing.
  • The address field of instruction is added to the content of specific register in the CPU.

Advantage: Flexibility.

Disadvantage: Complexity

Relative Addressing Mode


  • In this mode the content of the program counter (PC) is added to the address part of the instruction in order to obtain the effective address.
  • The address part of the instruction is usually a signed number (either a +ve or a –ve number).
  • When the number is added to the content of the program counter, the result produces an effective address whose position in memory is relative to the address of the next instruction.

Effective Address (EA) = PC + A

Indexed Addressing Mode


  • In this mode the content of an index register (XR) is added to the address part of the instruction to obtain the effective address.
  • The index register is a special CPU register that contains an index value.
  • Note: If an index-type instruction does not include an address field in its format, the instruction is automatically converted to the register indirect mode of operation.

Effective Address (EA) = XR + A

Base Register Addressing Mode


  • In this mode the content of a base register (BR) is added to the address part of the instruction to obtain the effective address.
  • This is similar to the indexed addressing mode except that the register is now called a base register instead of the index register.
  • The base register addressing mode is used in computers to facilitate the relocation of programs in memory i.e. when programs and data are moved from one segment of memory to another.

Effective Address (EA) = BR + A

Stack Addressing Mode


  • The stack is the linear array of It is some times referred to as push down list or last in First out (LIFO) queue. The stack pointer is maintained in register.

Let us try to evaluate the addressing modes with as example.

 

                     

                                            Fig: Numerical Example for Addressing Modes