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

  1. #include    "vogle.h"
  2.  
  3. /* 
  4.  * Note, vga can't do double buffering by page swapping...`
  5.  */
  6.  
  7. #define    V_PIX_ASPECT    1.0
  8.  
  9. static    int    old_mode;
  10. extern    unsigned    int    _buffer_segment;
  11. extern    unsigned    int    _buffer_offset;
  12.  
  13. extern    int
  14.         vega_char(),
  15.         vega_clear(),
  16.         vega_color(),
  17.         vega_draw(),
  18.         vega_setpal(),
  19.         pc_fill(),
  20.         vega_font(),
  21.         pc_getkey(),
  22.         pc_checkkey(),
  23.         pc_locator(),
  24.         vega_string(),
  25.         setmode();
  26.  
  27.  
  28. vga_init()
  29. {
  30.     old_mode = setmode(18);
  31.     vdevice.sizeX = 479 * V_PIX_ASPECT;
  32.     vdevice.sizeY = 479;
  33.     vdevice.sizeSx = 640;
  34.     vdevice.sizeSy = 479;
  35.     vdevice.depth = 4;
  36.     _buffer_segment = 0xA000;
  37.     _buffer_offset = 0;
  38.     pc_locinit(vdevice.sizeSx, vdevice.sizeSy);
  39.     zsetup();
  40.     vega_setpal();
  41.     return (1);
  42. }
  43.  
  44. /*
  45.  * vga_exit
  46.  *
  47.  *    Sets the display back to text mode.
  48.  */
  49. vga_exit()
  50. {
  51.     (void)setmode(old_mode);
  52.     return (1);
  53. }
  54.  
  55. static    int
  56. noop()
  57. {
  58.     return (-1);
  59. }
  60.  
  61. static DevEntry vgadev = {
  62.     "vga",
  63.     "large",
  64.     "small",
  65.     noop,
  66.     vega_char,
  67.     pc_checkkey,
  68.     vega_clear,
  69.     vega_color,
  70.     vega_draw,
  71.     vga_exit,
  72.     pc_fill,
  73.     vega_font,
  74.     noop,
  75.     pc_getkey,
  76.     vga_init,
  77.     pc_locator,
  78.     noop,
  79.     noop,
  80.     vega_string,
  81.     noop,
  82.     noop
  83. };
  84.  
  85. /*
  86.  * _vga_devcpy
  87.  *
  88.  *    copy the pc device into vdevice.dev.
  89.  */
  90. _vga_devcpy()
  91. {
  92.     vdevice.dev = vgadev;
  93. }
  94.  
  95.