[net.micro.pc] "Official" 8087 presence test for IBM's

jmsellens@watmath.UUCP (John M Sellens) (09/13/85)

I got a note from IBM the other day, and figuring that it might be of
general interest, and that not everyone will have received a copy,
here is how to find out if a machine has an 80(2)87 installed:

	 int  11H
	 and ax,2
	 jz no_coprocessor

What that means is that on return from an interrupt 11H, bit 1 of the
AX register (i.e. the bit next to the low order bit) will be set if
there is a co-processor installed (and the switches are set right on
the PC/XT/portable mother board).

John

frank@sagan.UUCP (Frank Whaley) (09/18/85)

In article <16423@watmath.UUCP>, jmsellens@watmath.UUCP (John M Sellens) writes:
> I got a note from IBM the other day, and figuring that it might be of
> general interest, and that not everyone will have received a copy,
> here is how to find out if a machine has an 80(2)87 installed:
> 	 int  11H
> 	 and ax,2
> 	 jz no_coprocessor
> What that means is that on return from an interrupt 11H, bit 1 of the
> AX register (i.e. the bit next to the low order bit) will be set if
> there is a co-processor installed (and the switches are set right on
> the PC/XT/portable mother board).
> John

[ FLAME ON ]
I too have received a copy of the memo from IBM (Independent Developer
Relations) detailing a "technical note covering the determination of the
presence of a math co-processor in an IBM Personal Computer."

This "technical note" indicates that the Equipment Check Interrupt (INT 11H)
should be used.  "If bit 1 of the AX register is equal to 1 on return, a math
co-processor is installed."

Baloney.  In the fine print IBM admits that "the user must have set the
switch on the planar board properly per published instructions."  So all
the bit in question indicates is the position of the switch.

Personally, I don't care about the position of a switch.  Nor do I care
to attach "equipment determination" code to manufacturer-specific interrupt
routines.  Instead, I will continue to use the software test:

ndpcw	DW	(?)			; control word
	;
	; look for 8087 or 80287 co-processor
	;
	FNINIT				; init if there
	XOR	AH,AH			; stall for a bit
	MOV	Byte Ptr ndpcw + 1,AH	; clear initial control word value
	FNSTCW	ndpcw			; store control word
	CMP	Byte Ptr ndpcw + 1,3
	; if equal, it's there

Note that, should this routine "yield unreliable results", it is far more
likely to fail than succeed, in which case we will use software to emulate
the NDP.
[ FLAME OFF ]

-- 
frank
... Frank Whaley, MicroPro Product Development
{dual,hplabs,glacier,lll-crg}!well!micropro!sagan!frank

steve@anasazi.UUCP (Steve Villee) (09/25/85)

> > I got a note from IBM the other day, and figuring that it might be of
> > general interest, and that not everyone will have received a copy,
> > here is how to find out if a machine has an 80(2)87 installed:
> > 	 int  11H
> > 	 and ax,2
> > 	 jz no_coprocessor
> 
> Baloney.  In the fine print IBM admits that "the user must have set the
> switch on the planar board properly per published instructions."  So all
> the bit in question indicates is the position of the switch.

The situation is even more weird on the AT, as we found out.  We were
doing some benchmarks with and without the 80287.  The AT Installation and
Setup manual does not mention any switch you're supposed to set to indicate
that there is an 80287, as indeed there is no such switch on the AT.  But
we were puzzled to find that after we installed the 80287 once, thereafter
if we removed it, the int 11H test still indicated the 80287 was present!
As a result, floating point operations didn't work too well with the 80287
removed.  Apparently, IBM figures that once you install an 80287, you'll
never have any reason to take it out!

Some investigation of the BIOS startup code revealed the following.  Initially,
the equipment byte is set from CMOS RAM location 14H, and bit 1 of this byte
is supposed to indicate 80287 presence.  Later on during startup, the BIOS
performs a test (FINT/FSTCW) to try to determine whether there is an 80287.
If this test succeeds, bit 1 of the equipment byte is set on.  If the test
fails, the bit 1 of the equipment byte is left as it was in the CMOS RAM.
To me, this behavior is backwards (it should clear the bit if the test fails),
but I guess the test is designed to detect your installation of an 80287,
which it is assumed you will never back out.  Somehow, the modified equipment
byte ends up back in CMOS RAM; I haven't yet determined how this happens.

Maybe somewhere there is a documented way to uninstall an 80287 from an AT,
short of writing your own program to poke the CMOS RAM.  The Setup program
on the diagnostics diskette doesn't seem to know or care about the 80287.

--- Steve Villee (ihnp4!terak!anasazi!steve)
    International Anasazi, Inc.
    7500 North Dreamy Draw Drive, Suite 120
    Phoenix, Arizona 85020
    (602) 861-7624