Addressing modes of 8086
The way for which an operand is specified for an instruction in the accumulator, in a general purpose register or in memory location, is called addressing mode.
The 8086 microprocessors have 8 addressing modes. Two addressing modes have been provided for instructions which operate on register or immediate data.
These two addressing modes are:
Register Addressing: In register addressing, the operand is placed in one of the 16-bit or 8-bit general purpose registers.
Example
- MOV AX, CX
- ADD AL, BL
- ADD CX, DX
Immediate Addressing: In immediate addressing, the operand is specified in the instruction itself.
Example
- MOV AL, 35H
- MOV BX, 0301H
- MOV [0401], 3598H
- ADD AX, 4836H
The remaining 6 addressing modes specify the location of an operand which is placed in a memory.
These 6 addressing modes are:
Direct Addressing: In direct addressing mode, the operand?s offset is given in the instruction as an 8-bit or 16-bit displacement element.
Example
- ADD AL, [0301]
The instruction adds the content of the offset address 0301 to AL. the operand is placed at the given offset (0301) within the data segment DS.
Register Indirect Addressing: The operand's offset is placed in any one of the registers BX, BP, SI or DI as specified in the instruction.
Example
- MOV AX, [BX]
It moves the contents of memory locations addressed by the register BX to the register AX.
Based Addressing: The operand's offset is the sum of an 8-bit or 16-bit displacement and the contents of the base register BX or BP. BX is used as base register for data segment, and the BP is used as a base register for stack segment.
Effective address (Offset) = [BX + 8-bit or 16-bit displacement].
Example
- MOV AL, [BX+05]; an example of 8-bit displacement.
- MOV AL, [BX + 1346H]; example of 16-bit displacement.
Indexed Addressing: The offset of an operand is the sum of the content of an index register SI or DI and an 8-bit or 16-bit displacement.
Offset (Effective Address) = [SI or DI + 8-bit or 16-bit displacement]
Example
- MOV AX, [SI + 05]; 8-bit displacement.
- MOV AX, [SI + 1528H]; 16-bit displacement.
Based Indexed Addressing: The offset of operand is the sum of the content of a base register BX or BP and an index register SI or DI.
Effective Address (Offset) = [BX or BP] + [SI or DI]
Here, BX is used for a base register for data segment, and BP is used as a base register for stack segment.
Example
- ADD AX, [BX + SI]
- MOV CX, [BX + SI]
Based Indexed with Displacement: In this mode of addressing, the operand's offset is given by:
Effective Address (Offset) = [BX or BP] + [SI or DI] + 8-bit or 16-bit displacement
Example
- MOV AX, [BX + SI + 05]; 8-bit displacement
- MOV AX, [BX + SI + 1235H]; 16-bit displacement
Comments
Post a Comment