home *** CD-ROM | disk | FTP | other *** search
- /*
- * egaexist.c
- * Purpose: to determine if an EGA board is present.
- *
- */
- #define CDCGA 0 /* Color Graphics Adapter */
- #define CDMONO 1 /* Monochrome Display Adapter */
- #define CDEGA 2 /* Enhanced Graphics Adapter */
- #define TRUE 1
- #define FALSE 0
-
- #include <stdio.h>
- #include <dos.h>
-
- extern void int386_();
-
- union REGS rg; /* holds values of 80386 registers for */
- /* use of DOS and ROM BIOS services */
- int intnum;
- int ega_exist_(); /* forward reference */
-
- /* The following function returns non-zero if an
- * Enhanced Graphics Adaptor or VGA is present,
- * otherwise it returns 0
- */
- int ega_exist_()
-
- {
-
- /* The following code uses the ROM BIOS Video Services
- * Interrupt 10 hexadecimal (16 decimal), Service 12
- * hexadecimal (18 decimal), Subservice 10 hexadecimal
- * (16 decimal) which reports on the configuration of
- * an EGA or VGA. If either video board is present, the
- * value in the BH register will be 0 or 1 and the
- * value in the BL register will be 0, 1, 2 or 3.
- */
-
- rg.w.ax = 0x1200; /* Register AH = 12 hex */
- rg.w.bx = 0xff10; /* Register BL = 10 hex */
- intnum = 0x10; /* Interrupt 10 hex (16 decimal) */
- int386_(&intnum,&rg, &rg); /* If EGA, BH=0-1 and BL=0-3 */
-
- return (!(rg.WRN.bx & 0xfefc)); /* If 0, it's not EGA */
-
- } /* end of ega_exist_ */
-