Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!linus!decvax!cca!johnl
From: johnl@cca.UUCP
Newsgroups: net.micro.pc
Subject: Re: Detection of the Math Co-processor - (nf)
Message-ID: <422@ima.UUCP>
Date: Sun, 30-Sep-84 23:39:14 EDT
Article-I.D.: ima.422
Posted: Sun Sep 30 23:39:14 1984
Date-Received: Tue, 2-Oct-84 05:41:18 EDT
Lines: 28

#R:gitpyr:-20600:ima:12700001:000:1438
ima!johnl    Sep 30 15:05:00 1984

Just last week, I was bitten by the 8087/80287 problem.  We use Lattice C
(version 2.12) and found that Lattice programs were giving totally wrong
floating point results on an 80286-based IBM PC/AT.  Since we had bought
Lattice's library sources, I took a look to see what the problem was.

Each time it does a floating point operation, the Lattice library has two
sets of code, one that uses and 8087 or 287, and one that simulates it.
There is a little routine that checks to see if the 87 is present.  It didn't
work on a 286, because the behavior of the 80286 without a 287 is different
from that of an 8086 or 8086 without an 87.  In the absence of an 8087, the
the 8088 does nothing at all when a floating point instruction is encountered.
In the absence of an 80287, an 80286 gets garbage results from the bus.  It
was easy to change the routine in Lattice's library to work both ways,
something they say they've done in the 2.13 version that they're sending to me.
Intel's 80286 programming manual has some examples; basically you do a FINIT
to reset the float chip, and then see whether a FSTCW stores a zero.

The issue of WAIT instructions is a red herring, since FINIT and FSTCW
don't need WAITs.

I've tested this on 8088's with and without 8087 and 80286 without 80287
and verified that it works.  We haven't managed to get a 287 plugged into
an 80286, but I'd really be surprised if it didn't work.

John Levine, ima!johnl