You are on page 1of 4

8086 ADDRESSING MODES:

Books to be Referred:
1. Microprocessors and Interfacing 2nd Edition, Douglas V Hall
2. 80X86 Programming K. R. Venugopal
Addressing mode refers to the mechanism by which the operands are specified
for an operation. Depending on the type of operands used, there are 7 addressing
modes available.

1. Immediate Mode:
In this mode, the instruction contains 8-bit or 16-bit immediate data along with
the mnemonic. Data can be moved to 8-bit or 16-bit register, or memory location using
the address or register.
Instruction
Operand (8-
bit or 16-bit)
Ex: MOV AX, 1234 h, AND AL, 3FH, MOV DX, 0ABCDH
MOV [2000h], 25 MOV AL, 3373 (invalid), MOV DS, 1234 (invalid)

Note: a) Any data must start with a decimal digit (0 to 9). Hex digits A to F are treated
as characters. So, Hex nos must be prefixed with a Zero. (Ex: MOV CL, 0A2H)
b) Immediate data cannot be copied into Segment registers.
c) Size of the data (byte or word) must match the size of registers (8-bit or 16-bit)

2. Register Mode:
In this mode, the operands are available in general purpose registers. Instruction
specifies the register name.
Instruction Register
Register Operand

Ex: MOV CL, DL ; ADD BL, AL ; MOV AX, CL (invalid)


XOR CX, DX ; DEC BX ; NEG AX

Memory Operands:
3. Direct Mode:
Here, the instruction contains 16-bit offset (Effective address) (EA) of the memory
location.

The Physical Address (PA) is calculated by 8086 using EA and Segment Register; and
then the operand will be fetched from memory. Default register is DS.

Compiled by: L. Krishnananda, Asst Professor, REVA ITM, Bangalore


Instruction Memory (PA)
Effective Address
of operand Operand
(EA)

PA = EA + (DS * 10H)
Ex: MOV BL, NUM ; MOV [3455H], AL ; MOV CX, ES: 20h, MOV NUM2, CX

4. Indirect Modes
8086 provides many indirect addressing modes (where one operand is in
memory) which are extensively used in programming.
a) Register Indirect Mode:
In this mode, the instruction contains a 16-bit register name which contains the
EA. Using this EA, PA is calculated. Default segment register for memory is DS. Only
BX, SI and DI register can be used to hold the EA.
Instruction Memory (PA)
Register
Register EA of
SI, DI or BX Operand
operand

Ex: MOV AL, BYTE PTR [BX] ; INC WORD PTR [DI], MOV [BX], [SI] (invalid)
MUL BYTE PTR [SI] ; AND CX, WORD PTR [BX], MOV BYTE PTR [BX], 50h
ADD CX, [AX] (invalid)

b) Register Relative Mode or Indexed Mode: (Register Indirect


with Displacement)
In this mode, the instruction contains a 16-bit register name (which contains an
address) and a signed displacement. Adding the register contents with displacement
gives the EA. Using this EA, PA is calculated. Default segment register for memory is
DS. Only BX, SI, DI and BP register can be used.
PA = EA + (DS * 10H)

(BX) 8-bit displacement (sign-extended)


EA = (BP) + or
(SI) 16- bit signed displacement )
(DI)

Compiled by: L. Krishnananda, Asst Professor, REVA ITM, Bangalore


Instruction
Memory (PA)
Register Offset
EA
Operand

Addres
s

Ex: MOV AL, BYTE PTR 50 [BX] ; DEC WORD PTR [DI+30]
MOV 100H WORD PTR [BX], 1224H ; MOV CX, -22H [SI]

c) Based Indexed Mode:


In this mode, the instruction contains a 16-bit Base register name (which contains
the base address) and a 16-bit Index register name. Adding the contents of both
registers, EA is obtained. Then, PA is calculated. Default segment register for memory is
DS. Only BX, BP and SI, DI registers can be used.
Instruction Memory (PA)
Base address
Base Register
Operand

Index Register
EA = Offset / index

EA = (BX) or (BP) + (SI) or (DI)


PA = EA + (DS * 10H)

Ex: MOV [BX] [SI], 1234H, SUB AL, BYTE PTR [BX][DI]

d) Relative Based Indexed Mode:


In this mode, the instruction contains a 16-bit Base register name (which contains
the base address), a 16-bit Index register name and a displacement. Adding the
contents of both registers along with the displacement, EA is obtained. Then, PA is
calculated. Default segment register for memory is DS. Only BX, BP and SI, DI registers
can be used.

Compiled by: L. Krishnananda, Asst Professor, REVA ITM, Bangalore


Instruction

Base Index Displacement


Register Register Memory (PA)

Operand
Offset / index
EA

Base address

EA = (BX) or (BP) + (SI) or (DI) + 8-bit sign-extended displacement


or 16-bit signed displacement
PA = EA + (DS * 10H)

Ex: MOV 50h [BX] [SI] , 1234H MOV -30H [BP] [SI], DX

Compiled by: L. Krishnananda, Asst Professor, REVA ITM, Bangalore