7 8086 Addressing Mode
7 8086 Addressing Mode
7 8086 Addressing Mode
fmfernando
MOV AL, DL
MOV BH, BL
MOV AX, DX
MOV AL, 76
MOV AX, 89E3
MOV [1234], AX
MOV BL, [4456]
BX=0000
CX=0000
ES= . . . .
-a
XXXX:0100 mov al,dl
XXXX:0102
u 100 101
XXXX:0100 88D0
MOV
DX=0000
NV
UP
SP= . . . . . .
EI PL NZ NA
DX=0000
NV
UP
SP= . . . . . .
EI PL NZ NA
DX=00F3
NV
UP
SP= . . . . . .
EI PL NZ NA
DX=00F3
NV
UP
SP= . . . . . .
EI PL NZ NA
AL,DL
-r
AX=0000
BX=0000
CX=0000
DS= ...
ES= . . . .
XXXX:0100 88D0
MOV
AL,DL
-rdx
DX 0000
:00f3
-r
AX=0000
DS= ...
BX=0000
CX=0000
ES= . . . .
XXXX:0100 88D0
-t
AX=00F3
DS= ...
MOV
AL,DL
BX=0000
CX=0000
ES= . . . .
XXXX:0102 . . . . .
-q
C>
fmfernando
3. Immediate Addressing: is a mode in which the number or data to be operated on or moved is in the
memory location immediately following the instruction op code. For example, the instruction MOV
AL,37 would place the hex number 37 in the AL register.
4. Direct Addressing: uses an op code followed by a 1- or 2-byte memory address where the data which
is to be used can be found. The data is outside the P itself, in one of the many thousands of RAM
address. Direct addressing in Intel-based P make used of paging concept or memory segmentation
since this mode of addressing uses not only the address specified in the instruction but also the address
in one of the segment registers. In case of the MOV instruction, the data segment (DS) register is used
as follows:
For the command
MOV DL, [0100]
and assuming DS contains 0723, the effective RAM address would be calculated
07230
+ 0100
07330
DS (shifted left)
address specified in the operand [0100]
effective address
5. Program Direct Addressing: it is simply direct addressing used for a different purpose. For example,
JMP and CALL instructions direct the flow of the program. They are not used to manipulate data.
In summary,
NOP
Implied addressing
MOV BX,CX
Register addressing
MOV AL, 37
Immediate addressing
MOV BL,[0100]
JMP 100
fmfernando
-g 012B
6. If the IP is 0100H and executes it with a g command only without the starting and ending addresses,
all registers and flags will return to their previous state prior to running this program. This is a major
disadvantage of go command and to overcome this, use a breakpoint like
-g =0100 012B
7. While tracing the command execution, watch out for INTerrupt calls (i.e. INT 20 or INT 21), use the
proceed command p instead. INT 20 is use to stop program execution. INT 21 also terminates
program only if the AH register contains 00H.
8. End program run or quit from DEBUG and go back to DOS prompt by entering q at DEBUG prompt.
MOV BX,CX
MOV AL, FF
MOV BL,[0100]
JMP 126
NOP
Memory Segmentation
The 8-bit microprocessors may use 16-bit addresses, hence, that gives a range from 0000h to FFFFh (up to
64Kb). Notice that the addresses use 4 hex digits. The 3 right-most digits express which bits is being
referred to. The 2 left-most digits express which memory page the bytes are in. There are 256 bytes per
page and 256 pages from 0000h to FFFFh. The 8086/8088 chips use a large 20-bit address instead of the
16-bit address used by the 8-bit chips. 20 bits is 5 hex digits from 00000h to FFFFFh (in decimal, this is up
to 1,048,575 addresses or 1MB) memory locations.
A segment is a 64K block of memory, thus there could be as many as 16 overlapping segments in 1MB of
memory. For example, in direct addressing instruction:
MOV DL, [0100]
assuming DS contained 2000h, the address would be calculated in the following manner:
20000h DS register shifted LEFT 1 bit
+ 0100h
20100h effective addressing
memory page
So, the MOV DL,[0100] instruction places a copy of the data found in memory address 20100h and not
0100h, in the DL register.
We generally, won't be concerned with segment registers for simple and very small program codes, since
all segment registers will be the same, so the offset (the address of the IP) will be all we must pay attention
for now.
fmfernando
LESSON CHECK-UP:
1. What is the DOS utility program which are used to do assembly, disassembly, running, and debugging of
8086/8088 assembly-language programs?
2. What 3 areas can serve as a source for the MOV command?
3. What are the 2 areas which can serve as destinations for the MOV instruction?
4. Which area cannot be both a source and a destination at the same time?
5. What is the source of a MOV AL,DL instruction?
6. What is the destination of a MOV AL,76 code?
7. Does the command MOV BX,[4455] transfer the hex 4455 or the contents of RAM address 4455 to
register BX?
8. What does the DEBUG command r stand for and what does it do?
9. What does the DEBUG command a stand for and what does it do?
10. What does the DEBUG command u stand for and what does it do?
11. What does the DEBUG trace command do?
12. What is the DEBUG quit command?
13. Using DEBUG, write an assembly program which will
a. place the number 89H into the low byte of the base register, then
b. copy the contents of the base register into the data register and the into RAM address 333H
(Note: use DEBUGs trace command to verify the above data transfer.)