Sunteți pe pagina 1din 31

8086/8088 Addressing Modes

Register Indirect Addressing


• This is often used to refer to tabular data in
the memory.
• Example: suppose you must create a table of
information that will hold 10 characters taken
from the keyboard
Program
mov bx, offset table
mov cx, 5
again:
mov ah,01
int 21h
mov [bx],al
inc bx
loop again
table
bx
Base-Plus-Index
• Major use of base-plus-index is to address
elements in an array of data
• Example:
A short program that moves array element
10H into array element 20H
Load BX with address of array
Load DI with the element number of the array to
be accessed
Mov bx, offset array
Mov di,10h
Mov al, [bx+di]
Mov di, 20h
Mov [bx+di],al
Register Relative Addressing
• Can also be used to address elements in an
array of data
Example:
A short program that moves array element
10H into array element 20H
Answer
mov di, 10h
mov al, array[di]
mov di,20h
mov array[di],al
Base relative-plus index
• can also be used to address a file that contains
multiple records
Problem :
A program that will copy element 0 of record A
(RecA) into element 2 of record C (RecC). Both
records belong to the same file pointed by
FILE.

S-ar putea să vă placă și