Professional Documents
Culture Documents
L05
8086 Addressing Modes
CS 01000
0002
________
01002
CS:IP 0100:0002
Other examples:
MOV AX, 2550h
MOV CX, 625
MOV BL, 40h
Immediate Addressing Mode
Immediate Addressing Mode
Example for Immediate Addressing
.model small
.stack 0100h
.code
main proc
MOV AL,15h
main endp
end main
Examples:
MOV DL, [2400h]
or
.model small
.stack 0100h
.code
main proc
MOV AL, 99h
MOV [DS:3518h],AL
main endp
end main
Example for Direct Addressing Mode
Register Indirect Addressing Mode
Register Indirect Addressing Mode
Transfer a byte or word between a register and a memory
location addressed by an index or base register.
Example:
MOV AL, [SI]
Here SI is index register and the symbol [ ] always refer to an
address.
The effective address (EA) is stored either in a pointer
register or an index register.
The pointer register can be either base register BX or base
pointer register BP.
The index register can be source index register SI, or
destination index register DI.
The default segment is DS.
Register Indirect Addressing Mode
Example: MOV AX, [SI]
Value stored in the SI register is used as the offset address
The segment register is DS in this example. Meaning of the
above is to move the data stored in the memory location DS
+ SI to the AX register
In register indirect addressing mode, the EA (effective
address) is a variable and depends on the index, or base
register value
Example: MOV [BX], CL
Which segment register will be used for the above
operation?
Examples:
MOV CL, [SI]
MOV [DI], AH
MOV [SI], AX
Example for Register Indirect Addressing
Address Content
(in hex) (in hex) According to the memory map, the
… … result of the operation
01237 XX
01236 XX MOV [BX], CL
01235 XX
can be found as follows:
01234 XX
01233 88 If CL = 88h, BX = 1233h and DS = 0000h
01232 XX then the physical address will be
01231 XX
… … DS shifted left by 1 hex digit (=“0”) + BX =
01233h
Memory map
Example for Register Indirect Addressing
.model small
.stack 0100h
.code
main proc
MOV SI,1234h
MOV AX,[SI]
main endp
end main
Example for Register Indirect Addressing
Register Indirect Addressing Mode
Another Example
Based Relative Addressing Mode
Based Relative Addressing Mode
Example for Based Relative Addressing
.model small
.stack 0100h
.code
main proc
MOV CX,[BX]+10
MOV AL,[BP]+5
main endp
end main
Indexed Relative Addressing Mode
Index Relative Addressing Mode
;PA = DS (sl) + SI + 5
;PA = DS (sl) + DI + 20
Indexed Relative Addressing Mode
DS:SI
02000
2000
1234
05234h
Based Indexed Relative Addressing
Mode
Based Indexed Addressing Mode
Summary of Addressing Modes