home *** CD-ROM | disk | FTP | other *** search
/ Monster Disc 2: The Best of 1992 / MONSTER2.ISO / prog / djgpp / cbgrx102.a01 / CONTRIB / LIBGRX / INCLUDE / GRDRIVER.H next >
Encoding:
C/C++ Source or Header  |  1992-08-12  |  5.2 KB  |  146 lines

  1. /**
  2.  ** This is file GRDRIVER.H
  3.  **
  4.  ** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
  5.  **
  6.  ** This file is distributed under the terms listed in the document
  7.  ** "copying.dj", available from DJ Delorie at the address above.
  8.  ** A copy of "copying.dj" should accompany this file; if not, a copy
  9.  ** should be available from where this file was obtained.  This file
  10.  ** may not be distributed without a verbatim copy of "copying.dj".
  11.  **
  12.  ** This file is distributed WITHOUT ANY WARRANTY; without even the implied
  13.  ** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14.  **/
  15.  
  16. #ifndef _GRDRIVER_H_
  17. #define _GRDRIVER_H_
  18.  
  19. #if defined(__GNUC__) && !defined(near)
  20. # define near
  21. # define far
  22. # define huge
  23. #endif
  24.  
  25. /* ================================================================== */
  26. /*              DRIVER HEADER STRUCTURES                  */
  27. /* ================================================================== */
  28.  
  29. typedef struct {
  30.     unsigned short  modeset_routine;
  31.     unsigned short  paging_routine;
  32.     unsigned short  driver_flags;
  33.     unsigned short  def_tw;
  34.     unsigned short  def_th;
  35.     unsigned short  def_gw;
  36.     unsigned short  def_gh;
  37. } OLD_GR_DRIVER;
  38.  
  39. typedef struct {
  40.     unsigned short  modeset_routine;
  41.     unsigned short  paging_routine;
  42.     unsigned short  driver_flags;
  43.     unsigned short  def_tw;
  44.     unsigned short  def_th;
  45.     unsigned short  def_gw;
  46.     unsigned short  def_gh;
  47.     unsigned short  def_numcolor;
  48.     unsigned short  driver_init_routine;
  49.     unsigned short  text_table;
  50.     unsigned short  graphics_table;
  51. } NEW_GR_DRIVER;
  52.  
  53. typedef union {
  54.     OLD_GR_DRIVER   old;
  55.     NEW_GR_DRIVER   new;
  56. } GR_DRIVER;
  57.  
  58. typedef struct {
  59.     unsigned short  width;
  60.     unsigned short  height;
  61.     unsigned short  number_of_colors;
  62.     unsigned char   BIOS_mode;
  63.     unsigned char   special;
  64. } GR_DRIVER_MODE_ENTRY;
  65.  
  66.  
  67. /* ================================================================== */
  68. /*             DRIVER FLAG BITS                  */
  69. /* ================================================================== */
  70.  
  71. #define GRD_NEW_DRIVER  0x0008        /* NEW FORMAT DRIVER IF THIS IS SET */
  72.  
  73. #define GRD_PAGING_MASK 0x0007        /* mask for paging modes */
  74. #define GRD_NO_RW    0x0000        /* one standard 64 RW paging  */
  75. #define GRD_RW_64K    0x0001        /* one 64K R + one 64K W page */
  76. /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
  77. /* THE FOLLOWING THREE OPTIONS ARE NOT SUPPORTED AT THIS TIME          */
  78. #define GRD_RW_32K    0x0002        /* two separate 32Kb RW pages */
  79. #define GRD_MAP_128K    0x0003        /* 128Kb memory map -- some Tridents
  80.                        can do it (1024x768x16 without
  81.                        paging!!!) */
  82. #define GRD_MAP_EXTMEM  0x0004        /* Can be mapped extended, above 1M.
  83.                        Some Tseng 4000-s can do it, NO
  84.                        PAGING AT ALL!!!! */
  85. /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
  86.  
  87. #define GRD_TYPE_MASK    0xf000        /* adapter type mask */
  88. #define GRD_VGA        0x0000        /* vga */
  89. #define GRD_EGA        0x1000        /* ega */
  90. #define GRD_HERC    0x2000        /* hercules */
  91. #define GRD_8514A    0x3000        /* IBM 8514A or compatible */
  92. #define GRD_S3        0x4000        /* S3 graphics accelerator */
  93.  
  94. #define GRD_PLANE_MASK  0x0f00        /* bitplane number mask */
  95. #define GRD_8_PLANES    0x0000        /* 8 planes = 256 colors */
  96. #define GRD_4_PLANES    0x0100        /* 4 planes = 16 colors */
  97. #define GRD_1_PLANE    0x0200        /* 1 plane  = 2 colors */
  98. #define GRD_16_PLANES    0x0300        /* VGA with 32K colors */
  99. #define GRD_8_X_PLANES  0x0400        /* VGA in mode X w/ 256 colors */
  100.  
  101. #define GRD_MEM_MASK    0x00f0        /* memory size mask */
  102. #define GRD_64K        0x0010        /* 64K display memory */
  103. #define GRD_128K    0x0020        /* 128K display memory */
  104. #define GRD_256K    0x0030        /* 256K display memory */
  105. #define GRD_512K    0x0040        /* 512K display memory */
  106. #define GRD_1024K    0x0050        /* 1MB display memory */
  107. #define GRD_192K    0x0060        /* 192K -- some 640x480 EGA-s */
  108. #define GRD_M_NOTSPEC    0x0000        /* memory amount not specified */
  109.  
  110.  
  111. /* ================================================================== */
  112. /*             COMPILER-DEPENDENT CONSTANTS              */
  113. /* ================================================================== */
  114.  
  115. #ifdef __GNUC__
  116. # define VGA_FRAME    0xd0000000    /* vga video RAM */
  117. # define HERC_FRAME    0xe00b0000    /* Hercules frame addr */
  118. # define EGA_FRAME    0xe00a0000    /* EGA frame addr */
  119. # define RDONLY_OFF    0x00100000    /* VGA dual page: Read only */
  120. # define WRONLY_OFF    0x00200000    /* VGA dual page: Write only */
  121. #endif
  122.  
  123. #ifdef __TURBOC__
  124. # define VGA_FRAME    0xa0000000UL    /* VGA video RAM */
  125. # define EGA_FRAME    0xa0000000UL    /* EGA video RAM */
  126. # define HERC_FRAME    0xb0000000UL    /* Hercules frame addr */
  127. # define RDONLY_OFF    0        /* VGA dual page: Read only */
  128. # define WRONLY_OFF    0        /* VGA dual page: Write only */
  129. #endif
  130.  
  131.  
  132. /* ================================================================== */
  133. /*              DRIVER INTERFACE FUNCTIONS              */
  134. /* ================================================================== */
  135.  
  136. extern void GrGetDriverModes
  137.     (GR_DRIVER_MODE_ENTRY far **t,GR_DRIVER_MODE_ENTRY far **g);
  138. extern int  _GrLowSetMode(int mode,int width,int height,int colors);
  139. #ifdef __TURBOC__
  140. extern void _GrSetVideoPage(int page);
  141. extern void _GrSetAsmPage(void);        /* takes page(s) in AL, AH */
  142. #endif
  143.  
  144. #endif  /* whole file */
  145.  
  146.