home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / prof_c / 05oslib / bios / ega_info.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-11  |  1001 b   |  41 lines

  1. /*
  2.  *    ega_info -- gather information about an EGA;
  3.  *    return a non-zero value if one is found
  4.  */
  5.  
  6. #include <dos.h>
  7. #include <local\bioslib.h>
  8.  
  9. #define EGA_INFO 0x10
  10. #define NMODES    2
  11. #define NMEMSIZ    4
  12.  
  13. int
  14. ega_info(memsize, mode, features, switches)
  15. int *memsize;        /* EGA memory size indicator: 0 = 64K */
  16.             /* 1 = 128K; 2 = 192K; 3 = 256K */
  17. int *mode;        /* 0 = color mode; 1 = mono mode */
  18.             /* use getstate function to find out which mode */
  19. unsigned int
  20.     *features,    /* feature bit settings */
  21.     *switches;    /* EGA switch settings */
  22. {
  23.     int result = 0;
  24.     union REGS inregs, outregs;
  25.  
  26.     /* request EGA information */
  27.     inregs.h.ah = ALT_FUNCTION;
  28.     inregs.h.bl = EGA_INFO;
  29.     int86(VIDEO_IO, &inregs, &outregs);
  30.  
  31.     *memsize = outregs.h.bl;
  32.     *mode = outregs.h.bh;
  33.     *features = outregs.h.ch;
  34.     *switches = outregs.h.cl;
  35.  
  36.     /* return non-zero if EGA installed */
  37.     if (*memsize >= 0 && *memsize < NMEMSIZ && *mode >= 0 && *mode < NMODES)
  38.         result = 1;
  39.     return (result);
  40. }
  41.