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

  1. /*
  2.  *    getstate -- update video state structure
  3.  */
  4.  
  5. #include <dos.h>
  6. #include <local\std.h>
  7. #include <local\bioslib.h>
  8.  
  9. /* current video state/mode information */
  10. short Vmode;
  11. short Vwidth;
  12. short Vpage;
  13.  
  14. /*
  15.  *    video tables -- these tables of video parameters use
  16.  *    a value of -1 to indicate that an item is not supported
  17.  *    and 0 to indicate that an item has a variable value.
  18.  */
  19.  
  20. /* video limit tables */
  21. short Maxrow[] = { 
  22.     /* CGA modes */
  23.     25, 25, 25, 25, 25, 25, 25,
  24.     /* MDA mode */
  25.     25,
  26.     /* PCjr modes */
  27.     25, 25, 25,
  28.     /* not used */
  29.     -1, -1,
  30.     /* EGA modes */
  31.     25, 25, 25, 25, 43
  32. };
  33.  
  34. short Maxcol[] = {
  35.     /* CGA modes */
  36.     40, 40, 80, 80, 40, 40, 80,
  37.     /* MDA mode */
  38.     80,
  39.     /* PCjr modes */
  40.     -1, 40, 80,
  41.     /* not used */
  42.     -1, -1,
  43.     /* EGA modes */
  44.     80, 80, 80, 80
  45. };
  46.  
  47. short Maxpage[] = {
  48.     /* CGA modes */
  49.     8, 8, 4, 4, 1, 1, 1,
  50.     /* MDA mode */
  51.     1,
  52.     /* PCjr modes */
  53.     0, 0, 0,
  54.     /* not used */
  55.     -1, -1,
  56.     /* EGA modes */
  57.     8, 4, 1, 1
  58. };
  59.  
  60. int
  61. getstate()
  62. {
  63.     union REGS inregs, outregs;
  64.  
  65.     inregs.h.ah = GET_STATE;
  66.     int86(VIDEO_IO, &inregs, &outregs);
  67.  
  68.     Vmode = outregs.h.al;
  69.     Vwidth = outregs.h.ah;
  70.     Vpage = outregs.h.bh;
  71.  
  72.     return (outregs.x.cflag);
  73. }
  74.