PadhaikoAll subjects

Past exam question: 2082 Kartik (Back), Q4(b)

Microprocessors · 6 marks

Open in the Padhaiko app

Topic: Segment:Offset Addressing, Pins & Addressing Modes

Question

Explain briefly about different types of addressing mode used in 8086 with suitable example.

Solution

Classification of 8086 Addressing Modes: The Intel 8086 features versatile addressing modes classified according to how the operand is referenced:

  1. Immediate Addressing Mode: The operand is an 8-bit or 16-bit constant contained directly within the instruction following the opcode.
    • Example: MOV AX, 1234H (loads 16-bit constant 1234H into AX).
    • Example: MOV AL, 50H (loads 8-bit constant 50H into AL).
  2. Register Addressing Mode: The operand resides in one of the 8-bit or 16-bit internal registers of the CPU; no bus memory access is required.
    • Example: MOV AX, BX (copies contents of BX into AX).
    • Example: ADD CL, DL (adds DL to CL).
  3. Direct Addressing Mode: The effective offset address (EA) of the memory operand is explicitly specified as a 16-bit value within the instruction. Default segment is DS.
    • Example: MOV AX, [2050H] (loads 16-bit word from DS:2050H into AX).

Memory Addressing Modes Using Pointers & Index Registers:

  1. Register Indirect Addressing Mode: The effective address of the memory operand is contained in a base register (BX, BP) or index register (SI, DI). Default segment is DS (or SS if BP is used).
    • Example: MOV AX, [BX] (operand EA = [BX]).
    • Example: MOV [DI], CL (stores CL at EA = [DI]).
  2. Based Addressing Mode: The effective address is the sum of a base register (BX or BP) and an 8-bit or 16-bit displacement value.
    • Formula: EA = [BX or BP] + Displacement
    • Example: MOV AX, [BX + 08H] (EA = BX + 8).
  3. Indexed Addressing Mode: The effective address is the sum of an index register (SI or DI) and an 8-bit or 16-bit displacement.
    • Formula: EA = [SI or DI] + Displacement
    • Example: MOV CX, [SI + 10H] (EA = SI + 10H).
  4. Based Indexed Addressing Mode: The effective address is the sum of a base register and an index register.
    • Formula: EA = [BX or BP] + [SI or DI]
    • Example: MOV AX, [BX + SI] (EA = BX + SI).
  5. Based Indexed with Displacement Addressing Mode: The effective address is the sum of a base register, an index register, and an 8-bit or 16-bit displacement.
    • Formula: EA = [BX or BP] + [SI or DI] + Displacement
    • Example: MOV AX, [BX + DI + 20H] (EA = BX + DI + 20H). Useful for accessing 2D arrays and records.

Summary Reference Table:

Addressing ModeEffective Address (EA) FormulaDefault SegmentExample
ImmediateStored in instructionCSMOV AX, 00FFH
RegisterRegister contentsInternalMOV DX, CX
DirectDirect 16-bit offsetDSMOV AX, [1000H]
Register Indirect[BX] / [BP] / [SI] / [DI]DS (or SS for BP)MOV AX, [SI]
Based[BX/BP] + DispDS (or SS for BP)MOV AX, [BX + 4]
Indexed[SI/DI] + DispDSMOV DX, [DI + 6]
Based Indexed[BX/BP] + [SI/DI]DS (or SS for BP)MOV AX, [BX + DI]
Based Indexed Disp[BX/BP] + [SI/DI] + DispDS (or SS for BP)MOV AX, [BP + SI + 10H]
Answer:

8086 provides Immediate, Register, Direct, Register Indirect ([BX]/[BP]/[SI]/[DI]), Based ([BX/BP]+disp), Indexed ([SI/DI]+disp), Based-Indexed ([BX/BP]+[SI/DI]), and Based-Indexed-with-Displacement addressing modes.

All past exam questions for Microprocessors