addressing modes ppt
TRANSCRIPT
Addressing Modes• When the 8088 executes an instruction, it
performs the specified function on data• These data, called operands,
– May be a part of the instruction– May reside in one of the internal registers – May be stored in memory
• To access these operands, 8088 is provided with various addressing modes
• An addressing mode is a method of specifying an operand
Register Operand AddressingMOV AX, BXImmediate Operand Addressing ModeMOV AL,15hMemory Addressing ModesOne must calculate the PA (physical address)
Register Operand Addressing
MOV AX, BX
C38B16
Before execution
After execution
Immediate Addressing Mode
• In immediate addressing, source operand is a constant
• Used to load information to some registers– MOV AX,2550h– MOV CX, 625 ; decimal 625– MOV BL,40h
MOV AL, 15H15B016
Direct Addressing ModeMOV CX, [1234h]12340E8B16
Register Indirect Addressing ModeMOV AX, [SI] 048B16
Based Addressing Mode• MOV CX,[BX]+10 PA = (DS)0 + (BX) + 10
• MOV AL,[BP]+5 PA = (SS)0 + (BP) + 5
MOV [BX]+1234H,AL1234878816
Indexed Addressing Mode• MOV DX,[SI]+5 PA= (DS) 0 + (SI) + 5
• MOV CL,[DI]+20 PA= (DS) 0 + DI + 20
MOV AL, [SI] +1234H1234848A16
Based Indexed Addressing Mode
• MOV CX,[BX][DI]+8h PA= (DS)0 + (BX) + (DI) + 8h
• MOV AH,[BP][SI]+29 PA: (SS)0 + (BP) + (SI) + 2
• Other notations possible– MOV AH,[BP+SI+29] or– MOV AH, [SI+BP+29]
• HoweverMOV AX, [SI][DI] + displacement is illegal
Example: Based-Indexed Addressing ModesMOV AH, [BX][SI] +1234H1234A08A16
Segment Override
The PTR Operator
• MOV AL,[20h] ; 8 bit data copied into AL
• MOV AX,[20h] ; 16 bit data copied into AX
• INC [20h] ; 8 bit or 16 bits incremented”?
• Byte or word or doubleword?
• To clarify we use the PTR operator– INC BYTE PTR [20h]– INC WORD PTR [20h]– INC DWORD PTR [20h]
ExampleCopy the contents of a block of memory (16 bytes)
starting at location 20100H to another block of memory starting at 20120H
MOV AX, 2000HMOV DS, AXMOV SI, 100hMOV DI, 120hMOV CX, 10h
NXTPT: MOV, AH, [SI]MOV [DI], AHINC SIINC DIDEC CXJNZ NXTPT