COPROCESSOR HARDWARE INTERFACE

~B~b/67/~~/lab

MACRO ASSEMBLER

Test for presence of a Numerics Chip.

Revision 1."

PAGE 1

DOS

3.2B (B33-NlaB~b/671a6/16b

MACRO ASSEMBLER V2.B ASSEMBLY Of MODULE

TEST- NPX

 

OBJECT MODULE PLACED IN fINDNPX.oBJ

 

 

LaC

OBJ

LINE

SOURCE

 

 

+1 StitleC'Test for presence of a Numerics Chip. Revision 1.0')

nalle Test_NPX

stack segment stack ' stack'

BBBB(18B

1111 l

e9C8 1111

7

sst

 

~

stack

 

9

data

 

18

 

11

temp

 

12

data

 

13

 

 

H

dgroup

 

15

cgroup

 

lb

 

 

17

code

 

18

 

 

19

start:

 

2B

 

21

 

 

22

,

 

23

 

2~

dw

lBB dup (? l

dw ends

segment public 'data'

dw Bh

ends

group data, stack group code

segllent public 'code'

assume cs: cgroup, ds: dgroup

Look for an 8B87. 8B287. i387 SX or i387 DX NPX.

Note that we cannot execute WAIT on lIB8b/M if no 8887 is present.

BBBB

 

25

test_npx:

 

 

; nust use non"wait form

BBBB

9BDBE3

2b

fninit

 

 

BBB3

BEBBBB

27

mov

si ,offset

dgroup: terap

BBBb

C7B~5A5A

2~

mov

word ptr [sil,SASAH ; Initialize temp to non-zero value

BBBBA

9BDD3C

29

fnstsw

[sil

 

nust use non-wait form of fstsw

 

 

3B

 

 

 

It is not necessary to use a blAIT instruction

 

 

31

 

 

 

after fnstsw or fnstew. Do not use one here.

BBn

aB3CBB

32

cmp

byte ptr

[sil,"

See if correct" status with zeroes was read

BB1B

752A

33

jne

no_npx

 

Jump if not a valid status word. meaning no NPX

 

 

3~

 

 

 

 

35Naill see if ones .can be correctly written from the control word.

3b

BB12

9BD93C

37

fnstcw

[sil

Look at the control word; do not use k1AIT form

 

 

38

 

ax. [sil

»0 not use a IIIAIT instruction here!

BB15

~aB~

39

mov

See if ones can be written by NPX

BB17

253f18

~B

and

ax. 193fh

See if selected parts of control. word look OK

BB1A

3D3fBB

~l

cmp

ax.3fh

{heck that· ones and zeroes were correctly read

BBH'751D

~2

jne

no_npx

Jump if no NPX is installed

 

 

~3

 

 

 

~~Somne numerics chip is installed. NPX -instructions and. klAIT are nOIll safe.

~5 See if the NPX is an 8B~7. ~B2a7. i387 SX or i387 DX NPX

~b This code is necessary if a denormal exception handler is used or the

~7 new i367 J)X NPX instructions will be used .

. ~6

Figure 5-3.Software Routine to Reco.gnize the Coprocessor

5-7

Page 89
Image 89
Intel 386 manual Software Routine to Reco.gnize the Coprocessor