You are on page 1of 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
Register Operand Addressing
MOV AX, BX
Immediate Operand Addressing Mode
MOV AL,15h
Memory Addressing Modes
One 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, 15H
15B016
Direct Addressing Mode
MOV CX, [1234h]
12340E8B16
Register Indirect Addressing Mode
MOV 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,AL
1234878816
Indexed Addressing Mode
• MOV DX,[SI]+5 PA= (DS) 0 + (SI) + 5
• MOV CL,[DI]+20 PA= (DS) 0 + DI + 20
MOV AL, [SI] +1234H
1234848A16
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]

• However
MOV AX, [SI][DI] + displacement is illegal
Example: Based-Indexed Addressing Modes
MOV AH, [BX][SI] +1234H
1234A08A16
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]
Example
Copy the contents of a block of memory (16 bytes)
starting at location 20100H to another block of
memory starting at 20120H

MOV AX, 2000H


MOV DS, AX
MOV SI, 100h
MOV DI, 120h
MOV CX, 10h
NXTPT: MOV, AH, [SI]
MOV [DI], AH
INC SI
INC DI
DEC CX
JNZ NXTPT

You might also like