home *** CD-ROM | disk | FTP | other *** search
/ gondwana.ecr.mu.oz.au/pub/ / Graphics.tar / Graphics / VOGLE.ZIP / VOGLE / DRIVERS / IBMPC / SETMODE.C < prev    next >
C/C++ Source or Header  |  2000-02-11  |  696b  |  34 lines

  1. /*
  2.  * Sets BIOS Video modes.
  3.  *
  4.  * This file is also a convienient place to declare some Global
  5.  * variables that get used in the *.asm Routines.
  6.  */
  7.  
  8. unsigned    int    _buffer_segment = 0xA000;    /* Current buffer being drawn to */
  9. unsigned    int    _buffer_offset = 0;    /* Current buffer being drawn to */
  10. unsigned    int    _cur_mode = 3;    /* The current video mode */
  11. unsigned    int    _cur_color = 0;    /* The current color */
  12.  
  13. #include <dos.h>
  14.  
  15. union    REGS    regs;
  16.  
  17.  
  18. int
  19. setmode(mode)
  20.     int    mode;
  21. {
  22.     int    old_mode;
  23.  
  24.     _cur_mode = mode;
  25.  
  26.     regs.h.ah = 15;
  27.     int86(0x10, ®s, ®s);
  28.     old_mode = regs.h.al;
  29.     regs.h.ah = 0;
  30.     regs.h.al = mode;
  31.     int86(0x10, ®s, ®s);
  32.     return (old_mode);
  33. }
  34.