VESAVID.I 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. ;
  2. ; Command & Conquer Red Alert(tm)
  3. ; Copyright 2025 Electronic Arts Inc.
  4. ;
  5. ; This program is free software: you can redistribute it and/or modify
  6. ; it under the terms of the GNU General Public License as published by
  7. ; the Free Software Foundation, either version 3 of the License, or
  8. ; (at your option) any later version.
  9. ;
  10. ; This program is distributed in the hope that it will be useful,
  11. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ; GNU General Public License for more details.
  14. ;
  15. ; You should have received a copy of the GNU General Public License
  16. ; along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. ;
  18. ;****************************************************************************
  19. ;*
  20. ;* 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
  21. ;*
  22. ;*----------------------------------------------------------------------------
  23. ;*
  24. ;* FILE
  25. ;* vesavid.i
  26. ;*
  27. ;* DESCRIPTION
  28. ;* VESA video manager definitions. (32-Bit protected mode)
  29. ;*
  30. ;* PROGRAMMER
  31. ;* Denzil E. Long, Jr.
  32. ;*
  33. ;* DATE
  34. ;* January 26, 1995
  35. ;*
  36. ;****************************************************************************
  37. ;----------------------------------------------------------------------------
  38. ; VESA video modes
  39. ;----------------------------------------------------------------------------
  40. VESA_640X400_256 EQU 0x100
  41. VESA_640X480_256 EQU 0x101
  42. VESA_800X600_16 EQU 0x102
  43. VESA_800X600_256 EQU 0x103
  44. VESA_1024X768_16 EQU 0x104
  45. VESA_1024X768_256 EQU 0x105
  46. VESA_1280X400_16 EQU 0x106
  47. VESA_1280X400_256 EQU 0x107
  48. VESA_TEXT_80X60 EQU 0x108
  49. VESA_TEXT_132X25 EQU 0x109
  50. VESA_TEXT_132X60 EQU 0x10C
  51. VESA_320X200_32K_1 EQU 0x10D
  52. VESA_320X200_32K_2 EQU 0x10E
  53. VESA_640X480_32K EQU 0x110
  54. VESA_640X480_65K EQU 0x111
  55. VESA_640X480_16M EQU 0x112
  56. VESA_800X600_32K EQU 0x113
  57. VESA_800X600_65K EQU 0x114
  58. VESA_1024X768_32K EQU 0x116
  59. VESA_1024X768_65K EQU 0x117
  60. VESA_MIN EQU VESA_640X400_256
  61. VESA_MAX EQU VESA_1024X768_65K
  62. ;----------------------------------------------------------------------------
  63. ; Structure definitions
  64. ;----------------------------------------------------------------------------
  65. ; VESAInfo - General information about this VESA implementation.
  66. ; (Filled in by VESA BIOS Function 0)
  67. ;
  68. ; Signature - Will always be 'VESA'
  69. ; Ver - Version #
  70. ; OEMString - OEM ID string
  71. ; Capabilities - Not defined by VESA yet
  72. ; AvailModes - List of available modes; terminated with -1 (0xffff)
  73. ; TotalMemory - ???
  74. ; Reserved - Pads structure to 256 bytes total
  75. STRUC VESAInfo
  76. Signature DD ?
  77. Ver DW ?
  78. OEMString DD ?
  79. Capabilities DD ?
  80. AvailModes DD ?
  81. TotalMemory DW ?
  82. Reserved DB 236 DUP (?)
  83. ENDS VESAInfo
  84. ; VESAModeInfo - Information about this VESA mode.
  85. ; (Filled in by VESA BIOS Function 1)
  86. ;
  87. ; Attributes - bit 0: 1 = mode is supported
  88. ; bit 1: 1 = optional info available
  89. ; bit 2: 1 = std BIOS output functions valid in this mode
  90. ; bit 3: 0 = monochrome, 1 = color
  91. ; bit 4: 0 = text mode, 1 = graphics
  92. ; WinA_Attributes - bit 0 = window exists, bit 1=readable, bit 2= writable
  93. ; WinB_Attributes - bit 0 = window exists, bit 1=readable, bit 2= writable
  94. ; WinGranularity - smallest address boundary window can be placed upon;
  95. ; size is in KB (ie 64, 32, 4)
  96. ; WinSize - size of windows in KB (ie 64, 32)
  97. ; WinA_Segment - location of Window A in CPU space (usually 0xa000)
  98. ; WinB_Segment - location of Window B in CPU space (usually 0xb000)
  99. ; WinFunc - address of window-setting function (This is provided
  100. ; as an alternative to Int 10 for speed.)
  101. ; BytesPerScanline - # bytes per scan line
  102. ;
  103. ; Optional info (available if bit 1 of Attributes is set):
  104. ;
  105. ; XRes - X-resolution
  106. ; YRes - Y-resolution
  107. ; XCharSize - Horizontal size of char cell
  108. ; YCharSize - Vertical size of char cell
  109. ; NumPlanes - # of memory planes (???)
  110. ; BitsPerPixel - # bites per pixel
  111. ; NumBanks - # of banks (ie planes)
  112. ; MemoryModel - 00h = Text mode
  113. ; 01h = CGA mode
  114. ; 02h = Hercules
  115. ; 03h = 4 plane planar mode
  116. ; 04h = packed pixel mode (1 byte/pixel)
  117. ; 05h = non-chain 4, 256-color mode
  118. ; 06-0Fh =
  119. ; 10-FFh = OEM-specific
  120. ; BankSize - Bank size in KB
  121. STRUC VESAModeInfo
  122. Attributes DW ?
  123. WinA_Attributes DB ?
  124. WinB_Attributes DB ?
  125. WinGranularity DW ?
  126. WinSize DW ?
  127. WinA_Segment DW ?
  128. WinB_Segment DW ?
  129. WinFunc DD ?
  130. BytesPerScanline DW ?
  131. XRes DW ?
  132. YRes DW ?
  133. XCharSize DB ?
  134. YCharSize DB ?
  135. NumPlanes DB ?
  136. BitsPerPixel DB ?
  137. NumBanks DB ?
  138. MemoryModel DB ?
  139. BankSize DB ?
  140. NumInputPages DB ?
  141. Reserved DB ?
  142. RedMaskSize DB ?
  143. RedFieldPosition DB ?
  144. GreenMaskSize DB ?
  145. GreenFieldPosition DB ?
  146. BlueMaskSize DB ?
  147. BlueFieldPosition DB ?
  148. RsvdMaskSize DB ?
  149. RsvdFieldPosition DB ?
  150. DirectColorModeInfo DB ?
  151. pad DB 216 DUP (?)
  152. ENDS VESAModeInfo
  153. ;----------------------------------------------------------------------------
  154. ; Function definitions
  155. ;----------------------------------------------------------------------------
  156. GLOBAL C InitVESA:PROC
  157. GLOBAL C UninitVESA:PROC
  158. GLOBAL C SetVESAMode:PROC
  159. GLOBAL C ReadVESAModeInfo:PROC
  160. GLOBAL C SetVESAWindow:PROC
  161. ;----------------------------------------------------------------------------
  162. ;
  163. ; NAME
  164. ; SET_WINDOW - Sets window A to the specified bank.
  165. ;
  166. ; SYNOPSIS
  167. ; SET_WINDOW GrainNum
  168. ;
  169. ; FUNCTION
  170. ; This routine uses the C Set_Window function rather than going through
  171. ; the BIOS, for two reasons: (1) Speed, and (2) On the Cirrus Logic 54xx
  172. ; VESA cards, BIOS calls make noise while playing digital audio.
  173. ;
  174. ; INPUTS
  175. ; GrainNum - Granularity number.
  176. ;
  177. ; RESULT
  178. ; NONE
  179. ;
  180. ;----------------------------------------------------------------------------
  181. MACRO SET_WINDOW grain_num
  182. push esi
  183. push edi
  184. push es
  185. call SetVESAWindow C,grain_num
  186. pop es
  187. pop edi
  188. pop esi
  189. ENDM