home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 12 / CD_ASCQ_12_0294.iso / vrac / pclcjs.zip / 4350EVGA.C next >
C/C++ Source or Header  |  1993-10-29  |  2KB  |  102 lines

  1. /* 43/50 line screen mode functions */
  2.  
  3. #include <dos.h>
  4.  
  5. #define CGASIZE 24     /* bottom line, CGA/normal text screen */
  6. #define EGASIZE 42     /* bottom line, EGA extended text screen */
  7. #define VGASIZE 49     /* bottom line, VGA extended text screen */
  8.  
  9. /* video adapter constants */
  10. #define MDA_CARD    0     /* monochrome display adapter */
  11. #define CGA_CARD    1     /* color graphics adapter */
  12. #define EGA_CARD    2     /* enhanced graphics adapter */
  13. #define VGA_CARD    3     /* video graphics array */
  14. #define MCGA_CARD   4     /* multi-color graphics array */
  15. #define HERC_CARD   5     /* Hercules card */
  16.  
  17. #define VIDEO() int86(0x10,®s,®s)
  18.  
  19. #define FALSE 0
  20. #define TRUE 1
  21.  
  22.  
  23.  
  24.   
  25. int ext_screen(int video_card)  /* set 43-line (EGA) or 50-line (VGA) text */
  26.  
  27. {
  28.     /* Local variables */
  29.     union REGS regs;
  30.     
  31.     int screen_size;
  32.     
  33.     switch(video_card){
  34.         case EGA_CARD: {
  35.             screen_size=EGASIZE;
  36.         }
  37.             break;
  38.         case VGA_CARD: {
  39.             screen_size=VGASIZE;
  40.         }
  41.         break;
  42.         default: {
  43.                  screen_size=CGASIZE; 
  44.             return screen_size;
  45.         }
  46.     }
  47.   
  48.     regs.x.ax=0x1112;             /* load 8x8 font */
  49.     regs.h.bl=0x00;
  50.   
  51.     VIDEO();
  52.   
  53.     regs.x.cx=0x0600;             /* set cursor size */
  54.     regs.h.ah=0x01;
  55.   
  56.     VIDEO();
  57.   
  58.     outp(0x03b4, 0x0714);         /* fix up underline */
  59.   
  60.     return screen_size;
  61.     
  62. }
  63.  
  64.  
  65.  
  66.  
  67. int normal_screen(video_card)  /* restore 25-line text */
  68.  
  69. {
  70.     /* Local variables */
  71.     union REGS regs;
  72.     
  73.     int screen_size;
  74.  
  75.     if(video_card!=MDA_CARD){         /* if not in monochrome mode */
  76.         regs.x.ax=0x0003;
  77.         VIDEO();
  78.     }
  79.   
  80.     screen_size=CGASIZE;
  81.   
  82.     return screen_size;
  83.     
  84. }
  85.  
  86.  
  87.  
  88.  
  89. int screen_lines()  /* Read current screen line setting */
  90.  
  91. {
  92.     /* Local variables */
  93.     int lines;
  94.     
  95.     lines=peekb(0x40,0x84);
  96.     
  97.     if (lines==0)
  98.         lines=24;
  99.     
  100.     return (lines+1);
  101. }
  102.