home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_02_12 / 2n12046a < prev    next >
Text File  |  1991-09-16  |  1KB  |  31 lines

  1. <B>[PRODUCTION: This code goes with the second
  2. sidebar. -hth]<D>
  3.  
  4. /*
  5.  * Print BIOS equipment list from "int 0x11".
  6.  * Written for Turbo C 2.0, by Bob Bybee, 9/91.
  7.  *
  8.  * Bit 1 is set if the BIOS thinks there's an 80x87
  9.  * installed, clear if not.  See any BIOS book for
  10.  * detailed descriptions of the other bits.  Not all
  11.  * BIOS versions use these bits in the same ways.
  12.  */
  13. #include <stdio.h>
  14. #include <dos.h>
  15.  
  16. void main( void )
  17.     {
  18.     union REGS regs;
  19.     unsigned int ef;    /* equipment flags */
  20.  
  21.     int86(0x11, ®s, ®s);     /* ask BIOS for it */
  22.     ef = regs.x.ax;                /* copy the AX value */
  23.  
  24.     printf("Selected BIOS equipment flags from INT 0x11:\n");
  25.     printf("    math coprocessor: %u\n", (ef >> 1) & 1);
  26.     printf("  initial video mode: %u\n", (ef >> 4) & 3);
  27.     printf("# of diskette_drives: %u\n", ((ef >> 6) & 3) + 1);
  28.     printf("      # of com ports: %u\n", (ef >> 9) & 7);
  29.     printf("      # of lpt ports: %u\n", (ef >> 14) & 3);
  30.     }
  31.