Addressing Modes of
       8086
  Prepared & Presented by-
        Rajvir Singh
• The different ways in which a
  processor can access data are called
 addressing modes
• 8086 accesses code bytes using
  contents of CS & IP register
• 8086 accesses stack using contents
  of SS & SP register
How 8086 accesses data?
• 8086 assembly language instructions
  can be used to illustrate the
  addressing modes
• Format of MOV instruction
     MOV destination, source
• Source of data can be
  – Immediate data
  – A specified register
  – A memory location specified in 1 of 24
    different ways
• Destination of data can be
  – A specified register
  – A memory location specified in 1 of 24
    different ways
Classification of
      Addressing Modes
1.   Register addressing mode
2.   Immediate addressing mode
3.   Memory addressing mode
4.   Port addressing mode
5.   Relative addressing mode
6.   Implied addressing mode
1. Register addressing mode

• Source/destination can be one of the
  8086 registers
• MOV AX, BX ; 16-bit data transfer
• MOV AL, BL ; 8-bit data transfer
2. Immediate addressing mode

• 8 or 16-bit data can be specified as
  part of the instruction
• E.g. MOV AL, 45H
        MOV BX, 5062H
3. Memory addressing mode
• One of the operands is in memory
• 8086 must use
  – a segment register
  – A 16-bit offset (effective address)
• By default, DS register is used for
  accessing data from memory
• 16-bit offset can be specified in
  many ways
Different ways of
      specifying offset
•   Direct memory addressing
•   Register Indirect addressing
•   Based addresing
•   Indexed addressing
•   Based Indexed addressing
•   String addressing
a. Direct Memory addressing

• Effective address is specified
  directly in the instruction
• E.g. MOV BX, [5062]
• 20-bit physical address of memory
  location is calculated using DS and
  offset value 5062
Accessing memory
Segment register

       +           =   20-bit physical address
                                   of operand
16-bit offset
b. Register indirect addressing

• The effective address of memory
  operand is present in one of the base
  or index registers [BX, BP, SI, DI]
• E.g. MOV CX, [BX]
• If DS = 2000H, BX = 0004H
• THEN contents of memory location
  20004H are copied to register CX
c. Based addressing
• Effective address is sum of
  – 16-bit offset given in instruction
  – Contents of   base register BX or BP
• Segment register is DS or     SS
• E.g. MOV AX, 4[BX]
• E.G. PUSH CX
d. Indexed addressing
• Effective address is sum of
  – 16-bit offset given in instruction
  – Contents of   index register SI or DI
• Segment register is    DS
• E.g. MOV AX, 4[SI]
e. Based Indexed addressing
• Effective address is sum of
  – 16-bit offset given in instruction
  – Contents of index register SI or DI
  – Contents of base register BX or BP
• Segment register is DS
• E.g. MOV AX, 4[BX][SI]
f. String addressing

• Used when string related instructions
  are executed
• Uses index registers
• SI register points to the first byte or
  word of the source string
• DI register points to the first byte or
  word of the destination
Classification of
      Addressing Modes
1.   Register addressing mode
2.   Immediate addressing mode
3.   Memory addressing mode
4.   Port addressing mode
5.   Relative addressing mode
6.   Implied addressing mode
4. Port addressing

• Two I/O port addressing modes can
  be used
  – Direct (e.g. IN AL, 02H)
  – Indirect (e.g. IN AL, DXH)
5. Relative addressing mode
• Specifies the operand as a 8-bit
  signed displacement relative to PC
• E.g. JNC 08H
• IF carry = 0, THEN PC is loaded with
  current PC contents + 8-bit signed
  value
6. Implied addressing mode
• No operands are specified
• E.g. CLC
• Means clear carry flag

1327 addressingmodesof8086-100523023240-phpapp02

  • 1.
    Addressing Modes of 8086 Prepared & Presented by- Rajvir Singh
  • 2.
    • The differentways in which a processor can access data are called addressing modes
  • 3.
    • 8086 accessescode bytes using contents of CS & IP register • 8086 accesses stack using contents of SS & SP register
  • 4.
    How 8086 accessesdata? • 8086 assembly language instructions can be used to illustrate the addressing modes • Format of MOV instruction MOV destination, source
  • 5.
    • Source ofdata can be – Immediate data – A specified register – A memory location specified in 1 of 24 different ways • Destination of data can be – A specified register – A memory location specified in 1 of 24 different ways
  • 6.
    Classification of Addressing Modes 1. Register addressing mode 2. Immediate addressing mode 3. Memory addressing mode 4. Port addressing mode 5. Relative addressing mode 6. Implied addressing mode
  • 7.
    1. Register addressingmode • Source/destination can be one of the 8086 registers • MOV AX, BX ; 16-bit data transfer • MOV AL, BL ; 8-bit data transfer
  • 8.
    2. Immediate addressingmode • 8 or 16-bit data can be specified as part of the instruction • E.g. MOV AL, 45H MOV BX, 5062H
  • 9.
    3. Memory addressingmode • One of the operands is in memory • 8086 must use – a segment register – A 16-bit offset (effective address) • By default, DS register is used for accessing data from memory • 16-bit offset can be specified in many ways
  • 10.
    Different ways of specifying offset • Direct memory addressing • Register Indirect addressing • Based addresing • Indexed addressing • Based Indexed addressing • String addressing
  • 11.
    a. Direct Memoryaddressing • Effective address is specified directly in the instruction • E.g. MOV BX, [5062] • 20-bit physical address of memory location is calculated using DS and offset value 5062
  • 12.
    Accessing memory Segment register + = 20-bit physical address of operand 16-bit offset
  • 13.
    b. Register indirectaddressing • The effective address of memory operand is present in one of the base or index registers [BX, BP, SI, DI] • E.g. MOV CX, [BX] • If DS = 2000H, BX = 0004H • THEN contents of memory location 20004H are copied to register CX
  • 14.
    c. Based addressing •Effective address is sum of – 16-bit offset given in instruction – Contents of base register BX or BP • Segment register is DS or SS • E.g. MOV AX, 4[BX] • E.G. PUSH CX
  • 15.
    d. Indexed addressing •Effective address is sum of – 16-bit offset given in instruction – Contents of index register SI or DI • Segment register is DS • E.g. MOV AX, 4[SI]
  • 16.
    e. Based Indexedaddressing • Effective address is sum of – 16-bit offset given in instruction – Contents of index register SI or DI – Contents of base register BX or BP • Segment register is DS • E.g. MOV AX, 4[BX][SI]
  • 17.
    f. String addressing •Used when string related instructions are executed • Uses index registers • SI register points to the first byte or word of the source string • DI register points to the first byte or word of the destination
  • 18.
    Classification of Addressing Modes 1. Register addressing mode 2. Immediate addressing mode 3. Memory addressing mode 4. Port addressing mode 5. Relative addressing mode 6. Implied addressing mode
  • 19.
    4. Port addressing •Two I/O port addressing modes can be used – Direct (e.g. IN AL, 02H) – Indirect (e.g. IN AL, DXH)
  • 20.
    5. Relative addressingmode • Specifies the operand as a 8-bit signed displacement relative to PC • E.g. JNC 08H • IF carry = 0, THEN PC is loaded with current PC contents + 8-bit signed value
  • 21.
    6. Implied addressingmode • No operands are specified • E.g. CLC • Means clear carry flag