Intel 80286 Computer Accessories User Manual


 
SYSTEM-LEVEL NUMERIC PROGRAMMING
8086/87/88/186
MACRO
ASSEMBLER
Test
for
presence
of
8 Nuner;cs Chip, Revision
1.0
PAGE
DOS
3.20 (033·N) 8086/87/88/186
MACRO
ASSEMBLER
V2.0
ASSEMBLY
OF
MOOULE
TEST_NPX
OBJECT
MOOULE
PLACEO
IN
FINDNPX.OBJ
LOC
OBJ
0000
(100
1??7
)
00C8
?171
0000
0000
0000
0000
0000
900BE3
0003
BEOOOO
0006
C7045A5A
OOOA
90003C
0000
803COO
0010
752A
0015
8804
0017
253Fl0
001A
303FOO
0010
751D
001F
9809E8
0022
9B09EE
0025
9BOEF9
0028
9B09CO
0028
9BD9EO
DD2E
9BDED9
0031
9BD03C
OD34
8B04
0036
9E
0037
7406
LINE
SOURCE
1
+1
Stitle('Test
for
presence of a Nuner;cs Chip, Revision
1.0
1
)
2
3
name
Test_NPX
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
stack
segment
stack
I
stack
I
dw
100
dup
(1)
sst
dw
stack
ends
data
segment
publ
ie
'datal
t"""
dw
Oh
data
ends
dsroup
group
data,
stack
cgroup group
code
code
segment
publ
ic
'code'
assune
cs:cgroup,
ds:dgroup
start:
Look
for
an
8087. 80287.
or
80387
NPX.
Note
that
we
cannot execute
\lA1T
on
8086/88
if
no
8087
is
present.
test_npx:
tninit
; Must
use
non-wait
form
moy
si
,offset
dgroup:tefl1J
mov
word
ptr
[si]
,SASAH
;
Initial
ize
tenp
to
non-zero
value
fnstsw
[si]
; Must use
non-wait
form
of
fstsw
It
is
not necessary
to
-use a
WAIT
instruction
after
fnstsw or fnstew. 00
not
use one here.
cnp
byte
ptr
[si]
,0
; See
if
correct
status
with zeroes
was
read
jne
no_npx
;
JUTp
if
not a val
id
status
word, meaning
no
NPX
Now
see
if
ones can
be
correctly
written
from
the
control
word.
fnstcw
[si]
; Look
at
the
control
word; do not use \iAIT
form
;
Do
not use a \iAIT
instruction
here!
moy
ax,
[si]
; See
if
ones can
be
written
by
NPX
and
aX,10lfh ; See
if
selected
parts
of
control
word
look
OK
c""
aX,lfh
i
Check
that
ones and zeroes were
correct
l y read
jne
no_npx ; Jurp
if
no
NPX
;s
installed
Some
rn.merics
chip
h
installed.
NPX
instructions
and \iAIT
are
now
safe.
See
if
the
NPX·
is
an 8087, 80287,
or
80387.
This code
is
necessary
if
a denormal
exception
handler
is
used
or
the
new
80387
instructions
wi
II
be
used.
fldl
fld.
fdiv
fld
fchs
fconw
fstSN
IIIOY
sahf
je
st
[si]
ax,
[sf]
fOAJnd_87
_287
;
Must
use
default
control
word
from
fNINIT
;
form
infinity
; 8087/287
says
+fnf
II
inf
;
Form
negative
Infinity
; 80387 says +Inf
<>
inf
i See
if
they
are
the
same and
remove
them
i Look
at
status
from
FCOMPP
See
if
the
infinities
matched
;
J"",
if
8087/287
is
present
Figure 3-1.
Software
Routine
to
Recognize the
80287
3-3