SYSTEM-LEVEL NUMERIC PROGRAMMING

8086/87/88/186 MACRO ASSEMBLER

LOC OBJ

LINE

 

60

 

61

 

6Z

 

63

0039 EB0790

64

D03C

65

Test for presence of a NUIIOr;cs Chip. Rev;slon 1.0

PAGE

SOURCE

An 80387 Is present. If denormol e.cepttons are used for an 8087/Z87, they "",t be mosked. Th. 80387 will automatically normalize denormol

operands faster than an exception handler can.

j"" founct387

 

66

 

set up for no NPX

 

67

 

 

 

 

 

68

 

 

 

 

003C EB0490

69

 

j"" e.tt

 

003F

70

found_87_Z87:

 

 

71

 

.et

up for

87/Z87

 

7Z

 

 

 

 

 

73

 

 

 

 

003F EB0190

74

 

j"" exit

 

004Z

75

found 387:

 

 

 

76

-

set

up for

387

 

77

,

 

 

 

 

78

 

 

 

D04Z

79

•• tt.

 

 

 

 

80

code

end.

 

 

81

 

end

start,ds.:dgroup, •• :dgroup:8at

ASSEHBLY COMPLETE, NO ERRORS FOUND

Figure 3-1. Software Routine to Recognize the 80287 (Cont'd.)

Configuring the Numerics Environment

Once the 80286 CPU has determined the presence or absence of the 80287 NPX, the 80286 must set either the MP or the EM bit in its own machine status word accordingly. The initialization routine can either

Set the MP bit in the 80286 MSW to allow numeric instructions to be executed directly by the 80287 NPX component

Set the EM bit in the 80286 MSW to permit software emulation of the 80287 numeric instructions

The Math Present (MP) flag of the 80286 machine status word indicates to the CPU whether an 80287 NPX is physically avaiiabie in the system. The MP flag controls the function of the WAIT instruction. When executing aWAIT instruction, the 80286 tests only the Task Switched (TS) bit if MP is set; if it finds TS set under these conditions, the 'CPU traps to exception #7.

The Emulation Mode (EM) bit of the 80286 machine status word indicates to the CPU whether NPX functions are to be emulated. If the CPU finds EM set when it executes an ESC instruction, program control is automatically trapped to exception #7, giving the exception handler the opportunity to emulate the functions of an 80287. The 80286 EM flag can be changed only by using the LMSW (load machine status word) instruction (legal only at privilege ievei 0) ami examiut;d with the aid of th~ SMSW (~t0re machine status word) instruction (legal at any privilege level).

The EM bit also controls the function of the WAIT instruction. If the CPU finds EM set while ~xecut­ ing a WAIT, the CPU does not check the ERROR pin for an error indication.

For correct 80286 operation, the EM bit must never be set concurrently with MP. The EM and MP bits of the 80286 are described in more detail in the 80286 Operating System Writer's Guide. More

3-4

Page 450
Image 450
Intel 80287, 80286 manual Configuring the Numerics Environment