addressing modes ppt

24
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

Upload: nikitasingla

Post on 21-Nov-2014

319 views

Category:

Documents


11 download

TRANSCRIPT

Page 1: Addressing Modes Ppt

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

Page 2: Addressing Modes Ppt

Register Operand AddressingMOV AX, BXImmediate Operand Addressing ModeMOV AL,15hMemory Addressing ModesOne must calculate the PA (physical address)

Page 3: Addressing Modes Ppt

Register Operand Addressing

MOV AX, BX

C38B16

Before execution

Page 4: Addressing Modes Ppt

After execution

Page 5: Addressing Modes Ppt

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

Page 6: Addressing Modes Ppt

MOV AL, 15H15B016

Page 7: Addressing Modes Ppt
Page 8: Addressing Modes Ppt

Direct Addressing ModeMOV CX, [1234h]12340E8B16

Page 9: Addressing Modes Ppt
Page 10: Addressing Modes Ppt

Register Indirect Addressing ModeMOV AX, [SI] 048B16

Page 11: Addressing Modes Ppt
Page 12: Addressing Modes Ppt

Based Addressing Mode• MOV CX,[BX]+10 PA = (DS)0 + (BX) + 10

• MOV AL,[BP]+5 PA = (SS)0 + (BP) + 5

Page 13: Addressing Modes Ppt

MOV [BX]+1234H,AL1234878816

Page 14: Addressing Modes Ppt
Page 15: Addressing Modes Ppt

Indexed Addressing Mode• MOV DX,[SI]+5 PA= (DS) 0 + (SI) + 5

• MOV CL,[DI]+20 PA= (DS) 0 + DI + 20

Page 16: Addressing Modes Ppt

MOV AL, [SI] +1234H1234848A16

Page 17: Addressing Modes Ppt
Page 18: Addressing Modes Ppt

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

Page 19: Addressing Modes Ppt
Page 20: Addressing Modes Ppt

Example: Based-Indexed Addressing ModesMOV AH, [BX][SI] +1234H1234A08A16

Page 21: Addressing Modes Ppt
Page 22: Addressing Modes Ppt

Segment Override

Page 23: Addressing Modes Ppt

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]

Page 24: Addressing Modes Ppt

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