home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c329 / 2.img / EXAMPLES / EGAEXIST.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-12-14  |  1.3 KB  |  47 lines

  1. /*
  2.  * egaexist.c
  3.  * Purpose: to determine if an EGA board is present.
  4.  *
  5.  */
  6. #define    CDCGA    0            /* Color Graphics Adapter    */
  7. #define    CDMONO    1            /* Monochrome Display Adapter    */
  8. #define    CDEGA    2            /* Enhanced Graphics Adapter    */
  9. #define TRUE    1
  10. #define FALSE    0
  11.  
  12. #include        <stdio.h>
  13. #include    <dos.h>
  14.  
  15. extern        void int386_();
  16.  
  17. union REGS rg;        /* holds values of 80386 registers for */
  18.             /* use of DOS and ROM BIOS services */
  19. int    intnum;
  20. int    ega_exist_();    /* forward reference */
  21.  
  22. /* The following function returns non-zero if an
  23.  * Enhanced Graphics Adaptor or VGA is present,
  24.  * otherwise it returns 0
  25.  */
  26. int ega_exist_()
  27.  
  28. {
  29.     
  30. /* The following code uses the ROM BIOS Video Services
  31.  * Interrupt 10 hexadecimal (16 decimal), Service 12
  32.  * hexadecimal (18 decimal), Subservice 10 hexadecimal
  33.  * (16 decimal) which reports on the configuration of
  34.  * an EGA or VGA. If either video board is present, the
  35.  * value in the BH register will be 0 or 1 and the
  36.  * value in the BL register will be 0, 1, 2 or 3.
  37.  */
  38.     
  39.     rg.w.ax = 0x1200;    /* Register AH = 12 hex */
  40.     rg.w.bx = 0xff10;    /* Register BL = 10 hex */
  41.     intnum = 0x10;        /* Interrupt 10 hex (16 decimal) */
  42.     int386_(&intnum,&rg, &rg);    /* If EGA, BH=0-1 and BL=0-3 */
  43.  
  44.     return (!(rg.WRN.bx & 0xfefc)); /* If 0, it's not EGA */
  45.  
  46. }    /* end of ega_exist_ */
  47.