Addressing Modes 8086
Addressing Modes 8086
Computer Architecture
Addressing Modes
• The term addressing modes refers to the way in which the operand of an
instruction is specified.
Addressing
2) Addressing modes for branch
Modes easily access variables, arrays, records, pointers, and other complex data
types.
Types of
Immediate Addressing Mode
Register Direct Addressing Mode
Addressing Register Indirect Mode
Addressing instruction.
These instructions are useful for initializing register to a constant value.
Mode
(symbol #)
For Example: MOV AL, 35H (move the data 35H into AL register)
ADD AX, #5H (A=A+5)
LDA, #25H (Load 25H into the accumulator)
AND AX, 0000H (AX=AX^0000)
Note:
Limitation in the immediate mode is that the range of constants are restricted by size of
address field.
No memory reference.
Fast execution.
In this mode, the operands are in registers that reside within the
Mode •
•
MOV AX, CX
ADD BL (AL=AL+BL)
Note:
Effective Address (EA) = R
Here one register reference is required to access the data.
No memory reference.
Limited address space
In this mode the instruction specifies a register in the CPU whose contents give the address
Register of the operand in the memory.
In other words, the selected register contains the address of the operand rather than the
Indirect Mode operand itself.
Before using a register indirect mode instruction, the programmer must ensure that the
memory address of the operand is placed in the processor register with a previous
instruction.
For example:
• MOV AX, [BX]
• MOV AX, [DI]
• ADD AL, [BX]
• MOV AX, [SI]
Note:
• Effective Address (EA) = (R) or [R]
• Here two register reference is required to access the data.
Mode • MOV AX, [0500H] //move the operand of offset address 0500H to AX
(symbol [ ])
Note:
• Here only one memory reference operation is required to access the data.
• Simple.
• Limited address Field
In this mode address field of instruction contains the address of
effective address. Here two references are required.
Indirect a) 1st reference to get effective address.
b) 2nd reference to access the data.
addressing Based on the availability of Effective address, Indirect mode is
Mode of two kinds:
• Register Indirect: In this mode effective address is in the
register, and corresponding register name will be
maintained in the address field of an instruction.
• Memory Indirect: In this mode effective address is in the
memory, and corresponding memory address will be
maintained in the address field of an instruction.
For Example:
• MOV CL, [BX]
Addressing Modes Based on
Transfer of Control
PC relative addressing mode is used to implement intra
segment transfer of control. In this mode effective address
PC Relative is obtained by adding displacement to PC.
Addressing • EA= PC + Address field value
Mode • PC= PC + Relative value.
Note:
• Used for program control instructions
Base register addressing mode is used to implement inter segment transfer of
control. In this mode effective address is obtained by adding base register value
to address field value.
Note:
a) PC relative and based register both addressing modes are suitable for
program relocation at runtime.
b) Based register addressing mode is best suitable to write position
independent codes.
c) The base register addressing mode is used in computers to facilitate the
relocation of programs in memory i.e., when programs and data are moved
from one segment of memory to another.
The operand’s offset is the sum of the content of an index
register SI or DI and an 8 bit or 16-bit displacement.
For example:
• MOV AX, [SI +05]
Indexed • ADD AL, [DI+16]
Addressing Note:
1) Use to access or implement array efficiently.
Mode
2) Multiple registers required to implement.
3) Any element can be accessed without changing
instruction.
The operand’s offset is sum of the content of a base register
Based BX or BP and an index register SI or DI.
For Example:
Indexed • ADD AX, [BX+SI]
Addressing • MOV AX, [SI+2000]
• MOV AL, [DI+3000]
ADDRESSING MODES APPLICATIONS
Immediate Addressing Mode To initialize registers to a constant value