1.5 EEEQ 472 - 8086 Microproessor - Addressing Modes
1.5 EEEQ 472 - 8086 Microproessor - Addressing Modes
1.5 EEEQ 472 - 8086 Microproessor - Addressing Modes
Introduction
When 8086 executes an instruction, it performs the specified
function on data
8086 Microprocessor Architecture These data are called its operands and may be:
(Addressing Modes) part of the instruction
addressing modes can be classified into five groups: Immediate Addressing Mode
Addressing modes for accessing immediate and register Register Addressing Mode
data (register and immediate addressing modes (2)) Memory Addressing Modes:
Addressing modes for accessing data in memory (memory
Direct Addressing Mode
addressing modes (6))
Register Indirect Addressing Mode
Addressing modes for accessing I/O ports (I/O or Port
Based Addressing Mode
addressing modes (2))
Indexed Addressing Mode
Relative addressing mode (1)
Based Indexed Addressing Mode
Implied addressing mode (1)
String Addressing Mode
1
9/30/2021
Relative Addressing Mode MOV CL, 03 H; Moves the 8 bit data 03H into CL
Implied Addressing Mode MOV DX, 0525 H; Moves the 16 bit data 0525H into DX
MOV BH, VALUE; loads 35H into BH MOV DX, CX; moves 16 bit content of CS into DX
MOV CL, DL; moves 8 bit contents of DL into CL
MOV BX, CH; an illegal instruction
2
9/30/2021
EA is directly used as the 16 bit offset of the storage location of any of the four segment registers can be referenced
PA = DS : EA
data for register and immediate operands. However the EU MOV CX, START
cannot directly access the memory operands. If the 16 bit value assigned to the offset START by the
EU must use the BIU in order to access memory operands programmer using an assembler pseudo instruction such
In the direct addressing mode, the 16 bit effective address as DW is 0040 and [DS] = 3050
(EA) is taken directly from the displacement field of the Then BIU generates the 20 bit physical address 30540H.
3
9/30/2021
4
9/30/2021
𝐶𝑆 𝐶𝑆
𝑆𝐼 𝐵𝑋 𝑆𝐼
𝐷𝑆 𝐷𝑆
𝑃𝐴 = ∶ 𝑜𝑟 + 8 𝑜𝑟 16 𝑏𝑖𝑡 𝑑𝑖𝑠𝑝𝑙𝑎𝑐𝑒𝑚𝑒𝑛𝑡 𝑃𝐴 = ∶ 𝑜𝑟 + 𝑜𝑟 + 8 𝑜𝑟 16 − 𝑏𝑖𝑡 𝑑𝑖𝑠𝑝𝑙𝑎𝑐𝑒𝑚𝑒𝑛𝑡
𝑆𝑆 𝑆𝑆
𝐷𝐼 𝐵𝑃 𝐷𝐼
𝐸𝑆 𝐸𝑆
Example:
The content of this memory is moved into BH MOV ALPHA [SI] [BX], CL
5
9/30/2021
the first byte or word of the source operand and DI points to PA : [DS] + [SI]
the first byte or word of the destination operand Destination address : [ES] + [DI] = 40300, assume it
The contents of SI and DI are automatically incremented (by contains 45
clearing DF to 0 by CLD instruction) to point to the next byte or After executing MOV S BYTE:
word
[40300] = 38
Example: [SI] = 0501
MOV S BYTE [DI] = 0301
If [DF] = 0, [DS] = 2000, [SI] = 0500
Example: Examples:
IN AX, DX
If [DX] = 5040
and AH respectively
6
9/30/2021
bit displacement relative to IP is specified relative to the address of the instruction after the
JNC START Since the 8086 conditional Jump instructions do not contain an
If CY=0, then PC is loaded with current PC contents plus 8 absolute address, the program can be placed anywhere in
bit signed value of START, otherwise the next instruction is memory which can still be executed properly by the 8086
Example:
7
9/30/2021
In 8 bit multiplication, one of the operands must be in AL. In instructions where we need to specify in a general purpose
The other operand can be a byte in memory location or in register the 16 bit effective address of a memory location, the
another 8 bit register
register BX is used (register indirect)
The resulting 16 bit product is stored in AX, with AH storing
the MS byte
In 16 bit multiplication, one of the operands must be in AX.
The other operand can be a word in memory location or in
another 16 bit register
The resulting 32 bit product is stored in DX and AX, with DX
storing the MS word and AX storing the LS word
8
9/30/2021
Describe the addressing modes for each of the following 8086 The contents of the following registers are: CS = 0187H, DS =
example instructions and briefly explain what the instruction 4289H, SS = 22A8H, IP = 13DAH, SP = 1179H, and DI =
achieves. 0A96H
a) MOV ALPHA [SI] [BX], CL a) Determine the addresses of the next two instructions to be
c) MOV AX, 1234H b) Determine the size and range of addresses for the stack
segment.
d) MOV AX, [2500H]
e) MOV AX,[BX]
Given that [DS] = 3050 and the value of START is 0040, Determine the physical address for each of the instructions
compute the physical address and explain what the instruction below given that [BX] = 0209, [CX] = 0408, ALPHA = 09, [SI]
MOV START, BX achieves. = 1000, [DS] = 3000, [SS] = 4000, [ES] = 2000, [DI] =
0020, START = 0070, [IP] = 0146, [BP] = 0016, and [SP] =
0040.
b) MOV START[BP], BX
9
9/30/2021
END
10