Microprocessor and Interfacing Devices/Peripherals
8086 Addressing Modes
Part 11
Dr Manjusha Deshmukh
Dr Manjusha
The sequence of instructions Instruction
Each command in a program is called an instruction Machine language code:
A program written in machine language is referred to as Assembly language :
In 8086 we write program in
Mnemonic
Dr Manjusha
Addressing Modes
• Register addressing mode• Immediate Addressing Mode
• Memory Addressing mode
▪ Direct Addressing Mode
▪ Indirect Addressing Mode
▪ Indexed Addressing Mode
▪ Base Addressing Mode
▪ Base Index Addressing mode
• Relative Addressing Mode
▪ Relative base addressing mode
▪ Relative indexed addressing mode
▪ Relative base index addressing mode
• Implied / Implicit Addressing Mode
Prerequisite
• Memory Segmentation
The term addressing modes refers to the way in which the operand of an instruction is specified.
An addressing mode specifies how to calculate the effective memory address of an operand
Dr Manjusha
Register addressing modes:
• Here data is stored in a registeres and referred using the particular register.
• In this type of addressing mode both the operands are registers.
• Example:
• MOV AL, CL
• MOV AX, BX
AH AL
BH BL
CH CL
DH DL
9B H
F0 H F0 H
FF H
3E H
3E H 25 H
A5 H A5 H AB H
AB H
FF H 9B H
F0 H
25 H F0 H
Mnemonic Operands are registers
Dr Manjusha
Immediate Addressing Mode
In this type of addressing mode the source operand is a 8 bit or 16 bit data. Destination operand can never be immediate data.
Example:
• MOV AX, 2000
• MOV CL, 0A
Top of CS
Code Segment
00
Bottom of CS
0A
AH AL
BH BL
CH CL
DH DL 20 H
00 H 20 H
0A
Dr Manjusha
Direct mode
In this, a 16-bit memory address (offset) or an input/ output address is directly specified in the instruction as a part of it.
• Example:
MOV CL, [4321 H]
This instruction moves data from location whose offset is 4321 to CL Assume DS = 5000H
The physical address is calculated as
DS * 10H + 4321
∴PA = 5000X10 + 4321 = 54321H
∴CL ← [54321H]
Top of DS
Data Segment
Bottom of DS
11110000
Offset = 4321 54321H
50000 H
Req Location
AH AL
BH BL
CH CL
DH DL
11110000
Dr Manjusha
Memory Indirect Addressing Mode
• In this offset of data is in either Bx, SI, DI, (Base register, source index or Destination index) default segment is either DS or ES.
Example:
MOV AL, [SI]
This instruction moves data from offset in SI into CL.
Assume DS = 5000H Assume SI = 1102 H
The physical address is calculated as DS * 10H + [ SI ]
∴PA = 50000 + 1102 = 51102H
∴AL ← [51102H]
Top of DS
Data Segment
Bottom of DS 51102 H F0
50000 H
Req Location
AH AL
BH BL
CH CL
DH DL
F0
Offset = 1102 H
Dr Manjusha
Memory based addressing mode-
• In this mode, the effective address of the memory may be taken
directly from one of the base register (BX, BP)specified by instruction.
If register is BX then DS is by default segment register.
Example:
MOV DL, [BX]
This instruction moves data from location whose offset is in BX into DL.
Assume DS = 5000H Assume BX = 0005 H
The physical address is calculated as DS * 10H + 0005 H
∴PA = 50000 +0005= 50005 H
∴DL ← [50005 H]
Top of DS
Data Segment
Bottom of DS 50005H F0
50000 H
Req Location
AH AL
BH BL
CH CL
DH DL
F0
EA = 0005 H
Dr Manjusha
Memory Indexed Addressing Mode-
• In this mode, the effective address of the memory may be taken directly from index register specified by instruction.
If register is SI, then DS is by default segment register and if DI then ES is segment register
Top of DS
Data Segment
Bottom of DS
F0
50000 H
Req Location
AH AL
BH BL
CH CL
DH DL
F0
Example:
MOV DL, [SI]
This instruction moves data from offset in SI into CL.
Assume DS = 5000H Assume SI = 1002 H
The physical address is calculated as DS * 10H + [ SI ]
∴PA = 50000 + 1002 = 51002H
∴DL ← [51002H]
51002 H
EA=
1002 H
Based indexed mode –
Base register: BX, BP Index register: SI, DI
Example:
MOV CH, [BX+SI]
This instruction moves a byte from the address pointed by BX + SI in data segment to CL.
Assume DS = 5000H Assume SI = 4321 H Assume BX =1000 H
The physical address is calculated as DS * 10H + 4321 + 1000
∴PA = 50000 + 4321+1000H = 55321H
∴CH ← [55321H]
Top of DS
Data Segment
Bottom of DS 55321H F0
50000 H
Req Location
AH AL
BH BL
CH CL
DH DL
F0
EA = 5321
In this the effective address is sum of base register and index register.
EA = 5321
Dr Manjusha
Relative Base 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 CH, [BX+04 H]
This instruction moves a byte from the address pointed by BX + 04 H in data segment to CL.
Assume DS = 5000H Assume BX = 4321 H Displacement =04 H
The physical address is DS * 10H + 4321
∴PA = 50000 + 4321+04H = 54325H
∴CH ← [54325 H]
Top of DS
Data Segment
Bottom of DS 54325H F0
50000 H
Req Location
AH AL
BH BL
CH CL
DH DL
F0
EA = 4325 EA =
4325
Dr Manjusha
Relative Index addressing mode-
In this mode, the operand address is calculated using one of the index registers and an 8 bit or a 16 bit displacement.
Example:
MOV CH, [SI+04 H]
This instruction moves a byte from the address pointed by SI + 04 H in data segment to CL.
Assume DS = 5000H Assume SI= 4321 H Displacement =04 H
The physical address is DS * 10H + 4321
∴PA = 50000 + 4321+04H = 54325H
∴CH ← [54325 H]
Top of DS
Data Segment
Bottom of DS 54325H F0
50000 H
Req Location
AH AL
BH BL
CH CL
DH DL
F0
EA = 4325 EA =
4325
Dr Manjusha
Relative Base Index addressing mode-
In this mode, the operand address is calculated using one of the index registers and an 8 bit or a 16 bit displacement.
Example:
MOV CH, [BX+ SI+04 H]
This instruction moves a byte from the address pointed by BX +SI+ 04 H in data segment to CL.
Assume DS = 5000H Assume BX= 4321 H Assume SI= 1001 H Displacement =04 H
The physical address is DS * 10H + 4321
∴PA = 50000 + 4321+1001+04H = 55326H
∴CH ← [55326 H]
Top of DS
Data Segment
Bottom of DS 55326H F0
50000 H
Req Location
AH AL
BH BL
CH CL
DH DL
F0
EA = 5326 EA =
5326
Dr Manjusha
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.
• CLD – Clears Direction flag
0 1
Dr Manjusha
Dr Manjusha