PROGRAMMING NUMERIC APPLICATIONS

and SET$REAL$MODE procedures as well as arithmetic expressions. SAVE$REAL$STATUS saves the 80287 state (registers, status, and control words, etc.) on the CPU's stack. RESTORE$REAL$STATUS reloads the state information; the preempting task must invoke this procedure before terminating in order to restore the 80287 to its state at the time the running task was preempted. This enables the preempted task to resume execution from the point of its preemption.

ASM286

The ASM286 assembly language provides programmmers with complete access to all of the facilities of the 80286 and 80287 processors.

The programmer's view of the 80286/80287 hardware is a single machine with these resources:

160instructions

12data types

8 general registers

4 segment registers

8 floating-point registers, organized as a stack

DEFINING DATA

The ASM286 directives shown in table 2-16 allocate storage for 80287 variables and constants. As with other storage allocation directives, the assembler associates a type with any variable defined with these directives. The type value is equal to the length of the storage unit in bytes (10 for DT, 8 for DQ, etc.). The assembler checks the type of any variable coded in an instruction to be certain that it is compatible with the instruction. For example, the coding FIADD ALPHA will be flagged as an error if ALPHA's type is not 2 or 4, because.integer addition is only available for word and short integer data types. The operand's type also tells the assembler which machine instruction to produce; although to the programmer there is only an FIADD instruction, a different machine instruction is required for each operand type.

On occasion it is desirable to use an instruction with an operand that has no declared type. For example, if register BX points to a short integer variable, a programmer may want to code FIADD [BX]. This can be done by informing the assembler of the operand's type in the instruction, coding FIADD DWORD PTR [BX]. The corresponding overrides for the other storage allocations are WORD PTR, QWORD PTR, and TBYTE PTR.

Directive

Interpretation

Data Types

DW

Define Word

Word integer

DD

Define Doubleword

Short integer, short real

DQ

Define Quadword

Long integer, long real

DT

Define Tenbyte

Packed decimal, temporary real

2-40

Page 432
Image 432
Intel 80287, 80286 manual ASM286, Interpretation Data Types