50179405-8086-Addressing-mode-final

50179405-8086-Addressing-mode-final - Sushila soni Lecturer...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Sushila soni Lecturer ET & T Addressing Mode: Operand may accessible from Accumulator, GRP, and Memory hence Where is operand available? How to access it, by instruction? Determine through addressing mode. Instruction is of two type 1. sequential control instructions (data transfer ,arithmetic, logical, processer control) 2. Control transfer instruction (Branch ,CALL, RET, JUMP) Hence as according to instruction addressing mode is of two types For sequential control transfer there are 8 addressing mode 1. Register addressing mode 2. Immediate addressing mode Following 6 are used to access operand from memory Note: for the memory addressing mode has to calculate PHYSICAL address because memory is of 20 bit where physical addressed= segment adds*10H+offset add, | Where element of offset address are a. Displacement: it is 8 /16 bit immediate value given in instruction b. Base: it is the content of the base register, BX or BP c. Index: it is the content of the Index register, SI or DI 3. 4. 5. 6. 7. 8. Direct addressing mode or Displacement only addressing mode. Register Indirect addressing mode Based addressing mode Index addressing mode Based Index addressing mode Based Index with displacement addressing mode (or relative based index addressing mode) For control transfer instruction 1. Inter segment addressing mode a. Direct inter segment addressing mode b. Indirect inter segment addressing mode 2. Intra segment addressing mode a. Direct intra segment addressing mode b. Indirect intra segment addressing mode Register addressing mode Instruction: mov destination, source MOV ax, bx; Copies the value from BX into AX MOV dl, al; Copies the value from AL into DL MOV si, dx; Copies the value from DX into SI MOV sp, bp; Copies the value from BP into SP MOV DH, cl; Copies the value from CL into DH KITE Page 1 Sushila soni MOV MOV MOV Lecturer ET & T ax, ax; Yes, this is legal! ax, cs; segment register can also used for data transfer ds, ax NOTE: there are two limitations to use segment register in mov instruction a. CS cannot use as destination operand. b. Only one of the operands can be a segment register. Immediate Addressing mode In this addressing mode immediate data (8bit /16 bit) is the part of the instruction. MOV AX, 0050H MOV AL, 23H MOV [Offset address], Data MOV [0400H], 5238H; this instruction will move 38H into 0400H and 52H into 0401H Direct addressing mode or Displacement only addressing mode. In this addressing mode offset address is given in instruction directly. 1. MOV AL, [8088H]; move the content of 8088h offset address into AL register 2. MOV [1234H], DL: move the content of DL into 1234h 3. MOV AX, [1234H]; move the content 1234h into AL and content of 1235h into AH register. Default segment register for this addressing mode is ´DSµ Register indirect addressing mode In this addressing mode you can access memory indirectly through the register MOV AL, [BX] MOV AL, [SI] MOV AL, [BP] MOV AL, [DI] [BX], [SI], [DI] addressing mode use DS as a default segment register, and [BP] use SS as a default segment register, if programmer want to use another segment register then it is possible through segment override prefix symbol, as given below they both work identically. MOV AL, CS: [BX] MOV AL, SS: [SI] MOV AL, DS: [BP] MOV AL, ES: [BI] KITE Page 2 Sushila soni Lecturer ET & T Base addressing mode In this mode, offset address is the sum of the content of base register (BX/BP) and 8/16 bit displacement (offset address= [BX/BP + 8/16 bit displacement]) MOV AL, disp [BX], if BX = 1000h, and MOV AL, 20[BX], then AL load from DS: 1020h MOV AL, disp [BP], if BP = 2020h, and MOV AL, 1000[BP], then AL load from SS: 3020h Default segment register for BX is ´DSµ, and for BP ´SSµ, and if you want to change default segment then it is possible through segment override prefix symbol. Likewise MOV AL, SS: disp [BX] MOV AL, DS: disp [BP] Index addressing mode: In this mode, offset address is the sum of the content of index register (SI/DI) and 8/16 bit displacement (offset address= [SI/DI + 8/16 bit displacement]) MOV AL, disp [SI] MOV AL, disp [DI] Default segment register is ´DSµ Based Index addressing mode: In this addressing mode offset address is the sum of Base register (BX/BP) and index register (SI/DI) MOV AL, [BX][SI] MOV AL, [BX][DI] MOV AL, [BP][SI] MOV AL, [BP][DI] KITE Page 3 Sushila soni Lecturer ET & T If BX = 1000h, Si = 800h then AL load from location DS:1800h Default segment register for [BX], [Si], [DI] is ´DSµ and for [BP] ´SSµ Based Index with displacement addressing mode In this addressing mode offset address is the sum of base register, index register, 8/16 bit displacement MOV AL, disp [BX + SI] MOV AL, disp [BX + DI] MOV AL, disp [BP + SI] MOV AL, disp [BP + SI] Addressing mode for control transfer instruction: Inter segment addressing mode: If the address where the control is to be transfer lies in different segment rather than current one, the mode is called intersegment address. Intersegment direct addressing mode: In this addressing mode where the control is to be transfer given directly, hence CS and IP of destination address are specified directly. JMP 5000H: 2000H; jump to offset address 2000h in segment 5000h. Intersegment direct addressing mode: KITE Page 4 Sushila soni KITE Lecturer ET & T Page 5 ...
View Full Document

Ask a homework question - tutors are online