GR_HARDW.DEF 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. DEFINITION MODULE GR_Hardware;
  2. (*
  3. ** Author : Peter Jardine
  4. **
  5. ** Version:
  6. ** 1.0 17 Apr 92 New file - based on the work of
  7. ** Michael McCarthy & John Pfitzner,
  8. ** CSP-960 Project, Semester 2, 1991.
  9. ** kb Nov 92 Add SVGA
  10. *)
  11. IMPORT GrafCore;
  12. IMPORT SvgaCore;
  13. CONST
  14. (* ======================== Video modes ========================= *)
  15. (*
  16. ** On MCGA, EGA, or VGA, mode 0 is the same as mode 1, and mode 2 is
  17. ** the same as mode 3. CGA colour burst is disabled in modes 0 and 2.
  18. *)
  19. TEXT_BW40 = 0; (* 40 column text, 16 (grey on CGA) *)
  20. TEXT_CO40 = 1; (* 40 column text, 16 *)
  21. TEXT_BW80 = 2; (* 80 column text, 16 (grey on CGA) *)
  22. TEXT_CO80 = 3; (* 80 column text, 16 *)
  23. (*
  24. ** CGA modes. On EGA, MCGA and VGA adapters, modes 4 and 5 are
  25. ** identical. On CGA colour displays, mode 5 gives a cyan-red-white
  26. ** palette, while on mono displays it gives better gray shade
  27. ** differentiation. Mode 4 allows selection of 2 different
  28. ** palettes on colour displays; the standard cyan-violet-white, or
  29. ** green-red-yellow. See procedure SetPal4 to switch palettes.
  30. *)
  31. CGA_Mode_4 = 4; (* 320x200 4 colours *)
  32. CGA_Mode_5 = 5; (* 320x200 4 colours, colour burst disabled *)
  33. CGA_Mode_6 = 6; (* 640x200 monochrome *)
  34. TEXT_MONO = 7; (* 80 column text, 2 colours *)
  35. (*
  36. ** EGA modes. Note that on 64K EGA cards, only 4 colours are
  37. ** available in mode 16
  38. *)
  39. EGA_Mode_13 = 13; (* 320x200 16 colours *)
  40. EGA_Mode_14 = 14; (* 640x200 16 colours *)
  41. EGA_Mode_16 = 16; (* 640x350 16 colours *)
  42. VGA_Mode_18 = 18; (* 640x480 16 colours *)
  43. (* Not supported modes *)
  44. EGA_Mode_15 = 15; (* 640x350 2 colours .. not supported *)
  45. VGA_Mode_17 = 17; (* 640x480 2 colours .. not supported *)
  46. VGA_Mode_19 = 19; (* 320x200 256 colours .. not supported *)
  47. SEGA_Mode_60 = 60; (* 800x600 16 colours .. not supported *)
  48. SEGA_Mode_61 = 61; (* 1024x768 16 colours .. not supported *)
  49. SEGA_Mode_62 = 62; (* 1280x1024 16 colours .. not supported *)
  50. (*
  51. ** Hercules monochrome adapters. Note that this mode number has no
  52. ** meaning to the BIOS, or anything else outside this module!
  53. *)
  54. HGC_Graphics_Mode = 31; (* 720x348 monochrome *)
  55. (*
  56. ** Super VGA modes. Note that as with the Hercules graphics mode these
  57. ** mode numbers have no meaning to the BIOS, they are just defined for
  58. ** the convenience of GPM Graphics Library
  59. *)
  60. SVGA_Mode_80 = 80; (* 640x400 256 colours *)
  61. SVGA_Mode_81 = 81; (* 640x480 256 colours *)
  62. SVGA_Mode_82 = 82; (* 800x600 256 colours *)
  63. SVGA_Mode_83 = 83; (* 1024x768 256 colours *)
  64. SVGA_Mode_84 = 84; (* 1280x1024 256 colours *)
  65. (* Automatic Mode selections - Used ONLY in SetVideoMode() *)
  66. Max_Colours_Mode = 83;
  67. Max_Resolution_Mode = 83;
  68. Initial_Video_Mode = 83;
  69. (* ===================== Video adapters ========================= *)
  70. MDA_Adapter = 1;
  71. CGA_Adapter = 2;
  72. EGA_Adapter = 3;
  73. MCGA_Adapter = 4;
  74. VGA_Adapter = 5;
  75. SVGA_256K_Adapter = 6;
  76. SVGA_512K_Adapter = 7;
  77. SVGA_1Meg_Adapter = 8;
  78. HGC_Adapter = 80H;
  79. HGC_Plus_Adapter = 81H;
  80. InColour_Adapter = 82H;
  81. (* ===================== Video displays ========================= *)
  82. MDA_Display = 1;
  83. CGA_Display = 2;
  84. EGA_Colour_Display = 3;
  85. PS2_Mono_Display = 4;
  86. PS2_Colour_Display = 5;
  87. (* =============== Super VGA Adapters =========================== *)
  88. NoSVGA = -1;
  89. VESA = 0;
  90. ATI = 1;
  91. Everex = 2;
  92. Compaq = 3;
  93. NCR = 4;
  94. Trident8800 = 5;
  95. Trident8900 = 6;
  96. Video7 = 7;
  97. Genoa = 8;
  98. Cirrus = 9;
  99. Paradise = 10;
  100. ChipsTech = 11;
  101. Tseng3000 = 12;
  102. Tseng4000 = 13;
  103. AheadA = 14;
  104. AheadB = 15;
  105. OAK = 16;
  106. (* =============== Super VGA Ram ================================ *)
  107. Ram256K = 0;
  108. Ram512K = 1;
  109. Ram1Meg = 2;
  110. TYPE
  111. AdapterSet = SET OF [MDA_Adapter..SVGA_1Meg_Adapter];
  112. ModeSet = SET OF [TEXT_BW40..SVGA_Mode_84];
  113. SvgaSet = [NoSVGA..OAK];
  114. RamSet = [Ram256K..Ram1Meg];
  115. Palette256 = SvgaCore.Palette256; (* ARRAY [0..768] OF BYTE *)
  116. Palette16 = GrafCore.Palette16; (* ARRAY [0..16] OF BYTE *)
  117. (* ===================== Video Config ========================== *)
  118. VideoConfig = RECORD
  119. mode : CARDINAL;
  120. xPixels, yPixels : INTEGER;
  121. xNDCPixels, yNDCPixels : INTEGER;
  122. textCols, textRows : CARDINAL;
  123. charHeight, charWidth : CARDINAL;
  124. colours : CARDINAL;
  125. adapter, monitor : CARDINAL;
  126. END;
  127. VideoMode = [TEXT_BW40 .. Initial_Video_Mode];
  128. PROCEDURE SetVideoMode(mode : VideoMode) : BOOLEAN;
  129. (*
  130. ** Switches video mode. Assumes that vmode is one of the supported
  131. ** graphics modes - [4..6,13,14,16,18,31] - or an alphanumeric mode
  132. ** [0..3,7]. If vmode is not one of these values, does nothing.
  133. *)
  134. PROCEDURE SetPal16(pal : Palette16);
  135. (*
  136. ** Sets the colour palette for 16 colour modes. The first 16 bytes of
  137. ** pal are the colour register values, and the 17th is the border register
  138. ** value (used only by VGA adapters). For EGA, colour values are in the
  139. ** range 0..64, while for VGA, 0..255. The variable StdPal16 is provided
  140. ** for restoring the adapter to its default colour palette state.
  141. *)
  142. PROCEDURE SetPal256(pal : Palette256);
  143. (*
  144. ** Sets the colour palette for 256 colour modes. Each palette entry is
  145. ** comprised of 3 bytes, one for each primary colour (red,green and
  146. ** blue). Each primary has a range of 0..63
  147. *)
  148. PROCEDURE SetPal4(altPalette : BOOLEAN);
  149. (*
  150. ** Allows toggling between two 4 colour palettes for CGA graphics mode 4.
  151. ** The default palette is black-cyan-violet-white (altPalette = FALSE),
  152. ** while the alternate palette is black-green-red-yellow.
  153. ** Note that CGA mode 5 provides another palette that is more suitable
  154. ** for monochrome or composite monitors. On a colour monitor the display
  155. ** is in black-cyan-red-white.
  156. *)
  157. PROCEDURE SetSVGAVideoAdapter(card : SvgaSet; ram : RamSet);
  158. (*
  159. ** Allows user to force the SVGA driver to configure to the requested
  160. ** card type. Useful for when the library incorrectly identifes an
  161. ** adapter.
  162. ** card -> svga card library is to configure to
  163. ** ram -> amount of ram on card
  164. **
  165. ** It is recommended that this only be used as a last resort. If there
  166. ** are any problems with the driver please fully document and contact
  167. ** the appropriate support person.
  168. *)
  169. PROCEDURE GetPal16(VAR pal : Palette16);
  170. (*
  171. ** Returns the current 16 colour palette and overscan register values.
  172. ** This is only functional for VGA adpaters.
  173. *)
  174. PROCEDURE GetPal256(VAR pal : Palette256);
  175. (*
  176. ** Returns the current 256 colour palette.
  177. ** This is only functional for VGA adapters and Super VGA adapters.
  178. *)
  179. PROCEDURE GetVideoConfig(VAR configInfo : VideoConfig);
  180. (*
  181. ** Get the details of the current video mode.
  182. *)
  183. PROCEDURE GetVideoMode(VAR mode : VideoMode);
  184. (*
  185. ** Get the current video mode.
  186. *)
  187. PROCEDURE GetSVGAVideoAdapter(VAR card : SvgaSet; VAR ram : RamSet);
  188. (*
  189. ** Get the current SVGA adapter type and amount of ram on board. This
  190. ** is useful in determining if the Super VGA adapter has been identified
  191. ** correctly by the internal detection routine. If a card has been
  192. ** incorrectly identified try using SetSVGAVideoAdapter to configure
  193. ** library.
  194. *)
  195. PROCEDURE WaitForRetrace;
  196. (*
  197. ** Sometimes useful for synchronization. Waits for the vertical retrace
  198. ** interrupt to occur befor returning control to the caller. On return
  199. ** there is a brief time interval (of the order of ?? millisecs) during
  200. ** which no screen refreshing takes place. This may give the caller time
  201. ** to perform a series of graphics write operations before scanning
  202. ** recommences, which can help to reduce or eliminate image flicker
  203. ** during animations.
  204. *)
  205. END GR_Hardware.