vbdpss.hlp (Table of Contents; Topic list)
Article Q43565
                                                 Contents  Index  Back
─────────────────────────────────────────────────────────────────────────────
                           Knowledge Base Contents  Knowledge Base Index
 
 Basic Program to Detect if a Math Coprocessor Is Present - Q43565
 
 Listed below is a sample Basic program that will detect whether or not
 a particular machine has a math coprocessor installed.
 
 The program is as follows:
 
 ' To try the following example in VBDOS.EXE:
 ' 1. From the File menu, choose New Project.
 ' 2. Copy the code example to the Code window.
 ' 3. Press F5 to run the program.
 
 DECLARE SUB display ()
 '===================================================================
 ' Program MATH.BAS to detect math coprocessor, if present.
 '===================================================================
 DEFINT A-Z
 
 CALL display
 
 DEF SEG = 0
 chip = PEEK(&H410)               ' Look at second bit of 0000:0410h.
 chipthere = chip \2 AND 1       ' Equipment List Word bit.
                                 ' For math coprocessor (8087 etc.).
 IF chipthere = 1 THEN
    COLOR 2, 0
    PRINT "                       Math coprocessor present";
 ELSE
    COLOR 4, 0
    PRINT "                       No math coprocessor detected";
 END IF
 
 DO UNTIL INKEY$ <> ""            ' Wait for key then clear screen.
 LOOP
 CLS
 END
 
 SUB display
 '===================== Display Screen Control =====================
 CLS
 VIEW PRINT 25 TO 25
 COLOR 7, 1
 PRINT
 LOCATE 25, 29
 PRINT "Press any key to exit";
 VIEW PRINT 1 TO 1
 COLOR 7, 1
 PRINT
 LOCATE 1, 34
 PRINT "MATH.BAS";
 VIEW PRINT 12 TO 12
 COLOR 0, 0
 PRINT
 END SUB