Addressing Modes Of 8086

  1. Addressing Modes Of 8086 Ppt
  2. Addressing Modes Of 8086

ADDRESSING MODES OF 8086 The set of mechanisms by which an instruction can specify how to obtain its operands is known as Addressing modes. The CPU can access the operands (data) in a number of different modes. The addressing modes available in Intel 8086 are: 1. Register Addressing 2. Immediate Addressing 3. Direct Addressing 4. Addressing Modes gives how the data is specified (operate) in a register. The different ways in which a source operand is denoted in an instruction is known as addressing modes. Basically there are 8 types of addressing modes.

8086 Addressing Modes

Addressing modes of 8086

Addressing Modes of 8086

As we are aware that the 8086 operates on the operands that is to be fetched from memory, i/o, registers or by some other means such as an immediate number etc. The way or the technique in which the operand is specified is called an addressing mode. The addressing mode help us in identifying the source of the operand or calculate the offset of the operands if it is in memory. The addressing mode of 8086 is divided in two categories:

  1. Data related addressing modes : It is used for data access from /to different source and destinations.
  2. Branch related addressing modes: It is used to branch to different location within same or different segment.
Modes

Data related addressing modes

1. Immediate Addressing Mode: In this mode the 8 or 16 bit data is part of the instruction. The assembler at assembly time inserts this value directly into the machine instruction. An immediate data can be a constant such as a number, character or an arithmetic expression.

Addressing Modes Of 8086

Examples:

MOV AL, 09h ; immediate 8-bit hex number
MOV AH, 12 ; immediate decimal number
MOV AL, ‘R’ ; immediate character value
MOV AL, (5+2)*3 ; immediate value of an expression
MOV CX, 2345h ; immediate 16-bit hex number

2. Direct Memory Addressing Mode: In this mode the 16 bit effective address of the data is part of the instruction. The direct operand refers to the content of memory at address implied by the name of the variable. Assuming if count is declared as a variable in data segment.

Example:

MOV AL, count ; count is a variable in data segment (count is relocatable variable)
JMP NEXT ; NEXT is a label in the code segment (NEXT is relocatable variable)
MOV AL, DS:5 ; Fixed or Non-Relocatable address (segment : offset Example of non-relocatable operands)
MOV AX, ES: count ; Extra Segment and variable in ES and is relocatable variable

3. Register Addressing Mode: This mode is used for register to register transfer. Both the source and destination registers should be of the same size i.e. AX, BX, CX, DX,SI,DI or SP or BP for 16-bit and AH, AL, BH, BL, CH, CL, DH, DL for 8-bit data.

Examples:

MOV AL, BL

MOV BX, DX

MOV AL, BH

MOV AL, BX ; Wrong because the two registers are of different size

4. Register Indirect: In this addressing mode the register contains the effective address (EA) where the operand will be found. The EA is in the base (BX) or index registers (SI, DI) i.e. EA= [BX] or [SI] or [DI].

Example:

There are four forms of this addressing mode on the 8086, best demonstrated by the following instructions:
MOV al, [bx] MOV al, [bp] MOV al, [si] MOV al, [di]
When a variable like ARRAY is declared in data segment, then the statement like: MOV BX, offset ARRAY;
A program to move certain bytes of data from source to destination variable

MOV SI, offset X

MOV DI, offset Y

MOV AL, [SI]

MOV [DI], AL

5. Register Relative Addressing Mode: In this addressing mode the effective address of the data is calculated by adding content of the base or index register with 8 bit sign extended or 16 bit displacement as shown in figure.


EA = Content of [ (BX) or (BP), or (SI), or (DI)] + 8 bit sign extended / 16 bit displacement
The indexed addressing modes use the following syntax:

MOV AL, disp[BX] MOV AL, disp[BP] MOV AL, disp[SI] MOV AL, disp[DI]
EXAMPLES :
MOV AL, 2[BX] or MOV AL, [BX + 2]
MOV AL, num1[BX] or MOV AL, [BX + num1]

In figure we can also use register BP and the instruction MOV AL,[BP+disp]

6. Based Indexed Addressing Mode: The effective address is obtained by adding the contents of the base registers and the index register, both of which are given in the instruction.
EA= {[BX] or [BP]} + {[SI] or [DI]}

Example:

MOV AL, [BX][SI] MOV AL, [BX][DI]
MOV AL, [BP][SI] MOV AL, [BP][DI]
MOV AX, [SI+DI]

Suppose that BX contains 1020h and SI contains 229h. Then the instruction MOV AL, [BX][SI] would load al from location DS:1079h.

7. Relative Based Indexed Addressing Mode: In relative based indexed addressing mode the effective address is obtained by adding the contents of the base Register, Index Register and 8/16 bit displacement.
EA = {[BX] or [BP] } +{[SI] or [DI]} + { 8 bit sign extended or 16 bit displacement}.

Example:

MOV AL, disp[BX][SI] MOV AL, disp[BX + DI] MOV AL, [BP + SI + disp]
MOV AL, [BP][DI][disp] ADD DL, [BX+SI+3]

The effective address is formed by adding the contents of these registers ie BP, BX, SI, DI and displacement

Branch Related Addressing Modes:

Addressing modes of 8086 ppt

These type of addressing are related to whether the addressing is within the same segment or to a different segment. Accordingly the addressing modes in this category are known as intrasegment and intersegment with direct or indirect addressing. These are explained below:

    1. Intrasegment Direct Addressing Mode:

Addressing Modes Of 8086 Ppt

The effective address is the sum of the IP and 8 / 16 bit displacement. It leads to a short jump if displacement is 8 bit, and this addressing may be used conditional or unconditional in a program.

2. Intrasegment Indirect Addressing:

In this addressing mode the effective address may be in a register or at a memory location as accessed by any data realated addressing mode except the immediate and implied mode. This addressing mode is called only unconditionally.

    1. 3. Intersegment direct Addressing Mode:

    2. This addressing mode when used replaces the content of the CS and IP with the offset and segment part of the instruction. Used to branch from one segment to another segment.
    1. 4. Intersegment Indirect Addressing Mode:

    2. The addressing mode replaces the content of the CS and IP with the address given in a register or in memory using any of the data related addressing modes.


QUIZ

Addressing Modes Of 8086

  1. Identify the addressing mode for the following:
    1. MOV AL, 09
    2. MOV AL, ‘X’
    3. MOV AL, BL
    4. MOV AL, [SI]
    5. MOV AL, [bx][si]
    6. MOV AL, 8[BX]
    7. MOV AL, [BX+20]
    8. MOV AL, [BX+SI+50]