User's Manual

80286
BASE ARCHITECTURE
The following four modes are used for accessing complex data structures in memory (see
figure 2-13):
Based Mode. The operand
is
located within the selected segment at an offset computed
as
the
sum of the displacement and the contents of a base register (BX or
BP). Based mode
is
often used
to access the same field in different copies of a structure (often called a record). The base register
points
to
the base of the structure (hence the term "base" register), and the displacement selects
a particular field. Corresponding fields within a collection of structures can be accessed simply
by
changing the base register. (See figure
2-13,
example 1.)
Indexed Mode. The operand
is
located within the selected segment at an offset computed
as
the
sum of the displacement and the contents of an index register
(SI or DI). Indexed mode
is
often
used to access elements in a static array (e.g., an array
whose
starting location
is
fixed at transla-
tion time). The displacement locates the beginning of the array, and the value of the index register
selects one element.
Since all array elements are the same length, simple arithmetic
on
the index
register
will
select any element. (See figure 2-13, example 2.)
Based Indexed Mode. The operand
is
located within the selected segment at an offset computed
asthe
sum of the base register's contents and an index register's contents. Based Indexed mode
is
often used to access elements of a dynamic array (i.e., an array
whose
base address can change
during execution). The base register points to the base of the array, and the value of the index
register
is
used to select one element. (See figure
2-13,
example
3.)
Based Indexed Mode with Displacement. The operand
is
located with the selected segment at an
offset computed
as
the sum of a base register's contents, an index register's contents, and the
displacement. This mode
is
often used
to
access elements of an array within a structure. For
example, the structure could be an activation record (i.e., a region of the stack containing the
register contents, parameters, and variables associated with one instance of a procedure); and one
variable could be an array. The base register points to the start of the activation record, the
displacement expresses the distance from the start of the record
to
the beginning of the array
variable, and the index register selects a particular element of the array.
(See figure 2-13,
example 4.)
Table
2-3
gives a summary of all memory operand addressing options.
2.5
INPUT/OUTPUT
The 80286 allows input/output
to
be performed
in
either of
two
ways:
by
means of a separate
I/0
address space (using specific
I/O
instructions) or
by
means of memory-mapped
I/O
(using general-
purpose operand manipulation instructions).
Table 2-3. Memory Operand A'ddressing Modes
Addressing Mode
Offset
Calculation
Direct 16-bit Displacement in the instruction
Register
Indirect BX,
51,
01
Based
(BX
or
BP) + Displacement"
Indexed
(51
or
01)
+ Displacement"
Based Indexed (BX
or
BP) +
(51
or
01)
Based Indexed + Displacement (BX
or
BP) +
(SI
or
01)
+ Displacement"
"
The displacement can be a
0,
8
or
16-bit value.
2-21