[comp.sys.ibm.pc] Testing for a numeric coprocessor

djo7613@blake.acs.washington.edu (Dick O'Connor) (06/28/89)

Could some kind soul please email or post a program or DOS call that can
test an AT-class machine for the presence of a numeric co-processor?  I know
many applications (like PC Tools) can do it: how is it done?

"Moby" Dick O'Connor
Washington Department of Fisheries
Olympia, Washington  98504
Internet Mail: djo7613@blake.acs.washington.edu
****************************************************************************
DISCLAIMER:  I speak only for myself, not for the Department.  Here, anyway!
****************************************************************************
               So long, and thanks *from* all the fish...

kcl@hpcvlx.HP.COM (Ken C. Lo) (06/29/89)

   There is a FNINIT instruction the 80286 can execute to determine
   whether or not the 80287 is presented.

   FND_287: FNINIT                          ;initialize Numerical Processor
            FSTSW AX                        ;retrieve 80287 status word
            OR    AL,AL                     ;test low byte of 80287's
                                            ;exception flags
                                            ;if all zero,then 80287 is present
                                            ;and properly initialized
                                            ;if not all zero, then 80287 absent
            JZ    GOT_287                   ;branch if 80287 present

            SMSW  AX                        ;No Numerical Processor
            OR    04H                       ;set EM bit in machine status
                                            ;word
            LMSW  AX                        ;enable software emulation of 80287


   GOT_287  SMSW  AX                        ;Numerical processor present
            OR 02H                          ;set MP bit in machine status word
            LMSW  AX                        ;permit normal 80287 operation