APPLICATION ARCHITECTURE

Table 2-1.

Principal Data Types and Instructions

Type

Size

Instructions

Integer,

8, 16,32

Move, Exchange, Translate,

Ordinal

bits

Test, Compare, Convert,

 

 

Shift, Double Shift,

 

 

Rotate, Not, Negate, And,

 

 

Or, Exclusive Or, Add,

 

 

Subtract, Multiply,

 

 

Divide, Increment,

 

 

Decrement, Convert

 

 

(M Dve with sign/ zero

 

 

extension)

Unpacked

I digit

Adjust for: Add, Subtract,

Decimal

 

Multiply, Divide

Packed

2 digits

Adjust for: Add, Subtract

Decimal

 

 

String (hyte,

0-4G bytes,

M ave, Load, Store,

word, dword) words, dwords Compare, Scan, Repeat

Bit String

1-4G bits

Test, Test and Set, Test

 

 

and Reset, Test and

 

 

Complement, Scan, Inscrt,

 

 

Extract

Near

32 bits

(Samc as Ordinal)

Pointer!

 

 

Far Pointer

48 bits

Load

I.A near pointer is a 32-bit offset into a segment defined by one of the segment/descriptor register pairs. A far pointer is a full logical addess, that is, a selector and an offset.

Figure 2-7 shows how exam pies of the basic data types are stored in memory, Multibyte items can be located at any byte address. Depending on the bus design, additional bus cycles may be required to access an operand located at an address that is not a multiple of its size. Therefore, for best performance independent of bus design, most programs align word operands on word bound- aries, dword operands on doubleword bound- aries, and so on.

2.3.2Numeric Coprocessor Data

Types

An 80287 or 80387 Numeric Coprocessor supple- ments the 80386 with the data types and instruc- tions shown in Table 2-2. Most numeric applica- tions store input values and output results in the integer, real, or packed decimal types and reserve

the temporary real type for intermediate values, where its extended range and precision minimize rounding, underflow, and overflow problems in complex computations. In accordance with this model, a numeric coprocessor performs most computations on temporary real values stored in its registers. Loading any type into the register stack automatically converts the type to tempo- rary real. A temporary real value in a register can be converted to any other type by a Store instruction.

Table 2-2. Principal Numeric Coprocessor

Data Types and Instructions

Type

Size

Instructions

Integer

16,32,

Load, Store, Compare,

 

64 bits

Add, Subtract, Multiply,

 

 

Divide

Packed

18 digits

Load, Store

Decimal

 

 

Real

32,64 bits

Load, Store, Compare,

 

 

Add, Subtract, Multiply,

 

 

Divide

Temporary

80 bits

Add, Subtract, Multiply,

Real

 

Divide, Square Root, Scale

 

 

Remainder, Integer Part,

 

 

Change, Sign, Absolute

 

 

Value, Extract Exponent

 

 

and Significand, Compare,

 

 

Examine, Test, Exchange

 

 

Tangent, Arctangent, 2'-1,

 

 

y* Log2 (X + 1), y* Log2

 

 

(X), Load Constant (0.0,

 

 

pi, etc.) (80387 adds Sine,

 

 

Cosine, Sine and Cosine,

 

 

Unordered Compare)

Figure 2-8 shows how numeric data types are stored in memory.

2.3.3 Other Instructions

Not all 80386 instructions are associated with data types. The following paragraphs survey the untyped instructions.

2.3.3.1 Stack Instructions

An 80386 stack is a stack of dwords whose base and top are defined by the SS and ESP

2-7

Page 20
Image 20
Intel 80386 manual Numeric Coprocessor Data Types, Other Instructions, Stack Instructions