1
34kviews
Discuss the various addressing modes of 8086. What are displacement, base and index? What is an effective address or offset?
1 Answer
3
1.3kviews

Addressing modes refer to the different methods of addressing the operands. Addressing modes of 8086 are as follows:

  1. Immediate addressing mode-

    In this mode, the operand is specified in the instruction itself. Instructions are longer but the operands are easily identified.

    Example:

    MOV CL, 12H

    This instruction moves 12 immediately into CL register. CL ← 12H

  2. Register addressing mode-

    In this mode, operands are specified using registers. This addressing mode is normally preferred because the instructions are compact and fastest executing of all instruction forms. Registers may be used as source operands, destination operands or both.

    Example:

    MOV AX, BX

    This instruction copies the contents of BX register into AX register. AX ← BX

  3. Direct memory addressing mode-

    In this mode, address of the operand is directly specified in the instruction. Here only the offset address is specified, the segment being indicated by the instruction.

    Example:

    MOV CL, [4321H]

    This instruction moves data from location 4321H in the data segment into CL.

    The physical address is calculated as

    DS * 10H + 4321

    Assume DS = 5000H

    ∴PA = 50000 + 4321 = 54321H

    ∴CL ← [54321H]

  4. Register based indirect addressing mode-

    In this mode, the effective address of the memory may be taken directly from one of the base register or index register specified by instruction.

    If register is SI, DI and BX then DS is by default segment register. If BP is used, then SS is by default segment register.

    Example:

    MOV CX, [BX] This instruction moves a word from the address pointed by BX and BX + 1 in data segment into CL and CH respectively.

    CL ← DS: [BX] and CH ← DS: [BX + 1]

    Physical address can be calculated as DS * 10H + BX.

  5. Register relative addressing mode-

    In this mode, the operand address is calculated using one of the base registers and an 8 bit or a 16 bit displacement.

    Example:

    MOV CL, [BX + 04H]

    This instruction moves a byte from the address pointed by BX + 4 in data segment to CL.

    CL ← DS: [BX + 04H]

    Physical address can be calculated as DS * 10H + BX + 4H.

  6. Base indexed addressing mode-

    Here, operand address is calculated as base register plus an index register.

    Example:

    MOV CL, [BX + SI]

    This instruction moves a byte from the address pointed by BX + SI in data segment to CL.

    CL ← DS: [BX + SI]

    Physical address can be calculated as DS * 10H + BX + SI.

  7. Relative based indexed addressing mode-

    In this mode, the address of the operand is calculated as the sum of base register, index register and 8 bit or 16 bit displacement.

    Example:

    MOV CL, [BX + DI + 20]

    This instruction moves a byte from the address pointed by BX + DI + 20H in data segment to CL.

    CL ← DS: [BX + DI + 20H]

    Physical address can be calculated as DS * 10H + BX + DI + 20H.

  8. Implied addressing mode-

    In this mode, the operands are implied and are hence not specified in the instruction.

    Example:

    STC

    This sets the carry flag.

Effective Address or Offset Address:

  • The offset for a memory operand is called the operand’s effective address or EA.
  • It is an unassigned 16 bit number that expresses the operand’s distance in bytes from the beginning of the segment in which it resides.
  • In 8086 we have base registers and index registers. So EU calculates EA by summing a displacement, the content of base register and the content of index register.

    EA = {Base Register} + {Index Register} + {8 0r 16 bit displacement}

  • The displacement is an 8 or 16 bit number that is contained in the instruction.
  • Either BX or BP is to be used as a base register whose content is to be used in the EA computation.
  • Similarly either SI or DI may be specified as an index register whereas displacement value is constant.
  • The contents of base and index registers may change during execution. This makes it possible for one instruction to access different memory locations as determined by the current values in the base and/or index registers.
  • It takes time for EU to calculate a memory operand’s EA. In general, the more elements in the calculations, the longer it takes.
Please log in to add an answer.