Addressing Mode
Addressing Mode
1-Register mode
EX: mov AL,DH it mean copy the content of DH which is 1 byte to AL .
in other words [AL=DH]
EX: mov CX,AX it mean copy the content of BX which is 2 byte to AX .
in other words [CX=AX]
EX : mov CX,CS it mean copy the content of CS which is 2 byte to CX.
in other words [CX=CS]
DS:3009 4E
3008 77
3007 6A
3006 5B
3005 2B
3004 F5
3003 67
3002 03
3001 CD
3000 80
EX:
mov CX,6A5B
Mov [3006],CX
Note: use only BX or BP to address memory but not in the same time
EX:mov DL,[BX+6] it means copies byte from DS:BX+6
EX:mov DL,6[BX]
EX:mov DL,[BX]+6
All of them have the same meaning
EX:mov 4[BP],CX
It means copies the content of 16-bit register CX to stack segment
memory with offset BP+4
EXAMPLE
An instruction get executed mov AL,9[BX] if DS=6000h and BX=4000H
find the effective address of the byte that will copied to AL
Solution: effective address is the same like physical address
Effective address =DS*10h+ offset 6000*10+9+4000
Effective address =60000+9+4000=64009h
Note: also use only DI or SI to address memory but not in the same
time
Mov AL,[Index register SI or DI+ displacement]
EX:mov AL,[SI+8]
ALDS:SI+8
EX:mov [DI+3],BX
BLDS:DI+3
BHDS:DI+4
Mov AL,5[SI+BX]
ALDS:SI+BX+5
Illegal instructions for Based indexed relative addressing mode
Solution:
Effective address =SS*10h+DI+4+BP
Effective address =8000h*10h+400h+2000h+4
Effective address =80000+2404h
Effective address =82404h the effective address of for CL
82405 the effective address of for CH
Common Questions in the exams:
1. What is the addressing mode of each of the following instructions:
a-mov [400],DL
b-mov [DI+BX+2],AH
a-mov AL,BX
b-mov DL,3[BX+SI+DI]