VIDEO.H 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. //
  2. // Copyright 2020 Electronic Arts Inc.
  3. //
  4. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free
  5. // software: you can redistribute it and/or modify it under the terms of
  6. // the GNU General Public License as published by the Free Software Foundation,
  7. // either version 3 of the License, or (at your option) any later version.
  8. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. /***************************************************************************
  15. ** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
  16. ***************************************************************************
  17. * *
  18. * Project Name : 32 bit library *
  19. * *
  20. * File Name : VIDEO.H *
  21. * *
  22. * Programmer : Scott K. Bowen *
  23. * *
  24. * Start Date : August 3, 1994 *
  25. * *
  26. * Last Update : August 3, 1994 [SKB] *
  27. * *
  28. *-------------------------------------------------------------------------*
  29. * Functions: *
  30. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  31. #ifndef VIDEO_H
  32. #define VIDEO_H
  33. #ifndef WWSTD_H
  34. #include "wwstd.h"
  35. #endif
  36. /*=========================================================================*/
  37. /* The machine can be in one of the following graphic modes. The global */
  38. /* GraphicMode is set to one of these values. */
  39. /*=========================================================================*/
  40. #define CGA_MODE 4 // DOS 320x200 4 color mode
  41. #define TGA_MODE 9 // TANDY 320x200 16 color mode
  42. #define EGA_MODE 13 // DOS 320x200 16 color mode
  43. #define MCGA_MODE 0x13 // DOS 320x200 256 color mode
  44. #define VGA_MODE 0x13 // DOS 320x200 256 color mode
  45. #define EEGA_MODE 14 // DOS 640x400 16 color mode
  46. #define ETGA_MODE 9 // TANDY 640x400 16 color mode
  47. #define HGA_MODE 7 // DOS 768x400 2 color mode
  48. #define TXT_MODE 3 // DOS plain old color text mode
  49. #define VESA_640X400_256 0x100 // VESA 640x400 256 color mode
  50. #define VESA_640X480_256 0x101 // VESA 640x480 256 color mode
  51. #define VESA_800X600_256 0x103 // VESA 800x600 256 color mode
  52. #define VESA_1024X768_256 0x105 // VESA 1024x768 256 color mode
  53. #define VESA_1280X400_256 0x107 // VESA 1280x400 256 color mode
  54. #define VESA_TEXT_80X60 0x108 // VESA 80x60 text mode
  55. #define VESA_TEXT_132X25 0x109 // VESA 132x25 text mode
  56. #define VESA_TEXT_132X60 0x10C // VESA 132x60 text mode
  57. #define RESET_MODE -1
  58. #define UNINITIALIZED_MODE -1
  59. #define VESA_MIN VESA_640X400_256
  60. #define VESA_MAX VESA_TEXT_132X60
  61. /*=========================================================================*/
  62. /* Define the maximum number of bank entries */
  63. /*=========================================================================*/
  64. #define MAX_BANK_ENTRIES ((1280L*1024L)/65536L)
  65. /*=========================================================================*
  66. * VesaInfoType - General info about this VESA implementation *
  67. * (Filled in by VESA BIOS Function 0) *
  68. * *
  69. * Signature - Will always be 'VESA' *
  70. * Version - Version # *
  71. * OEMString - OEM ID string *
  72. * Capabilities - Not defined by VESA yet *
  73. * AvailModes - List of available modes; terminated with -1 (0xffff) *
  74. * TotalMemory - ??? *
  75. * Reserved - Pads structure to 256 bytes total *
  76. *=========================================================================*/
  77. #ifdef NOT_FOR_WIN95
  78. typedef struct {
  79. char Signature[4];
  80. short Version;
  81. REALPTR OEMString;
  82. long Capabilities;
  83. REALPTR AvailModes;
  84. short TotalMemory;
  85. char Reserved[236];
  86. } VesaInfoType;
  87. #endif //NOT_FOR_WIN95
  88. /*=========================================================================*
  89. * VesaModeInfoType - Info about this VESA mode *
  90. * (Filled in by VESA BIOS Function 1) *
  91. * *
  92. * Attributes - bit 0: 1 = mode is supported *
  93. * bit 1: 1 = optional info available *
  94. * bit 2: 1 = std BIOS output funcs valid in this mode *
  95. * bit 3: 0 = monochrome, 1 = color *
  96. * bit 4: 0 = text mode, 1 = graphics *
  97. * WinA_Attributes - bit 0 = win exists, bit 1=readable, bit 2= writable *
  98. * WinB_Attributes - bit 0 = win exists, bit 1=readable, bit 2= writable *
  99. * WinGranularity - smallest address boundary window can be placed upon; *
  100. * size is in KB (ie 64, 32, 4) *
  101. * WinSize - size of windows in KB (ie 64, 32) *
  102. * WinA_Segment - location of Window A in CPU space (usually 0xa000) *
  103. * WinB_Segment - location of Window B in CPU space (usually 0xb000) *
  104. * WinFunc - address of window-setting function (This is provided *
  105. * as an alternative to Int 10 for speed.) *
  106. * BytesPerScanline - # bytes per scan line *
  107. * *
  108. * Optional info (available if bit 1 of Attributes is set): *
  109. * *
  110. * XRes - X-resolution *
  111. * YRes - Y-resolution *
  112. * XCharSize - Horizontal size of char cell *
  113. * YCharSize - Vertical size of char cell *
  114. * NumPlanes - # of memory planes (???) *
  115. * BitsPerPixel - # bites per pixel *
  116. * NumBanks - # of banks (ie planes) *
  117. * MemoryModel - 00h = Text mode *
  118. * 01h = CGA mode *
  119. * 02h = Hercules *
  120. * 03h = 4 plane planar mode *
  121. * 04h = packed pixel mode (1 byte/pixel) *
  122. * 05h = non-chain 4, 256-color mode *
  123. * 06-0Fh = *
  124. * 10-FFh = OEM-specific *
  125. * BankSize - Bank size in KB *
  126. *=========================================================================*/
  127. #ifdef NOT_FOR_WIN95
  128. typedef struct {
  129. short Attributes;
  130. char WinA_Attributes;
  131. char WinB_Attributes;
  132. short WinGranularity;
  133. short WinSize;
  134. short WinA_Segment;
  135. short WinB_Segment;
  136. REALPTR WinFunc;
  137. short BytesPerScanline;
  138. short XRes;
  139. short YRes;
  140. char XCharSize;
  141. char YCharSize;
  142. char NumPlanes;
  143. char BitsPerPixel;
  144. char NumBanks;
  145. char MemoryModel;
  146. char BankSize;
  147. char NumInputPages;
  148. char Reserved;
  149. char RedMaskSize;
  150. char RedFieldPosition;
  151. char GreenMaskSize;
  152. char GreenFieldPosition;
  153. char BlueMaskSize;
  154. char BlueFieldPosition;
  155. char RsvdMaskSize;
  156. char RsvdFieldPosition;
  157. char DirectColorModeInfo;
  158. char pad[216];
  159. } VesaModeInfoType;
  160. extern REALPTR VesaFunc;
  161. #endif //NOT_FOR_WIN95
  162. extern "C" {
  163. extern int GraphicMode;
  164. extern long XRes;
  165. extern long YRes;
  166. extern long BankTable [];
  167. extern unsigned long RMVesaVector ;
  168. extern unsigned long RMVesaRegs ;
  169. }
  170. /*=========================================================================*/
  171. /* The following prototypes are for the file: VIDEO.CPP */
  172. /*=========================================================================*/
  173. extern "C" int Set_Video_Mode(int mode);
  174. int Get_Video_Mode(void);
  175. void Update_Video_Mode (void) ;
  176. void Vesa_Info(void);
  177. void Vesa_Set_Window(long grain_num);
  178. int Get_Original_Video_Mode(void);
  179. void Set_Original_Video_Mode(int mode);
  180. /*=========================================================================*/
  181. /* The following prototypes are for the file: INITDLAY.CPP */
  182. /*=========================================================================*/
  183. extern VOID Init_Delay(VOID);
  184. extern BOOL VertBlank;
  185. /*=========================================================================*/
  186. /* The following prototypes are for the file: VERTBLNK.ASM */
  187. /*=========================================================================*/
  188. extern "C" {
  189. extern WORD Get_Vert_Blank(VOID);
  190. extern VOID Wait_Vert_Blank(BOOL blank);
  191. }
  192. /*=========================================================================*/
  193. #endif // VIDEO_H