Accessing A Structure With Based Addressing; Indexed Addressing; Based Index Addressing - Intel iAPX 86/88 User Manual

Table of Contents

Advertisement

8086/8088 CPU
HIGH ADDRESS
DISPLACEMENT
DISPLACEMENT
cr
AGE
STATUS
cr
,.
RATE
VAe
I
SICK
DEPT
I
DIV
r
1
BASE REGISTERj
i
EMPLOYEE
[BASE REGISTER
J-,
,
Fi
I
EA
t-
I
L _____
--.J
AGE
I
STATUS
:
RATE
I
VAe
SICK
I
DePT
DIV
_-----.J
EMPLOYEE
LOW ADDRESS
Figure 1-21 Accessing A Structure
With Based Addressing
( the first element is selected if the index register contains
0). Since all array elements are the same length, simple
arithmetic on the index register may select any element.
r
I
I
I
I
I
L
Figure 1-22 Indexed Addressing
'I.
DISPLACEMENT
r-
INDEX
~GISTER
I
"
I
i
EA
t--
-------
.....
HIGH ADDRESS
ARRAY (8)
A-RRAY (7)
ARRAY (6)
ARRAY (5)
ARRAY (4)
ARRAY (3)
ARRAY (2)
ARRAY (1)
ARRAY (0)
.... lWORO .....
LOW ADDRESS
&':;':::;~=:..Il
I
I
I
t
I
--I
EA
I
I
_-------J
Figure 1-23 Accessing an Array
With Indexed Addressing
1-20
Ei~=+i
I
EA
Figure 1-24 Based Index Addressing
f. Based Index Addressing
Based index addressing generates an effective address that
is the sum of a base register, an index register and a dis-
placement (see Figure 1-24). This mode of addressing is
very flexible because two address components can be var-
ied at execution time.
Based index addressing provides a convenient way for a
procedure to address an array allocated on a stack (see
Figure 1-25). Register BP can contain the offset of a ref-
erence point on the stack, typically the top of the stack
after the procedure has saved registers and allocated local
storage. The offset of the beginning of the array from the
reference point can be expressed by a displacement value,
and the index register can be used to access individual
array elements. Arrays contained in structures and matri-
ces (two-dimensional arrays) can also be accessed with
based indexed addressing.
g. String Addressing
String instructions do not use the normal memory ad-
dressing modes to access operands. Instead, the index
registers are used implicitly (see Figure 1-26). When a
string instruction is executed, SI is assumed to point to the
first byte or word of the source string. DI is assumed to
point at the first byte or word of the destination string. In
a repeated string operation, the CPU's automatically ad-
just SI and DI to obtain subsequent bytes or words. Note
that for string instructions DS is the default segment reg-
ister to SI and ES is the default segment register for DI.
This allows string instructions to easily operate on data
located anywhere within the one megabyte address space.
1/0 Port Addressing
Any of the memory operand addressing modes may be
used to access an I/O port if the port is memory mapped,
For example, a group of terminals can be accessed as an
"array". String instructions can also be used to transfer
data to memory-mapped ports with an appropriate hard-
ware interface.
210912-001

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Iapx 186/188

Table of Contents