Source code of Windows XP (NT5)
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.

572 lines
16 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Copyright (c) 1993 Compaq Computer Corporation
  4. Module Name:
  5. Modeset.h
  6. Abstract:
  7. This module contains all the global data used by the Compaq QVision
  8. miniport driver.
  9. Environment:
  10. Kernel mode
  11. Revision History:
  12. --*/
  13. //---------------------------------------------------------------------------
  14. //
  15. // only one banking variable must be defined
  16. //
  17. #if TWO_32K_BANKS
  18. #if ONE_64K_BANK
  19. #error !!ERROR: two types of banking defined!
  20. #endif
  21. #elif ONE_64K_BANK
  22. #else
  23. #error !!ERROR: banking type must be defined!
  24. #endif
  25. //---------------------------------------------------------------------------
  26. #include "cmdcnst.h"
  27. #include "modeqv.h"
  28. //---------------------------------------------------------------------------
  29. //
  30. // Memory map table -
  31. //
  32. // These memory maps are used to save and restore the physical video buffer.
  33. //
  34. //
  35. // Memory map table definition
  36. //
  37. typedef struct {
  38. ULONG MaxSize; // Maximum addressable size of memory
  39. ULONG Start; // Start address of display memory
  40. } MEMORYMAPS;
  41. MEMORYMAPS MemoryMaps[] = {
  42. // length start
  43. // ------ -----
  44. { 0x08000, 0xB0000}, // all mono text modes (7)
  45. { 0x08000, 0xB8000}, // all color text modes (0, 1, 2, 3,
  46. { 0x20000, 0xA0000}, // all VGA graphics modes
  47. { 0x100000, 0xE00000}, // QVision linear frame buffer
  48. // (not yet implemented)
  49. };
  50. //
  51. // Video mode table - contains information and commands for initializing each
  52. // mode. These entries must correspond with those in VIDEO_MODE_VGA. The first
  53. // entry is commented; the rest follow the same format, but are not so
  54. // heavily commented.
  55. //
  56. //
  57. // The currently supported QVISION modes are only supported for
  58. // for non-interlaced monitors.
  59. //
  60. VIDEOMODE ModesVGA[] = {
  61. //////////////////////////////////////////////////////////////
  62. // Mode index 0
  63. // Color test mode 3, 720x400, 9x16 char cell (VGA)
  64. // BIOS mode: 0x03
  65. // Refresh rate: Hardware default
  66. //////////////////////////////////////////////////////////////
  67. {
  68. VIDEO_MODE_COLOR, // flags that this mode is a color mode, but not graphics
  69. 4, // four planes
  70. 1, // one bit of colour per plane
  71. 80, 25, // 80x25 text resolution
  72. 720, 400, // 720x400 pixels on screen
  73. 160, 0x10000, // 160 bytes per scan line, 64K of CPU-addressable bitmap
  74. NoBanking, // no banking supported or needed in this mode
  75. MemMap_CGA, // the memory mapping is the standard CGA memory mapping
  76. // of 32K at B8000
  77. vmem256k, // video memory required to run mode
  78. FALSE, // ModeValid default is always ok
  79. #ifdef INIT_INT10
  80. {0x03},
  81. #else
  82. {QV_TEXT_720x400x4},
  83. #endif
  84. //
  85. // $0005 - MikeD - 02/08/94
  86. // Daytona support added value for ulRefreshRate and index for QVCMDS
  87. //
  88. USE_HARDWARE_DEFAULT, // refresh rate
  89. QV_TEXT_720x400x4_INDEX
  90. },
  91. //////////////////////////////////////////////////////////////
  92. // Mode index 1
  93. // Color text mode 3, 640x350, 8x14 char cell (EGA)
  94. // BIOS mode:0x10
  95. // Refresh rate: Hardware default
  96. //////////////////////////////////////////////////////////////
  97. { VIDEO_MODE_COLOR, // flags that this mode is a color mode, but not graphics
  98. 4, // four planes
  99. 1, // one bit of colour per plane
  100. 80, 25, // 80x25 text resolution
  101. 640, 350, // 640x350 pixels on screen
  102. 160, 0x10000, // 160 bytes per scan line, 64K of CPU-addressable bitmap
  103. NoBanking, // no banking supported or needed in this mode
  104. MemMap_CGA, // the memory mapping is the standard CGA memory mapping
  105. // of 32K at B8000
  106. vmem256k, // video memory required to run mode
  107. FALSE, // ModeValid default is always ok
  108. #ifdef INIT_INT10
  109. {0x10},
  110. #else
  111. {QV_TEXT_640x350x4},
  112. #endif
  113. //
  114. // $0005 - MikeD - 02/08/94
  115. // Daytona support added value for ulRefreshRate and index for QVCMDS
  116. //
  117. USE_HARDWARE_DEFAULT, // refresh rate
  118. QV_TEXT_640x350x4_INDEX
  119. },
  120. //////////////////////////////////////////////////////////////
  121. // Mode index 2
  122. // Standard VGA Color graphics, 640x480x4 - 16 colors
  123. // BIOS mode: 0x12
  124. // Refresh rate: Hardware default
  125. //////////////////////////////////////////////////////////////
  126. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 4, 1, 80, 30,
  127. 640, 480, 80, 0x10000, NoBanking, MemMap_VGA,
  128. vmem256k, // video memory required to run mode
  129. FALSE, // ModeValid default is always ok
  130. #ifdef INIT_INT10
  131. {0x12},
  132. #else
  133. {QV_TEXT_640x480x4},
  134. #endif
  135. //
  136. // $0005 - MikeD - 02/08/94
  137. // Daytona support added value for ulRefreshRate and index for QVCMDS
  138. //
  139. USE_HARDWARE_DEFAULT, // refresh rate
  140. QV_TEXT_640x480x4_INDEX
  141. },
  142. //////////////////////////////////////////////////////////////
  143. // Mode index 3
  144. // Standard VGA Color graphics, 640x480x4 - 16 colors
  145. // BIOS mode: 0x12
  146. // Refresh rate: 60Hz
  147. //////////////////////////////////////////////////////////////
  148. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 4, 1, 80, 30,
  149. 640, 480, 80, 0x10000, NoBanking, MemMap_VGA,
  150. vmem256k, // video memory required to run mode
  151. FALSE, // ModeValid default is always ok
  152. #ifdef INIT_INT10
  153. {0x12},
  154. #else
  155. {QV_TEXT_640x480x4},
  156. #endif
  157. //
  158. // $0005 - MikeD - 02/08/94
  159. // Daytona support added value for ulRefreshRate and index for QVCMDS
  160. //
  161. 60, // refresh rate
  162. QV_TEXT_640x480x4_INDEX
  163. },
  164. //////////////////////////////////////////////////////////////
  165. // Mode index 4
  166. // VGA Color graphics, 640x480x8 - 256 colors
  167. // BIOS mode: 0x32
  168. // Refresh rate: Hardware default
  169. //////////////////////////////////////////////////////////////
  170. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 8, 80, 30,
  171. 640, 480, 1024, 0x80000, NormalBanking, MemMap_VGA,
  172. vmem512k, // video memory required to run mode
  173. FALSE, // ModeValid default is always ok
  174. #ifdef INIT_INT10
  175. {0x32},
  176. #else
  177. {QV_640x480x8},
  178. #endif
  179. //
  180. // $0005 - MikeD - 02/08/94
  181. // Daytona support added value for ulRefreshRate and index for QVCMDS
  182. //
  183. USE_HARDWARE_DEFAULT, // refresh rate
  184. QV_640x480x8_INDEX
  185. },
  186. //////////////////////////////////////////////////////////////
  187. // Mode index 5
  188. // VGA Color graphics, 640x480x8 - 256 colors
  189. // BIOS mode: 0x32
  190. // Refresh rate: 60Hz
  191. //////////////////////////////////////////////////////////////
  192. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 8, 80, 30,
  193. 640, 480, 1024, 0x80000, NormalBanking, MemMap_VGA,
  194. vmem512k, // video memory required to run mode
  195. FALSE, // ModeValid default is always ok
  196. #ifdef INIT_INT10
  197. {0x32},
  198. #else
  199. {QV_640x480x8},
  200. #endif
  201. //
  202. // $0005 - MikeD - 02/08/94
  203. // Daytona support added value for ulRefreshRate and index for QVCMDS
  204. //
  205. 60, // refresh rate
  206. QV_640x480x8_INDEX
  207. },
  208. //////////////////////////////////////////////////////////////
  209. // Mode index 6
  210. // SVGA color graphics, 800x600x8 - 256 colors
  211. // BIOS Mode: 0x34.
  212. // Refresh rate: Hardware default
  213. //////////////////////////////////////////////////////////////
  214. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 8, 100, 37,
  215. 800, 600, 1024, 0x100000, NormalBanking, MemMap_VGA,
  216. vmem1Meg, // video memory required to run mode
  217. FALSE, // ModeValid default is always ok
  218. #ifdef INIT_INT10
  219. {0x34}, // mode is not supported by BIOS
  220. #else
  221. {QV_800x600x8},
  222. #endif
  223. //
  224. // $0005 - MikeD - 02/08/94
  225. // Daytona support added value for ulRefreshRate and index for QVCMDS
  226. //
  227. USE_HARDWARE_DEFAULT, // refresh rate
  228. QV_800x600x8_INDEX
  229. },
  230. //////////////////////////////////////////////////////////////
  231. // Mode index 7
  232. // SVGA color graphics, 800x600x8 - 256 colors
  233. // BIOS Mode: 0x34.
  234. // Refresh rate: 60Hz
  235. //////////////////////////////////////////////////////////////
  236. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 8, 100, 37,
  237. 800, 600, 1024, 0x100000, NormalBanking, MemMap_VGA,
  238. vmem1Meg, // video memory required to run mode
  239. FALSE, // ModeValid default is always ok
  240. #ifdef INIT_INT10
  241. {0x34}, // mode is not supported by BIOS
  242. #else
  243. {QV_800x600x8},
  244. #endif
  245. //
  246. // $0005 - MikeD - 02/08/94
  247. // Daytona support added value for ulRefreshRate and index for QVCMDS
  248. //
  249. 60, // refresh rate
  250. QV_800x600x8_INDEX
  251. },
  252. //////////////////////////////////////////////////////////////
  253. // Mode index 8
  254. // SVGA color graphics, 800x600x8 - 256 colors
  255. // BIOS Mode: 0x34.
  256. // Refresh rate: 72Hz
  257. //////////////////////////////////////////////////////////////
  258. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 8, 100, 37,
  259. 800, 600, 1024, 0x100000, NormalBanking, MemMap_VGA,
  260. vmem1Meg, // video memory required to run mode
  261. FALSE, // ModeValid default is always ok
  262. #ifdef INIT_INT10
  263. {0x34}, // mode is not supported by BIOS
  264. #else
  265. {QV_800x600x8},
  266. #endif
  267. //
  268. // $0005 - MikeD - 02/08/94
  269. // Daytona support added value for ulRefreshRate and index for QVCMDS
  270. //
  271. 72, // refresh rate
  272. QV_800x600x8_INDEX
  273. },
  274. //////////////////////////////////////////////////////////////
  275. // Mode index 9
  276. // SVGA color graphics, 1024x768x8 - 256 colors
  277. // BIOS mode:0x38
  278. // Refresh rate: Hardware default
  279. //////////////////////////////////////////////////////////////
  280. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 8, 128, 48,
  281. 1024, 768, 1024, 0x100000, NormalBanking, MemMap_VGA,
  282. vmem1Meg, // video memory required to run mode
  283. FALSE, // ModeValid default is always ok
  284. #ifdef INIT_INT10
  285. {0x38},
  286. #else
  287. {QV_1024x768x8},
  288. #endif
  289. //
  290. // $0005 - MikeD - 02/08/94
  291. // Daytona support added value for ulRefreshRate and index for QVCMDS
  292. //
  293. USE_HARDWARE_DEFAULT, // refresh rate
  294. QV_1024x768x8_INDEX
  295. },
  296. //////////////////////////////////////////////////////////////
  297. // Mode index 10
  298. // SVGA color graphics, 1024x768x8 - 256 colors
  299. // BIOS mode:0x38
  300. // Refresh rate: 60Hz
  301. //////////////////////////////////////////////////////////////
  302. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 8, 128, 48,
  303. 1024, 768, 1024, 0x100000, NormalBanking, MemMap_VGA,
  304. vmem1Meg, // video memory required to run mode
  305. FALSE, // ModeValid default is always ok
  306. #ifdef INIT_INT10
  307. {0x38},
  308. #else
  309. {QV_1024x768x8},
  310. #endif
  311. //
  312. // $0005 - MikeD - 02/08/94
  313. // Daytona support added value for ulRefreshRate and index for QVCMDS
  314. //
  315. 60, // refresh rate
  316. QV_1024x768x8_INDEX
  317. },
  318. //////////////////////////////////////////////////////////////
  319. // Mode index 11
  320. // SVGA color graphics, 1024x768x8 - 256 colors
  321. // BIOS mode:0x38
  322. // Refresh rate: 66Hz
  323. //////////////////////////////////////////////////////////////
  324. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 8, 128, 48,
  325. 1024, 768, 1024, 0x100000, NormalBanking, MemMap_VGA,
  326. vmem1Meg, // video memory required to run mode
  327. FALSE, // ModeValid default is always ok
  328. #ifdef INIT_INT10
  329. {0x38},
  330. #else
  331. {QV_1024x768x8},
  332. #endif
  333. //
  334. // $0005 - MikeD - 02/08/94
  335. // Daytona support added value for ulRefreshRate and index for QVCMDS
  336. //
  337. 66, // refresh rate
  338. QV_1024x768x8_INDEX
  339. },
  340. //////////////////////////////////////////////////////////////
  341. // Mode index 12
  342. // SVGA color graphics, 1024x768x8 - 256 colors
  343. // BIOS mode:0x38
  344. // Refresh rate: 72Hz
  345. //////////////////////////////////////////////////////////////
  346. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 8, 128, 48,
  347. 1024, 768, 1024, 0x100000, NormalBanking, MemMap_VGA,
  348. vmem1Meg, // video memory required to run mode
  349. FALSE, // ModeValid default is always ok
  350. #ifdef INIT_INT10
  351. {0x38},
  352. #else
  353. {QV_1024x768x8},
  354. #endif
  355. //
  356. // $0005 - MikeD - 02/08/94
  357. // Daytona support added value for ulRefreshRate and index for QVCMDS
  358. //
  359. 72, // refresh rate
  360. QV_1024x768x8_INDEX
  361. },
  362. //////////////////////////////////////////////////////////////
  363. // Mode index 13
  364. // SVGA color graphics, 1024x768x8 - 256 colors
  365. // BIOS mode:0x38
  366. // Refresh rate: 75Hz
  367. //////////////////////////////////////////////////////////////
  368. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 8, 128, 48,
  369. 1024, 768, 1024, 0x100000, NormalBanking, MemMap_VGA,
  370. vmem1Meg, // video memory required to run mode
  371. FALSE, // ModeValid default is always ok
  372. #ifdef INIT_INT10
  373. {0x38},
  374. #else
  375. {QV_1024x768x8},
  376. #endif
  377. //
  378. // $0005 - MikeD - 02/08/94
  379. // Daytona support added value for ulRefreshRate and index for QVCMDS
  380. //
  381. 75, // refresh rate
  382. QV_1024x768x8_INDEX
  383. },
  384. //////////////////////////////////////////////////////////////
  385. // Mode index 14
  386. // SVGA color graphics, 1280x1024x8 - 256 colors
  387. // BIOS mode: 3A
  388. // Refresh rate: Hardware default
  389. //////////////////////////////////////////////////////////////
  390. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 8, 128, 48,
  391. 1280, 1024, 2048, 0x200000, NormalBanking, MemMap_VGA,
  392. vmem2Meg, // video memory required to run mode
  393. FALSE, // ModeValid default is always ok
  394. #ifdef INIT_INT10
  395. {0x3A},
  396. #else
  397. {QV_1280x1024x8},
  398. #endif
  399. //
  400. // $0005 - MikeD - 02/08/94
  401. // Daytona support added value for ulRefreshRate and index for QVCMDS
  402. //
  403. USE_HARDWARE_DEFAULT, // refresh rate
  404. QV_1280x1024x8_INDEX
  405. },
  406. //////////////////////////////////////////////////////////////
  407. // Mode index 15
  408. // SVGA color graphics, 1280x1024x8 - 256 colors
  409. // BIOS mode: 3A
  410. // Refresh rate: 60Hz
  411. //////////////////////////////////////////////////////////////
  412. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 8, 128, 48,
  413. 1280, 1024, 2048, 0x200000, NormalBanking, MemMap_VGA,
  414. vmem2Meg, // video memory required to run mode
  415. FALSE, // ModeValid default is always ok
  416. #ifdef INIT_INT10
  417. {0x3A},
  418. #else
  419. {QV_1280x1024x8},
  420. #endif
  421. //
  422. // $0005 - MikeD - 02/08/94
  423. // Daytona support added value for ulRefreshRate and index for QVCMDS
  424. //
  425. 60, // refresh rate
  426. QV_1280x1024x8_INDEX
  427. },
  428. //////////////////////////////////////////////////////////////
  429. // Mode index 16
  430. // SVGA color graphics, 1280x1024x8 - 256 colors
  431. // BIOS mode: 3A
  432. // Refresh rate: 68Hz
  433. //////////////////////////////////////////////////////////////
  434. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 8, 128, 48,
  435. 1280, 1024, 2048, 0x200000, NormalBanking, MemMap_VGA,
  436. vmem2Meg, // video memory required to run mode
  437. FALSE, // ModeValid default is always ok
  438. #ifdef INIT_INT10
  439. {0x3A},
  440. #else
  441. {QV_1280x1024x8},
  442. #endif
  443. //
  444. // $0005 - MikeD - 02/08/94
  445. // Daytona support added value for ulRefreshRate and index for QVCMDS
  446. //
  447. 68, // refresh rate
  448. QV_1280x1024x8_INDEX
  449. },
  450. //////////////////////////////////////////////////////////////
  451. // Mode index 17
  452. // SVGA color graphics, 1280x1024x8 - 256 colors
  453. // BIOS mode: 3A
  454. // Refresh rate: 75Hz
  455. //////////////////////////////////////////////////////////////
  456. { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 8, 128, 48,
  457. 1280, 1024, 2048, 0x200000, NormalBanking, MemMap_VGA,
  458. vmem2Meg, // video memory required to run mode
  459. FALSE, // ModeValid default is always ok
  460. #ifdef INIT_INT10
  461. {0x3A},
  462. #else
  463. {QV_1280x1024x8},
  464. #endif
  465. //
  466. // $0005 - MikeD - 02/08/94
  467. // Daytona support added value for ulRefreshRate and index for QVCMDS
  468. //
  469. 76, // refresh rate
  470. QV_1280x1024x8_INDEX
  471. },
  472. }; // ModesVGA
  473. ULONG NumVideoModes = sizeof(ModesVGA) / sizeof(VIDEOMODE);
  474. //
  475. //
  476. // Data used to set the Graphics and Sequence Controllers to put the
  477. // VGA into a planar state at A0000 for 64K, with plane 2 enabled for
  478. // reads and writes, so that a font can be loaded, and to disable that mode.
  479. //
  480. // Settings to enable planar mode with plane 2 enabled.
  481. //
  482. USHORT EnableA000Data[] = {
  483. OWM,
  484. SEQ_ADDRESS_PORT,
  485. 1,
  486. 0x0100,
  487. OWM,
  488. GRAPH_ADDRESS_PORT,
  489. 3,
  490. 0x0204, // Read Map = plane 2
  491. 0x0005, // Graphics Mode = read mode 0, write mode 0
  492. 0x0406, // Graphics Miscellaneous register = A0000 for 64K, not odd/even,
  493. // graphics mode
  494. OWM,
  495. SEQ_ADDRESS_PORT,
  496. 3,
  497. 0x0402, // Map Mask = write to plane 2 only
  498. 0x0404, // Memory Mode = not odd/even, not full memory, graphics mode
  499. 0x0300, // end sync reset
  500. EOD
  501. };
  502. //
  503. // Settings to disable the font-loading planar mode.
  504. //
  505. USHORT DisableA000Color[] = {
  506. OWM,
  507. SEQ_ADDRESS_PORT,
  508. 1,
  509. 0x0100,
  510. OWM,
  511. GRAPH_ADDRESS_PORT,
  512. 3,
  513. 0x0004, 0x1005, 0x0E06,
  514. OWM,
  515. SEQ_ADDRESS_PORT,
  516. 3,
  517. 0x0302, 0x0204, 0x0300, // end sync reset
  518. EOD
  519. };
  520.