APPLICATION ARCHITECTURE

Any or all of the base, index, and displacement variables can be used to compute an offset. The base and index variables are the values of general registers, while the displacement value is con- tained in the instruction. Any general register can serve as a base or index register. The value in the index register can be scaled (mUltiplied) by I, 2,4, or 8, providing a direct way to refer to array or record elements of these lengths. A displace- ment value can be 8 or 32 bits long and is interpreted by the processor as a signed 2's- complement value.

The most meaningful combinations of base, index, and displacement yield the following

80386 memory addressing modes:

Based Indexed: base + index (scaled).

Based Indexed with Displacement: base + index (scaled) + displacement.

2.3Data Types and Instructions

This section describes the instructions that appli- cation programmers use most frequently. Since the majority of instructions operate on specific data types (for example, integers), types and instructions are described together. Privileged instructions, including those for performing 1/0 and handling interrupts, are covered in the next chapter.

Direct: displacement only. o Register Indirect: base only. o Based: base + displacement.

Indexed: index (scaled).

Indexed with Displacement: index (scaled) + displacement.

2.3.1 Principal Data Types

Table 2-1 shows the data types and instructions provided by the 80386. Only the most frequently used instructions are shown in Table 2-1. Also omitted are variants of instructions such as (in the case of Rotate) Rotate Left,"Rotate Right, and Rotate Through Carry Flag.

4GB # #1

b

 

SEL.

BASE

LIMIT

1# -7

"IGS: n

0

4GB

 

 

0

4GB

l~. SEGMENTS

SS:

n

 

4GB

OS:

n

 

4GB

ES:

n

0

4GB

FS:

n

 

4GB

 

SEGMENT/DESCRIPTOR REGISTERS

Figure 2-6. A 4-gigabyte Logical Address Space

2-6

Page 19
Image 19
Intel 80386 manual Data Types and Instructions, Principal Data Types