8086 Addressing Modes 8086 Microprocessor by Ravinder Nath Rajotiya - September 30, 20200 Share on Facebook Share Send email Mail Print Print Table of Contents Toggle Addressing Modes of 8086Data related addressing modes1. 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.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.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.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].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.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]}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}.Branch Related Addressing Modes:Intrasegment Direct Addressing Mode:2. Intrasegment Indirect Addressing:3. Intersegment direct Addressing Mode: 4. Intersegment Indirect Addressing Mode: 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: Data related addressing modes : It is used for data access from /to different source and destinations. Branch related addressing modes: It is used to branch to different location within same or different segment. 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. 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: 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: Intrasegment Direct Addressing Mode: 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. 3. Intersegment direct Addressing Mode: 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. 4. Intersegment Indirect Addressing Mode: 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 Identify the addressing mode for the following: MOV AL, 09 MOV AL, ‘X’ MOV AL, BL MOV AL, [SI] MOV AL, [bx][si] MOV AL, 8[BX] MOV AL, [BX+20] MOV AL, [BX+SI+50] Share on Facebook Share Send email Mail Print Print