Intel iAPX 86/88 User Manual page 34

Table of Contents

Advertisement

8086/8088 CPU
modes greatly extend the flexibility and convenience of
the instruction set. The following paragraphs briefly de-
scribe the register and immediate modes of operand ad-
dressing, and then provide a detailed description of the
memory and I/O addressing modes.
Register and Immediate Operands
Instructions that specify only register operands are gener-
ally the most compact and fastest executing of the operand
addressing forms. This is because the register operand
addresses are encoded in instructions in just a few bits,
and because these operands are performed entirely within
the CPU (no bus cycles are run). Registers may serve as
source operands, destination operands, or both.
Immediate operands are constant data contained in an in-
struction. The data may be either 8 or 16 bits in length.
Immediate operands can be accessed quickly because they
are available directly from the instruction queue. Like the
register operand, no bus cycles need to be run to obtain an
immediate operand. The limitations on immediate oper-
ands are that they may only serve as source operands and
that they are constant value
i
Memory Addressing Modes
Although the EU has direct access to register and immedi-
ate operands, memory operands must be transferred to
and from the CPU over the bus. When the EU needs to
read or write a memory operand, it must pass an offset
value to the BIU. The BIU adds the offset to the (shifted)
content of a segment register producing a 20
C
bit physical
.address and then executes the bus cycle or cycles. needed
to access the operand.
a. The Effective Address
The offset that the EU calculates for a memory operand is
called the operand's effective address or EA. This address
is an unsigned l6-bit number that expresses the operand's
distance in bytes from the beginning of the segment in
which it resides. The EU can calculate the effective ad-
dress in several different ways. Information encoded in
the second byte of the instruction tells the EU how to cal-
culate the effective address of each memory operand. A
compiler or assembler derives this information from the
statement or instruction written by the programmer. As-
sembly language programmers have access to all address-
ing modes.
The EU calculates the EA by summing a displacement,
the content of a base register and the content of an index
register (see Figure 1-17). Any combination of these
three components may be present in a given instruction.
This allows a variety of memory addressing modes.
1-18
The displacement element is an 8-or 16-bit number that is
contained in the instruction. The displacement generally
is derived from the position oftheoperand name (a varia-
ble or label) in the program. The programmer can also
modify this value or explicitly specify the displacement.
A programmer may specify that either BX or BP is to
serve as a base register whose content is to be used in the
EA computation.
Similarly, either SI or DI may be specified as the index
register. The displacement value is a constant. The con-
tents of the base and index registers may change during
execution. This allows one instruction to access different
memory locations as determined by the current values in
the base and/or index registers. Effective address calcula-
tions with the BP are made using the SS register, by de-
fault, Although either the DS or the ES registers may be
specified instead.
b. Direct Addressing
Direct addressing is the simplest memory addressing
mode (see Figure 1-18). No registers are involved and the
EA is taken directly from the displacement of the instruc-
tion. Direct addressing is typically to access simple varia-
bles (scalars).
c. Register Indirect Addressing
The effective address of a memory operand may be.taken
directly from one of the base or index registers (see Fig-
ure 1-19). One instruction can operate on many different
memory locations if the value in the base or index register
is updated appropriately. Any 16-bit general register may
be used for register indirect addressing with the JMP or
CALL instructions.
d. Based Addressing
In based addressing (see Figure 1-20), the effective ad-
dress is the sum of a displacement value and the content of
register BX or BP. Specifying register BP as a base regis-
ter directs the BIU to obtain the operand from the current
stack segment (unless a segment override prefix is
present). This makes based addressing with BP a very
convenient way to access stack data.
Based addressing also provides a simple way to address
structures which may be located at different places in
memory (see Figure 1-21). A base register can be pointed
at the base of the structure and elements of the structure
can be addressed by their displacement from the structure
base. Different copies of the same structure can be ac-
cessed by simply changing the base register.
210912-001

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Iapx 186/188

Table of Contents