Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

614 lines
24 KiB

  1. VIDEOMODE ModesVGA[] = {
  2. //
  3. // Beginning of VGA color modes.
  4. //
  5. //
  6. // Mode index 0.
  7. // Color text mode 3, 720x400, 9x16 char cell (VGA).
  8. //
  9. { VIDEO_MODE_COLOR, // flags that this mode is a color mode, but not graphics
  10. 4, // four bits of color representation = 16 colors available
  11. 80, 25, // 80x25 text resolution
  12. 720, 400, // 720x400 pixels on screen
  13. 160, 0x10000, // 160 bytes per scan line, 64K of CPU-addressable bitmap
  14. MemMap_CGA, // the memory mapping is the standard CGA memory mapping
  15. // of 32K at B8000
  16. {
  17. //
  18. // These are the register-setting commands, in the form of REGCMD structures.
  19. // The first entry is the action to be taken (set a register, set an
  20. // indexed register block, or end the mode initialization). Immediately
  21. // following is a REGDATA structure, containing the value(s) to be output
  22. // (represented as a string for convenience, but the terminating 0 is
  23. // ignored), followed by the first index to be written to and then the
  24. // number of indexed registers to loaded. Note that if the command is
  25. // SetRegCmd, to set a single non-indexed register, then the field following
  26. // the string (the FirstEntry field) is actually the I/O address of the
  27. // register to be written to, and the last field (NumEntries) is ignored.
  28. //
  29. { BeginSyncResetCmd }, // enable synchronous reset while we change
  30. // clocks and timing states
  31. //
  32. // Set the 4 Sequence Controller registers other than the Synchronous Reset
  33. // register. Synchronous reset must be in effect while clock and timing
  34. // state related Sequencer registers are being set.
  35. //
  36. { SetSeqCmd, // set a block of Sequencer registers
  37. { "\x00\x03\x00\x02", // values for indexed registers 1-4
  38. 0x01, // first index to set = 1
  39. VGA_NUM_SEQUENCER_PORTS-1 // set all but 1 indexed Sequencer register
  40. }
  41. },
  42. //
  43. // Set the Miscellaneous Output register to establish color/mono addressing
  44. // and select clocks and sync polarities.
  45. // Synchronous reset must be in effect while this register is being set,
  46. // because it contains clock control bits.
  47. //
  48. { SetRegCmd, // set a non-indexed register
  49. { "\x67", // set to 0x67
  50. MISC_OUTPUT_REG_WRITE_PORT // set the Miscellaneous Output register
  51. }
  52. },
  53. //
  54. // Important! Never change the memory chaining state except in sync reset!
  55. //
  56. { SetGraphCmd, { "\x0E", 0x06, 1 } },
  57. { EndSyncResetCmd }, // terminate synchronous reset; clocks changed
  58. //
  59. // Set CRT Controller register 0x11 to unprotect CRTC registers 0-7.
  60. //
  61. { SetCrtcCmd,
  62. { "\x0E",
  63. IND_VSYNC_END,
  64. 0x01
  65. }
  66. },
  67. //
  68. // Set all 25 CRT Controller registers.
  69. //
  70. { SetCrtcCmd,
  71. { "\x5F\x4F\x50\x82\x55\x81\xBF\x1F\x0\x4F\xD\xE\x0\x0\x0\x0\x9C\x8E\x8F\x28\x1F\x96\xB9\xA3\xFF",
  72. 0x00,
  73. VGA_NUM_CRTC_PORTS
  74. }
  75. },
  76. //
  77. // Set all 21 Attribute Controller registers.
  78. //
  79. { SetAttCmd,
  80. { "\x00\x01\x02\x03\x04\x05\x14\x07\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F\x04\x00\x0F\x08\x0",
  81. 0x00,
  82. VGA_NUM_ATTRIB_CONT_PORTS
  83. }
  84. },
  85. //
  86. // Set all 9 Graphics Controller registers.
  87. //
  88. { SetGraphCmd,
  89. { "\x00\x00\x00\x00\x00\x10\x0E\x00\xFF",
  90. 0x00,
  91. VGA_NUM_GRAPH_CONT_PORTS
  92. }
  93. },
  94. //
  95. // done
  96. //
  97. { TerminateCmd }
  98. }
  99. },
  100. //
  101. // Mode index 1
  102. // Color text mode 3, 640x400, 8x16 char cell (not a VGA mode; MCGA mode, can
  103. // be used for plasma/LCD displays).
  104. // Values not checked, because this is a non-standard mode and there's nothing
  105. // to compare it to, so it may or may not work.
  106. //
  107. { VIDEO_MODE_COLOR, 4, 80, 25, 640, 400, 160, 0x10000, MemMap_CGA,
  108. {
  109. { BeginSyncResetCmd },
  110. { SetSeqCmd, { "\x1\x3\x0\x2", 0x01, VGA_NUM_SEQUENCER_PORTS-1 } },
  111. { SetRegCmd, { "\x63", MISC_OUTPUT_REG_WRITE_PORT, 0x01 } },
  112. { SetGraphCmd,{ "\x0E", 0x06, 1} },
  113. { EndSyncResetCmd },
  114. { SetCrtcCmd, { "\x0E", IND_VSYNC_END, 0x01 } },
  115. { SetCrtcCmd, { "\x5F\x4F\x50\x82\x55\x81\xBF\x1F\x0\x4F\xD\xE\x0\x0\x0\x0\x9C\x8E\x8F\x28\x1F\x96\xB9\xA3\xFF", 0x00, VGA_NUM_CRTC_PORTS } },
  116. { SetAttCmd, { "\x0\x1\x2\x3\x4\x5\x14\x7\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F\x4\x0\xF\x0\x0", 0x00, VGA_NUM_ATTRIB_CONT_PORTS } },
  117. { SetGraphCmd,{ "\x0\x0\x0\x0\x0\x10\x0E\x00\xFF", 0x00, VGA_NUM_GRAPH_CONT_PORTS } },
  118. { TerminateCmd }
  119. }
  120. },
  121. //
  122. // Mode index 2
  123. // Color text mode 1, 360x400, 9x16 char cell.
  124. //
  125. { VIDEO_MODE_COLOR, 4, 40, 25, 360, 400, 80, 0x10000, MemMap_CGA,
  126. {
  127. { BeginSyncResetCmd },
  128. { SetSeqCmd, { "\x08\x03\x00\x02", 0x01, VGA_NUM_SEQUENCER_PORTS-1 } },
  129. { SetRegCmd, { "\x67", MISC_OUTPUT_REG_WRITE_PORT, 0x01 } },
  130. { SetGraphCmd,{ "\x0E", 0x06, 1} },
  131. { EndSyncResetCmd },
  132. { SetCrtcCmd, { "\x0E", IND_VSYNC_END, 0x01 } },
  133. { SetCrtcCmd, { "\x2D\x27\x28\x90\x2B\x0A0\x0BF\x1F\x00\x4F\x0D\x0E\x0\x0\x0\x0\x09C\x8E\x8F\x14\x1F\x96\x0B9\x0A3\x0FF", 0x00, VGA_NUM_CRTC_PORTS } },
  134. { SetAttCmd, { "\x0\x1\x2\x3\x4\x5\x14\x7\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F\x4\x0\xF\x8\x0", 0x00, VGA_NUM_ATTRIB_CONT_PORTS } },
  135. { SetGraphCmd,{ "\x0\x0\x0\x0\x0\x10\x0E\x00\xFF", 0x00, VGA_NUM_GRAPH_CONT_PORTS } },
  136. { TerminateCmd }
  137. }
  138. },
  139. //
  140. // Mode index 3
  141. // Color text mode 1, 320x400, 8x16 char cell (not a VGA mode; MCGA mode, can
  142. // be used for plasma/LCD displays).
  143. // Values not checked, because this is a non-standard mode and there's nothing
  144. // to compare it to, so it may or may not work.
  145. //
  146. { VIDEO_MODE_COLOR, 4, 40, 25, 320, 400, 80, 0x10000, MemMap_CGA,
  147. {
  148. { BeginSyncResetCmd },
  149. { SetSeqCmd, { "\x09\x03\x00\x02", 0x01, VGA_NUM_SEQUENCER_PORTS-1 } },
  150. { SetRegCmd, { "\x63", MISC_OUTPUT_REG_WRITE_PORT, 0x01 } },
  151. { SetGraphCmd,{ "\x0E", 0x06, 1} },
  152. { EndSyncResetCmd },
  153. { SetCrtcCmd, { "\x0E", IND_VSYNC_END, 0x01 } },
  154. { SetCrtcCmd, { "\x2D\x27\x28\x90\x2B\x0A0\x0BF\x1F\x00\x4F\x0D\x0E\x0\x0\x0\x0\x09C\x8E\x8F\x14\x1F\x96\x0B9\x0A3\x0FF", 0x00, VGA_NUM_CRTC_PORTS } },
  155. { SetAttCmd, { "\x0\x1\x2\x3\x4\x5\x14\x7\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F\x4\x0\xF\x0\x0", 0x00, VGA_NUM_ATTRIB_CONT_PORTS } },
  156. { SetGraphCmd,{ "\x0\x0\x0\x0\x0\x10\x0E\x00\xFF", 0x00, VGA_NUM_GRAPH_CONT_PORTS } },
  157. { TerminateCmd }
  158. }
  159. },
  160. //
  161. // Mode index 4
  162. // Color text mode 3, 640x350, 8x14 char cell (EGA).
  163. //
  164. { VIDEO_MODE_COLOR, 4, 80, 25, 640, 350, 160, 0x10000, MemMap_CGA,
  165. {
  166. { BeginSyncResetCmd },
  167. { SetSeqCmd, { "\x01\x03\x00\x02", 0x01, VGA_NUM_SEQUENCER_PORTS-1 } },
  168. { SetRegCmd, { "\xA3", MISC_OUTPUT_REG_WRITE_PORT, 0x01 } },
  169. { SetGraphCmd,{ "\x0E", 0x06, 1} },
  170. { EndSyncResetCmd },
  171. { SetCrtcCmd, { "\x05", IND_VSYNC_END, 0x01 } },
  172. { SetCrtcCmd, { "\x5F\x4F\x50\x82\x55\x81\xBF\x1F\x0\x4D\xB\xC\x0\x0\x0\x0\x83\x85\x5D\x28\x1F\x63\x0BA\x0A3\x0FF", 0x00, VGA_NUM_CRTC_PORTS } },
  173. { SetAttCmd, { "\x0\x1\x2\x3\x4\x5\x14\x7\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F\x00\x0\x0F\x0\x0", 0x00, VGA_NUM_ATTRIB_CONT_PORTS } },
  174. { SetGraphCmd,{ "\x0\x0\x0\x0\x0\x10\x0E\x00\xFF", 0x00, VGA_NUM_GRAPH_CONT_PORTS } },
  175. { TerminateCmd }
  176. }
  177. },
  178. //
  179. // Mode index 5
  180. // Color text mode 1, 320x350, 8x14 char cell (EGA).
  181. //
  182. { VIDEO_MODE_COLOR, 4, 40, 25, 320, 350, 80, 0x10000, MemMap_CGA,
  183. {
  184. { BeginSyncResetCmd },
  185. { SetSeqCmd, { "\x09\x03\x00\x02", 0x01, VGA_NUM_SEQUENCER_PORTS-1 } },
  186. { SetRegCmd, { "\xA3", MISC_OUTPUT_REG_WRITE_PORT, 0x01 } },
  187. { SetGraphCmd,{ "\x0E", 0x06, 1} },
  188. { EndSyncResetCmd },
  189. { SetCrtcCmd, { "\x05", IND_VSYNC_END, 0x01 } },
  190. { SetCrtcCmd, { "\x2D\x27\x28\x90\x2B\x0A0\x0BF\x1F\x00\x4D\x0B\x0C\x0\x0\x0\x0\x83\x85\x5D\x14\x1F\x63\x0BA\x0A3\x0FF", 0x00, VGA_NUM_CRTC_PORTS } },
  191. { SetAttCmd, { "\x0\x1\x2\x3\x4\x5\x14\x7\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F\x00\x0\x0F\x0\x0", 0x00, VGA_NUM_ATTRIB_CONT_PORTS } },
  192. { SetGraphCmd,{ "\x0\x0\x0\x0\x0\x10\x0E\x00\xFF", 0x00, VGA_NUM_GRAPH_CONT_PORTS } },
  193. { TerminateCmd }
  194. }
  195. },
  196. //
  197. // Mode index 6
  198. // Color text mode 3, 640x200 double-scanned, 8-wide char cell (CGA).
  199. //
  200. { VIDEO_MODE_COLOR, 4, 80, 25, 640, 200, 160, 0x10000, MemMap_CGA,
  201. {
  202. { BeginSyncResetCmd },
  203. { SetSeqCmd, { "\x01\x03\x00\x02", 0x01, VGA_NUM_SEQUENCER_PORTS-1 } },
  204. { SetRegCmd, { "\x63", MISC_OUTPUT_REG_WRITE_PORT, 0x01 } },
  205. { SetGraphCmd,{ "\x0E", 0x06, 1} },
  206. { EndSyncResetCmd },
  207. { SetCrtcCmd, { "\x0E", IND_VSYNC_END, 0x01 } },
  208. { SetCrtcCmd, { "\x5F\x4F\x50\x82\x55\x81\x0BF\x1F\x00\x0C7\x06\x07\x0\x0\x0\x0\x9C\x8E\x8F\x28\x1F\x96\x0B9\x0A3\x0FF", 0x00, VGA_NUM_CRTC_PORTS } },
  209. { SetAttCmd, { "\x0\x1\x2\x3\x4\x5\x14\x7\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F\x00\x0\x0F\x0\x0", 0x00, VGA_NUM_ATTRIB_CONT_PORTS } },
  210. { SetGraphCmd,{ "\x0\x0\x0\x0\x0\x10\x0E\x00\xFF", 0x00, VGA_NUM_GRAPH_CONT_PORTS } },
  211. { TerminateCmd }
  212. }
  213. },
  214. //
  215. // Mode index 7
  216. // Color text mode 1, 320x200 double-scanned, 80, 0x10000, 8-wide char cell (CGA).
  217. //
  218. { VIDEO_MODE_COLOR, 4, 40, 25, 320, 200, 80, 0x10000, MemMap_CGA,
  219. {
  220. { BeginSyncResetCmd },
  221. { SetSeqCmd, { "\x09\x03\x00\x02", 0x01, VGA_NUM_SEQUENCER_PORTS-1 } },
  222. { SetRegCmd, { "\x63", MISC_OUTPUT_REG_WRITE_PORT, 0x01 } },
  223. { SetGraphCmd,{ "\x0E", 0x06, 1} },
  224. { EndSyncResetCmd },
  225. { SetCrtcCmd, { "\x0E", IND_VSYNC_END, 0x01 } },
  226. { SetCrtcCmd, { "\x2D\x27\x28\x90\x2B\x0A0\x0BF\x1F\x00\x0C7\x06\x07\x0\x0\x0\x0\x9C\x8E\x8F\x14\x1F\x96\x0B9\x0A3\x0FF", 0x00, VGA_NUM_CRTC_PORTS } },
  227. { SetAttCmd, { "\x0\x1\x2\x3\x4\x5\x14\x7\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F\x00\x0\x0F\x0\x0", 0x00, VGA_NUM_ATTRIB_CONT_PORTS } },
  228. { SetGraphCmd,{ "\x0\x0\x0\x0\x0\x10\x0E\x00\xFF", 0x00, VGA_NUM_GRAPH_CONT_PORTS } },
  229. { TerminateCmd }
  230. }
  231. },
  232. //
  233. // Mode index 8
  234. // Color graphics mode 0x04, 320x200 4 colors.
  235. //
  236. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 2, 40, 25, 320, 200, 80, 0x10000, MemMap_CGA,
  237. {
  238. { BeginSyncResetCmd },
  239. { SetSeqCmd, { "\x09\x03\x00\x02", 0x01, VGA_NUM_SEQUENCER_PORTS-1 } },
  240. { SetRegCmd, { "\x63", MISC_OUTPUT_REG_WRITE_PORT, 0x01 } },
  241. { SetGraphCmd,{ "\x0F", 06, 1} },
  242. { EndSyncResetCmd },
  243. { SetCrtcCmd, { "\x0E", IND_VSYNC_END, 0x01 } },
  244. { SetCrtcCmd, { "\x2D\x27\x28\x90\x2B\x80\xBF\x1F\x0\xC1\x0\x0\x0\x0\x0\x0\x9C\x8E\x8F\x14\x0\x96\xB9\xA2\xFF", 0x00, VGA_NUM_CRTC_PORTS } },
  245. { SetAttCmd, { "\x0\x13\x15\x17\x2\x4\x6\x7\x10\x11\x12\x13\x14\x15\x16\x17\x01\x0\x03\x0\x0", 0x00, VGA_NUM_ATTRIB_CONT_PORTS } },
  246. { SetGraphCmd,{ "\x0\x0\x0\x0\x0\x30\x0F\x00\x0FF ", 0x00, VGA_NUM_GRAPH_CONT_PORTS } },
  247. { TerminateCmd }
  248. }
  249. },
  250. //
  251. // Mode index 9
  252. // Color graphics mode 0x06, 640x200 2 colors.
  253. //
  254. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 80, 25, 640, 200, 80, 0x10000, MemMap_CGA,
  255. {
  256. { BeginSyncResetCmd },
  257. { SetSeqCmd, { "\x01\x01\x00\x06", 0x01, VGA_NUM_SEQUENCER_PORTS-1 } },
  258. { SetRegCmd, { "\x63", MISC_OUTPUT_REG_WRITE_PORT, 0x01 } },
  259. { SetGraphCmd,{ "\x0D", 06, 1} },
  260. { EndSyncResetCmd },
  261. { SetCrtcCmd, { "\x0E", IND_VSYNC_END, 0x01 } },
  262. { SetCrtcCmd, { "\x5F\x4F\x50\x82\x54\x80\xBF\x1F\x0\xC1\x0\x0\x0\x0\x0\x0\x9C\x8E\x8F\x28\x0\x96\xB9\xC2\xFF", 0x00, VGA_NUM_CRTC_PORTS } },
  263. { SetAttCmd, { "\x0\x17\x17\x17\x17\x17\x17\x17\x17\x17\x17\x17\x17\x17\x17\x17\x01\x0\x01\x0\x0", 0x00, VGA_NUM_ATTRIB_CONT_PORTS } },
  264. { SetGraphCmd,{ "\x0\x0\x0\x0\x0\x0\x0D\x0\x0FF", 0x00, VGA_NUM_GRAPH_CONT_PORTS } },
  265. { TerminateCmd }
  266. }
  267. },
  268. //
  269. // Mode index 10
  270. // Color graphics mode 0x0D, 320x200 16 colors.
  271. //
  272. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 4, 40, 25, 320, 200, 40, 0x10000, MemMap_VGA4Plane,
  273. {
  274. { BeginSyncResetCmd },
  275. { SetSeqCmd, { "\x09\x0F\x00\x06", 0x01, VGA_NUM_SEQUENCER_PORTS-1 } },
  276. { SetRegCmd, { "\x63", MISC_OUTPUT_REG_WRITE_PORT, 0x01 } },
  277. { SetGraphCmd,{ "\x05", 06, 1} },
  278. { EndSyncResetCmd },
  279. { SetCrtcCmd, { "\x0E", IND_VSYNC_END, 0x01 } },
  280. { SetCrtcCmd, { "\x2D\x27\x28\x90\x2B\x80\xBF\x1F\x0\xC0\x0\x0\x0\x0\x0\x0\x9C\x8E\x8F\x14\x0\x96\xB9\xE3\xFF", 0x00, VGA_NUM_CRTC_PORTS } },
  281. { SetAttCmd, { "\x0\x1\x2\x3\x4\x5\x6\x7\x10\x11\x12\x13\x14\x15\x16\x17\x01\x0\x0F\x0\x0", 0x00, VGA_NUM_ATTRIB_CONT_PORTS } },
  282. { SetGraphCmd,{ "\x0\x0\x0\x0\x0\x0\x05\x0F\x0FF", 0x00, VGA_NUM_GRAPH_CONT_PORTS } },
  283. { TerminateCmd }
  284. }
  285. },
  286. //
  287. // Mode index 11
  288. // Color graphics mode 0x0E, 640x200 16 colors.
  289. //
  290. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 4, 80, 25, 640, 200, 80, 0x10000, MemMap_VGA4Plane,
  291. {
  292. { BeginSyncResetCmd },
  293. { SetSeqCmd, { "\x01\x0F\x00\x06", 0x01, VGA_NUM_SEQUENCER_PORTS-1 } },
  294. { SetRegCmd, { "\x63", MISC_OUTPUT_REG_WRITE_PORT, 0x01 } },
  295. { SetGraphCmd,{ "\x05", 06, 1} },
  296. { EndSyncResetCmd },
  297. { SetCrtcCmd, { "\x0E", IND_VSYNC_END, 0x01 } },
  298. { SetCrtcCmd, { "\x5F\x4F\x50\x82\x54\x80\xBF\x1F\x0\xC0\x0\x0\x0\x0\x0\x0\x9C\x8E\x8F\x28\x0\x96\xB9\xE3\xFF", 0x00, VGA_NUM_CRTC_PORTS } },
  299. { SetAttCmd, { "\x0\x1\x2\x3\x4\x5\x6\x7\x10\x11\x12\x13\x14\x15\x16\x17\x01\x0\x0F\x0\x0", 0x00, VGA_NUM_ATTRIB_CONT_PORTS } },
  300. { SetGraphCmd,{ "\x0\x0\x0\x0\x0\x0\x05\x0F\x0FF", 0x00, VGA_NUM_GRAPH_CONT_PORTS } },
  301. { TerminateCmd }
  302. }
  303. },
  304. //
  305. // Mode index 12
  306. // Color graphics mode 0x10, 640x350 16 colors.
  307. //
  308. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 4, 80, 25, 640, 350, 80, 0x10000, MemMap_VGA4Plane,
  309. {
  310. { BeginSyncResetCmd },
  311. { SetSeqCmd, { "\x01\x0F\x00\x06", 0x01, VGA_NUM_SEQUENCER_PORTS-1 } },
  312. { SetRegCmd, { "\xA3", MISC_OUTPUT_REG_WRITE_PORT, 0x01 } },
  313. { SetGraphCmd,{ "\x05", 06, 1} },
  314. { EndSyncResetCmd },
  315. { SetCrtcCmd, { "\x05", IND_VSYNC_END, 0x01 } },
  316. { SetCrtcCmd, { "\x5F\x4F\x50\x82\x54\x80\xBF\x1F\x0\x40\x0\x0\x0\x0\x0\x0\x83\x85\x5D\x28\xF\x63\xBA\xE3\xFF", 0x00, VGA_NUM_CRTC_PORTS } },
  317. { SetAttCmd, { "\x0\x1\x2\x3\x4\x5\x14\x7\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F\x01\x0\x0F\x0\x0", 0x00, VGA_NUM_ATTRIB_CONT_PORTS } },
  318. { SetGraphCmd,{ "\x0\x0\x0\x0\x0\x0\x05\x0F\x0FF", 0x00, VGA_NUM_GRAPH_CONT_PORTS } },
  319. { TerminateCmd }
  320. }
  321. },
  322. //
  323. // Mode index 13
  324. // Color graphics mode 0x11, 640x480 2 colors.
  325. //
  326. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 80, 30, 640, 480, 80, 0x10000, MemMap_VGALinear,
  327. {
  328. { BeginSyncResetCmd },
  329. { SetSeqCmd, { "\x01\x0F\x00\x06", 0x01, VGA_NUM_SEQUENCER_PORTS-1 } },
  330. { SetRegCmd, { "\xE3", MISC_OUTPUT_REG_WRITE_PORT, 0x01 } },
  331. { SetGraphCmd,{ "\x05", 06, 1} },
  332. { EndSyncResetCmd },
  333. { SetCrtcCmd, { "\x0C", IND_VSYNC_END, 0x01 } },
  334. { SetCrtcCmd, { "\x5F\x4F\x50\x82\x54\x80\xB\x3E\x0\x40\x0\x0\x0\x0\x0\x0\xEA\x8C\xDF\x28\x0\xE7\x4\xC3\xFF", 0x00, VGA_NUM_CRTC_PORTS } },
  335. { SetAttCmd, { "\x0\x3F\x3F\x3F\x3F\x3F\x3F\x3F\x3F\x3F\x3F\x3F\x3F\x3F\x3F\x3F\x01\x0\x0F\x0\x0", 0x00, VGA_NUM_ATTRIB_CONT_PORTS } },
  336. { SetGraphCmd,{ "\x0\x0\x0\x0\x0\x0\x05\x01\x0FF", 0x00, VGA_NUM_GRAPH_CONT_PORTS } },
  337. { TerminateCmd }
  338. }
  339. },
  340. //
  341. // Mode index 14
  342. // Color graphics mode 0x12, 640x480 16 colors.
  343. //
  344. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 4, 80, 30, 640, 480, 80, 0x10000, MemMap_VGA4Plane,
  345. {
  346. { BeginSyncResetCmd },
  347. { SetSeqCmd, { "\x01\x0F\x00\x06", 0x01, VGA_NUM_SEQUENCER_PORTS-1 } },
  348. { SetRegCmd, { "\xE3", MISC_OUTPUT_REG_WRITE_PORT, 0x01 } },
  349. { SetGraphCmd,{ "\x05", 06, 1} },
  350. { EndSyncResetCmd },
  351. { SetCrtcCmd, { "\x05", IND_VSYNC_END, 0x01 } },
  352. { SetCrtcCmd, { "\x5F\x4F\x50\x82\x54\x80\xB\x3E\x0\x40\x0\x0\x0\x0\x0\x0\xEA\x8C\xDF\x28\x0\xE7\x4\xE3\xFF", 0x00, VGA_NUM_CRTC_PORTS } },
  353. { SetAttCmd, { "\x0\x1\x2\x3\x4\x5\x14\x7\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F\x01\x0\x0F\x0\x0", 0x00, VGA_NUM_ATTRIB_CONT_PORTS } },
  354. { SetGraphCmd,{ "\x0\x0\x0\x0\x0\x0\x05\x0F\x0FF", 0x00, VGA_NUM_GRAPH_CONT_PORTS } },
  355. { TerminateCmd }
  356. }
  357. },
  358. //
  359. // Mode index 15
  360. // Color graphics mode 0x13, 320x200 256 colors.
  361. //
  362. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 8, 40, 25, 320, 200, 320, 0x10000, MemMap_VGALinear,
  363. {
  364. { BeginSyncResetCmd },
  365. { SetSeqCmd, { "\x01\x0F\x00\x0E", 0x01, VGA_NUM_SEQUENCER_PORTS-1 } },
  366. { SetRegCmd, { "\x63", MISC_OUTPUT_REG_WRITE_PORT, 0x01 } },
  367. { SetGraphCmd,{ "\x05", 06, 1} },
  368. { EndSyncResetCmd },
  369. { SetCrtcCmd, { "\x0E", IND_VSYNC_END, 0x01 } },
  370. { SetCrtcCmd, { "\x5F\x4F\x50\x82\x54\x80\xBF\x1F\x0\x41\x0\x0\x0\x0\x0\x0\x9C\x8E\x8F\x28\x40\x96\xB9\xA3\xFF", 0x00, VGA_NUM_CRTC_PORTS } },
  371. { SetAttCmd, { "\x0\x1\x2\x3\x4\x5\x6\x7\x8\x9\x0A\x0B\x0C\x0D\x0E\x0F\x41\x0\x0F\x0\x0", 0x00, VGA_NUM_ATTRIB_CONT_PORTS } },
  372. { SetGraphCmd,{ "\x0\x0\x0\x0\x0\x40\x05\x0F\x0FF", 0x00, VGA_NUM_GRAPH_CONT_PORTS } },
  373. { TerminateCmd }
  374. }
  375. },
  376. //
  377. // Mode index 16
  378. // Color text mode 3, 720x480, 9x16 char cell (non-standard, provides 5 extra
  379. // lines of text).
  380. // Values not checked, because this is a non-standard mode and there's nothing
  381. // to compare it to, so it may or may not work.
  382. //
  383. { VIDEO_MODE_COLOR, 4, 80, 30, 720, 480, 160, 0x10000, MemMap_CGA,
  384. {
  385. { BeginSyncResetCmd },
  386. { SetSeqCmd, { "\x00\x03\x00\x02", 0x01, VGA_NUM_SEQUENCER_PORTS-1 } },
  387. { SetRegCmd, { "\xE7", MISC_OUTPUT_REG_WRITE_PORT, 0x01 } },
  388. { SetGraphCmd,{ "\x0E", 06, 1} },
  389. { EndSyncResetCmd },
  390. { SetCrtcCmd, { "\x0C", IND_VSYNC_END, 0x01 } },
  391. { SetCrtcCmd, { "\x5F\x4F\x50\x82\x55\x81\x0B\x3E\x0\x4F\xD\xE\x0\x0\x0\x0\xEA\x8C\xDF\x28\x1F\xE7\x04\xA3\xFF", 0x00, VGA_NUM_CRTC_PORTS } },
  392. { SetAttCmd, { "\x0\x1\x2\x3\x4\x5\x14\x7\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F\x4\x0\xF\x8\x0", 0x00, VGA_NUM_ATTRIB_CONT_PORTS } },
  393. { SetGraphCmd,{ "\x0\x0\x0\x0\x0\x10\x0E\x00\xFF", 0x00, VGA_NUM_GRAPH_CONT_PORTS } },
  394. { TerminateCmd }
  395. }
  396. },
  397. //
  398. // Mode index 17
  399. // Color text mode 3, 640x480, 8x16 char cell (non-standard, provides 5 extra
  400. // lines of text, can be used for plasma/LCD displays).
  401. // Values not checked, because this is a non-standard mode and there's nothing
  402. // to compare it to, so it may or may not work.
  403. //
  404. { VIDEO_MODE_COLOR, 4, 80, 30, 640, 480, 160, 0x10000, MemMap_CGA,
  405. {
  406. { BeginSyncResetCmd },
  407. { SetSeqCmd, { "\x01\x03\x00\x02", 0x01, VGA_NUM_SEQUENCER_PORTS-1 } },
  408. { SetRegCmd, { "\xE3", MISC_OUTPUT_REG_WRITE_PORT, 0x01 } },
  409. { SetGraphCmd,{ "\x0E", 06, 1} },
  410. { EndSyncResetCmd },
  411. { SetCrtcCmd, { "\x0C", IND_VSYNC_END, 0x01 } },
  412. { SetCrtcCmd, { "\x5F\x4F\x50\x82\x55\x81\x0B\x3E\x0\x4F\xD\xE\x0\x0\x0\x0\xEA\x8C\xDF\x28\x1F\xE7\x04\xA3\xFF", 0x00, VGA_NUM_CRTC_PORTS } },
  413. { SetAttCmd, { "\x0\x1\x2\x3\x4\x5\x14\x7\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F\x4\x0\xF\x0\x0", 0x00, VGA_NUM_ATTRIB_CONT_PORTS } },
  414. { SetGraphCmd,{ "\x0\x0\x0\x0\x0\x10\x0E\x00\xFF", 0x00, VGA_NUM_GRAPH_CONT_PORTS } },
  415. { TerminateCmd }
  416. }
  417. },
  418. //
  419. // Beginning of monochrome VGA modes.
  420. //
  421. //
  422. // Mode index 18
  423. // Mono text mode 7, 720x400, 9x16 char cell (VGA).
  424. //
  425. { 0, 0, 80, 25, 720, 400, 160, 0x10000, MemMap_Mono,
  426. {
  427. { BeginSyncResetCmd },
  428. { SetSeqCmd, { "\x00\x03\x00\x02", 0x01, VGA_NUM_SEQUENCER_PORTS-1 } },
  429. { SetRegCmd, { "\x66", MISC_OUTPUT_REG_WRITE_PORT, 0x01 } },
  430. { SetGraphCmd,{ "\x0A", 06, 1} },
  431. { EndSyncResetCmd },
  432. { SetCrtcCmd, { "\x0E", IND_VSYNC_END, 0x01 } },
  433. { SetCrtcCmd, { "\x5F\x4F\x50\x82\x55\x81\x0BF\x1F\x00\x47\x0D\x0E\x0\x0\x0\x0\x9C\x8E\x8F\x28\x0F\x96\x0B9\x0A3\x0FF", 0x00, VGA_NUM_CRTC_PORTS } },
  434. { SetAttCmd, { "\x0\x8\x8\x8\x8\x8\x8\x8\x10\x18\x18\x18\x18\x18\x18\x18\x06\x0\x0F\x08\x0", 0x00, VGA_NUM_ATTRIB_CONT_PORTS } },
  435. { SetGraphCmd,{ "\x0\x0\x0\x0\x0\x10\x0A\x00\x0FF", 0x00, VGA_NUM_GRAPH_CONT_PORTS } },
  436. { TerminateCmd }
  437. }
  438. },
  439. //
  440. // Mode index 19
  441. // Mono text mode 7, 640x400, 8x16 char cell (non-standard, can be used for
  442. // plasma displays).
  443. // Values not checked, because this is a non-standard mode and there's nothing
  444. // to compare it to, so it may or may not work.
  445. //
  446. { 0, 0, 80, 25, 640, 400, 160, 0x10000, MemMap_Mono,
  447. {
  448. { BeginSyncResetCmd },
  449. { SetSeqCmd, { "\x01\x03\x00\x02", 0x01, VGA_NUM_SEQUENCER_PORTS-1 } },
  450. { SetRegCmd, { "\x62", MISC_OUTPUT_REG_WRITE_PORT, 0x01 } },
  451. { SetGraphCmd,{ "\x0A", 06, 1} },
  452. { EndSyncResetCmd },
  453. { SetCrtcCmd, { "\x0E", IND_VSYNC_END, 0x01 } },
  454. { SetCrtcCmd, { "\x5F\x4F\x50\x82\x55\x81\x0BF\x1F\x00\x4F\x0D\x0E\x0\x0\x0\x0\x9C\x8E\x8F\x28\x0F\x96\x0B9\x0A3\x0FF", 0x00, VGA_NUM_CRTC_PORTS } },
  455. { SetAttCmd, { "\x0\x8\x8\x8\x8\x8\x8\x8\x10\x18\x18\x18\x18\x18\x18\x18\x06\x0\x0F\x00\x0", 0x00, VGA_NUM_ATTRIB_CONT_PORTS } },
  456. { SetGraphCmd,{ "\x0\x0\x0\x0\x0\x10\x0A\x00\x0FF", 0x00, VGA_NUM_GRAPH_CONT_PORTS } },
  457. { TerminateCmd }
  458. }
  459. },
  460. //
  461. // Mode index 20
  462. // Mono text mode 7, 720x350, 9x14 char cell (EGA).
  463. //
  464. { 0, 0, 80, 25, 720, 350, 160, 0x10000, MemMap_Mono,
  465. {
  466. { BeginSyncResetCmd },
  467. { SetSeqCmd, { "\x00\x03\x00\x02", 0x01, VGA_NUM_SEQUENCER_PORTS-1 } },
  468. { SetRegCmd, { "\xA6", MISC_OUTPUT_REG_WRITE_PORT, 0x01 } },
  469. { SetGraphCmd,{ "\x0A", 06, 1} },
  470. { EndSyncResetCmd },
  471. { SetCrtcCmd, { "\x05", IND_VSYNC_END, 0x01 } },
  472. { SetCrtcCmd, { "\x5F\x4F\x50\x82\x55\x81\x0BF\x1F\x00\x4D\x0B\x0C\x0\x0\x0\x0\x83\x85\x5D\x28\x0D\x63\x0BA\x0A3\x0FF", 0x00, VGA_NUM_CRTC_PORTS } },
  473. { SetAttCmd, { "\x0\x8\x8\x8\x8\x8\x8\x8\x10\x18\x18\x18\x18\x18\x18\x18\x06\x0\x0F\x08\x0", 0x00, VGA_NUM_ATTRIB_CONT_PORTS } },
  474. { SetGraphCmd,{ "\x0\x0\x0\x0\x0\x10\x0A\x00\x0FF", 0x00, VGA_NUM_GRAPH_CONT_PORTS } },
  475. { TerminateCmd }
  476. }
  477. },
  478. //
  479. // Mode index 21
  480. // Mono text mode 7, 640x350, 8x14 char cell (non-standard, can be used for
  481. // plasma displays).
  482. // Values not checked, because this is a non-standard mode and there's nothing
  483. // to compare it to, so it may or may not work.
  484. //
  485. { 0, 0, 80, 25, 640, 350, 160, 0x10000, MemMap_Mono,
  486. {
  487. { BeginSyncResetCmd },
  488. { SetSeqCmd, { "\x01\x03\x00\x02", 0x01, VGA_NUM_SEQUENCER_PORTS-1 } },
  489. { SetRegCmd, { "\xA2", MISC_OUTPUT_REG_WRITE_PORT, 0x01 } },
  490. { SetGraphCmd,{ "\x0A", 06, 1} },
  491. { EndSyncResetCmd },
  492. { SetCrtcCmd, { "\x05", IND_VSYNC_END, 0x01 } },
  493. { SetCrtcCmd, { "\x5F\x4F\x50\x82\x55\x81\x0BF\x1F\x00\x4D\x0B\x0C\x0\x0\x0\x0\x83\x85\x5D\x28\x0D\x63\x0BA\x0A3\x0FF", 0x00, VGA_NUM_CRTC_PORTS } },
  494. { SetAttCmd, { "\x0\x8\x8\x8\x8\x8\x8\x8\x10\x18\x18\x18\x18\x18\x18\x18\x06\x0\x0F\x00\x0", 0x00, VGA_NUM_ATTRIB_CONT_PORTS } },
  495. { SetGraphCmd,{ "\x0\x0\x0\x0\x0\x10\x0A\x00\x0FF", 0x00, VGA_NUM_GRAPH_CONT_PORTS } },
  496. { TerminateCmd }
  497. }
  498. },
  499. //
  500. // Mode index 22
  501. // Mono graphics mode 0x0F, 640x350 4 attributes.
  502. //
  503. { VIDEO_MODE_GRAPHICS, 0, 80, 25, 640, 350, 80, 0x10000, MemMap_VGA2Plane,
  504. {
  505. { BeginSyncResetCmd },
  506. { SetSeqCmd, { "\x01\x0F\x00\x06", 0x01, VGA_NUM_SEQUENCER_PORTS-1 } },
  507. { SetRegCmd, { "\xA2", MISC_OUTPUT_REG_WRITE_PORT, 0x01 } },
  508. { SetGraphCmd,{ "\x05", 06, 1} },
  509. { EndSyncResetCmd },
  510. { SetCrtcCmd, { "\x05", IND_VSYNC_END, 0x01 } },
  511. { SetCrtcCmd, { "\x5F\x4F\x50\x82\x54\x80\xBF\x1F\x0\x40\x0\x0\x0\x0\x0\x0\x83\x85\x5D\x28\xF\x63\xBA\xE3\xFF", 0x00, VGA_NUM_CRTC_PORTS } },
  512. { SetAttCmd, { "\x0\x8\x0\x0\x18\x18\x0\x0\x0\x8\x0\x0\x0\x18\x0\x0\x3\x0\x5\x0\x0", 0x00, VGA_NUM_ATTRIB_CONT_PORTS } },
  513. { SetGraphCmd,{ "\x0\x0\x0\x0\x0\x0\x5\xF\xFF", 0x00, VGA_NUM_GRAPH_CONT_PORTS } },
  514. { TerminateCmd }
  515. }
  516. }
  517. };
  518. //
  519. // Total # of video modes this driver supports.
  520. //
  521. #define NUM_VIDEO_MODES (sizeof(ModesVGA)/sizeof(VIDEOMODE))
  522. //
  523. // Memory map table -
  524. //
  525. // These memory maps are used to save and restore the physical video buffer.
  526. //
  527. MEMORYMAPS MemoryMaps[] = {
  528. // planes length start
  529. // ------ ------ -----
  530. {0, 0x08000, 0xB0000}, // all mono text modes (7)
  531. {0, 0x08000, 0xB8000}, // all color text modes (0, 1, 2, 3,
  532. // standard and non-standard),
  533. // CGA graphics modes (4, 5, 6),
  534. {1+2+4+8, 0x20000, 0xA0000}, // all VGA 4-plane graphics modes
  535. // (D, E, 10, 12)
  536. {1 +4, 0x20000, 0xA0000}, // all VGA 2-plane graphics modes (F)
  537. {0, 0x20000, 0xA0000}, // all VGA linear graphics modes
  538. // (11, 13)
  539. };