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.

372 lines
11 KiB

  1. ;++
  2. ;
  3. ; Copyright (c) 1989 Microsoft Corporation
  4. ;
  5. ; Module Name:
  6. ;
  7. ; video.inc
  8. ;
  9. ; Abstract:
  10. ;
  11. ; This module implements the assembley definitions necessary to determine
  12. ; display adapter type.
  13. ;
  14. ; Author:
  15. ;
  16. ; Shie-Lin Tzong (shielint) 15-July-1991.
  17. ; Most of the stuff is extracted from win31 setup code.
  18. ;
  19. ; Environment:
  20. ;
  21. ; 80x86 Real Mode.
  22. ;
  23. ; Revision History:
  24. ;
  25. ;
  26. ;--
  27. ;
  28. ; Display type definitions.
  29. ; BIT 16-31 Defines video adapter type
  30. ; bit 0 0 - color; 1 - mono
  31. ; bit 1-7 Reserved
  32. ; bit 8-15 Adapter specific information.
  33. ;
  34. VD_UNKNOWN EQU 0
  35. VD_COLOR EQU 0
  36. VD_MONO EQU 1
  37. VD_VGA EQU 10000h
  38. VD_COMPAQ_AVGA EQU 20000H
  39. VD_COMPAQ_QVIS EQU 30000H
  40. VD_8514 EQU 40000H
  41. VD_GENOA_VGA EQU 50000H
  42. VD_VIDEO7_VGA EQU 60000H
  43. VD_TRIDENT_VGA EQU 70000H
  44. VD_PARADISE_VGA EQU 80000H
  45. VD_ATI_VGA EQU 90000H
  46. VD_TSENGLAB_VGA EQU 0A0000H
  47. VD_CIRRUS_VGA EQU 0B0000H
  48. VD_DELL_DGX EQU 0C0000H
  49. VD_S3 EQU 0D0000H
  50. VD_NCR_77C22 EQU 0E0000H
  51. VD_WD_90C EQU 0F0000H
  52. VD_XGA EQU 100000H
  53. IFDEF NEC_98
  54. VD_PC9801 EQU 010000h
  55. ENDIF ; NEC_98
  56. ;
  57. ; Monitor type for 8514
  58. ; NOte, 0 is not used.
  59. ;
  60. VF_MONITOR_VGA EQU 100h ; Stand VGA
  61. VF_MONITOR_MONO_8503 EQU 200h ; mono 8503
  62. VF_MONITOR_GAD_8514 EQU 300h ; 8514 type monitor
  63. ;
  64. ; Video 7 VGA specific flags
  65. ;
  66. VF_V7_VRAM EQU 100H
  67. VF_V7_DRAM EQU 200H
  68. ;
  69. ; NCR 77C2x specific flags
  70. ;
  71. VF_NCR_77C22E EQU 100H
  72. ;
  73. ; WD90Cxx specific flags
  74. ;
  75. VF_WD_00 EQU 100H
  76. VF_WD_30 EQU 200H
  77. VF_WD_31 EQU 300H
  78. ;
  79. ; Trident VGA specific flags
  80. ;
  81. VF_TVGA_9100 EQU 100h
  82. ;
  83. ; Paradise VGA specific flags
  84. ;
  85. VF_PVGA_PROM EQU 100h ; with Paradise ROM
  86. VF_PVGA_CHIP_1F EQU 200h ; with 1F chip
  87. ;
  88. ; ATI VGA specific flags
  89. ;
  90. VF_ATIVGA_WONDDER3 EQU 100h
  91. ;
  92. ; Tseng Lab VGA specific flags
  93. ;
  94. VF_TLVGA_ET3000 EQU 0
  95. VF_TLVGA_ET4000 EQU 100h
  96. ;
  97. ; Cirrus Logic VGA specific definitions
  98. ;
  99. VF_CLVGA_REVC EQU 100h ; 610/620 rev C
  100. ;
  101. ; 070193 - adrianc
  102. ; Added the Cirrus chip detection for COMPAQ servers.
  103. ;
  104. VF_CLVGA_5420r0 EQU 200h ; COMPAQ Cirrus implementations
  105. VF_CLVGA_5420r1 EQU 300h
  106. VF_CLVGA_5428 EQU 400h
  107. VF_CLVGA_542x EQU 500h
  108. ;
  109. ; Equates for 8514 register ports.
  110. ;
  111. ERR_TERM equ 92e8h ; 8514 error term register.
  112. SUBSYS_STAT equ 42e8h ; 8514 Subsystem status register.
  113. ;
  114. ; Video display register equates
  115. ; ...Colr are for CGA and EGA color modes
  116. ; ...Mono are for EGA/VGA monochrome modes
  117. ;
  118. ;NAMING CONVENTIONS
  119. ; pXXXXX is a I/O port definition
  120. ; fXXXXX is a bit mask
  121. ; bXXXXX is a bit number
  122. ; mXXXXX is a bit mask (multiple fXXXX)
  123. ; vXXXXX is a value to output/input to/from a port
  124. ; xXXXXX is a specific index
  125. ;
  126. ; CRT registers
  127. ;
  128. pCRTCIndxColr EQU 3D4h ; CRTC index register
  129. pCRTCIndxMono EQU 3B4h
  130. pCRTCDataColr EQU 3D5h ; CRTC data register
  131. pCRTCDataMono EQU 3B5h
  132. ; Status register
  133. ;
  134. pStatColr EQU 3DAh ; Status register
  135. pStatMono EQU 3BAh
  136. fStatEna EQU 00000001b ; Video RAM access OK for processor
  137. fStatLPTr EQU 00000010b ; Light pen triggered
  138. fStatLPSw EQU 00000100b ; Light pen switch is "on"
  139. fStatVRTC EQU 00001000b ; Vertical retrace in progress
  140. mStat_IVal EQU fStatEna+fStatVRTC ; Initial value for pseudo status
  141. ;
  142. ; Feature control
  143. ;
  144. pFeatColr EQU pStatColr ; Feature control
  145. pFeatMono EQU pStatMono
  146. pFeatVGAIn EQU 3CAh ; VGA feature control read
  147. fFeatFC0 EQU 00000001b ; FC0
  148. fFeatFC1 EQU 00000010b ; FC1
  149. ;
  150. ; Light pen
  151. ;
  152. pLPen1Colr EQU 3DBh ; Light pen latch clear
  153. pLPen1Mono EQU 3BBh
  154. pLPen2Colr EQU 3DCh ; Light pen latch set
  155. pLPen2Mono EQU 3BCh
  156. ;
  157. ; Misc input/output
  158. ;
  159. pMisc EQU 3C2h ; Miscellaneous output
  160. pMiscIn EQU 3CCh ; VGA read Misc. output
  161. fMiscPNum EQU 00000001b ; 3Dx port numbers(vs. 3Bx)
  162. fMiscREna EQU 00000010b ; Ram enable
  163. fMiscDot EQU 00001100b ; Dot clock select
  164. fMiscOSrc EQU 00010000b ; Output source
  165. fMiscPage EQU 00100000b ; Page bit for odd/even mode
  166. fMiscHPol EQU 01000000b ; Horizontal retrace polarity
  167. fMiscVPol EQU 10000000b ; Vertical retrace polarity
  168. mMiscCRTC EQU fMiscREna+fMiscPage ; Mask for CRTC bits
  169. mMiscMemC EQU 0FFh - mMiscCRTC ; Mask for MemC bits
  170. ;
  171. ; Misc. status
  172. ;
  173. pStt0EGA EQU pMisc ; Miscellaneous status
  174. fStt0Swit EQU 00010000b ; Switch sense(addr'd by dot clk sel)
  175. fStt0FCI0 EQU 00100000b ; Feature card input 0
  176. fStt0FCI1 EQU 01000000b ; Feature card input 1
  177. fStt0VRTC EQU 10000000b ; VRTC
  178. ;
  179. ; Attribute control
  180. ;
  181. pAttr EQU 3C0h ; Attribute(palette) address/data
  182. fVAI_Indx EQU 10000000b ; sign bit of Attribute index is
  183. bVAI_Indx EQU 7 ; flag indicating port is index
  184. fVAI_ScOn EQU 00100000b ; Indicates screen is on
  185. bVAI_ScOn EQU 5
  186. ;
  187. ; Sequencer
  188. ;
  189. pSeqIndx EQU 3C4h ; Sequencer address
  190. pSeqData EQU 3C5h ; Sequencer data
  191. fSeq0ARst EQU 00000001b ; 0:Async reset
  192. fSeq0SRst EQU 00000010b ; 0:Sync reset
  193. fSeq1DPCh EQU 00000001b ; 1:Dots per character
  194. fSeq1BWid EQU 00000010b ; 1:Band Width
  195. fSeq1ShLd EQU 00000100b ; 1:Shift load(0=every char, 1=skip)
  196. fSeq1DClk EQU 00001000b ; 1:Dot clock(=1 if halved)
  197. mSeq2WMsk EQU 00001111b ; 2:Write mask
  198. mSeq3ChrB EQU 00000011b ; 3:Char map B select(attr bit 3 = 0)
  199. mSeq3ChrA EQU 00001100b ; 3:Char map A select(attr bit 3 = 1)
  200. fSeq4Alph EQU 00000001b ; 4:Alpha mode(char gen enabled)
  201. fSeq4ExtM EQU 00000010b ; 4:Extended memory installed
  202. fSeq4SqAd EQU 00000100b ; 4:Seq'l mem addr'ing(vs. odd/even)
  203. fSeq4Chain4 EQU 00001000b ; 4:Chain 4 (double odd/even) for
  204. ; 256 color (mode 13)
  205. fSeqF9extpgsel EQU 00000001b ;V7F9:Extended page select
  206. fSeqFCext256m EQU 00000010b ;V7FC:Extended 256 color mode
  207. fSeqFCext256e EQU 00000100b ;V7FC:Extended 256 color enable
  208. fSeqFCseqChain4 EQU 00100000b ;V7FC:Sequential Chain 4
  209. ;
  210. ; Graphic controller
  211. ;
  212. pGrp1Pos EQU 3CCh ; Graphics posn 1(=0)
  213. pGrp2Pos EQU 3CAh ; Graphics posn 2(=1)
  214. pGrpIndx EQU 3CEh ; Graphics controller address
  215. pGrpData EQU 3CFh ; Graphics controller data
  216. fGrp0StV0 EQU 00000001b ; 0:Value for plane 0 if enabled
  217. fGrp0StV1 EQU 00000010b ; 0:Value for plane 1 if enabled
  218. fGrp0StV2 EQU 00000100b ; 0:Value for plane 2 if enabled
  219. fGrp0StV3 EQU 00001000b ; 0:Value for plane 3 if enabled
  220. fGrp1Ena0 EQU 00000001b ; 1:Enable for plane 0
  221. fGrp1Ena1 EQU 00000010b ; 1:Enable for plane 1
  222. fGrp1Ena2 EQU 00000100b ; 1:Enable for plane 2
  223. fGrp1Ena3 EQU 00001000b ; 1:Enable for plane 3
  224. mGrp2Colr EQU 00001111b ; 2:Color compare value
  225. mGrp3RCnt EQU 00000111b ; 3:Rotate left count for mode 0
  226. mGrp3Func EQU 00011000b ; 3:Function for modes 0 and 2
  227. mGrp4RMsk EQU 00000111b ; 4:Read map select
  228. mGrp5WMod EQU 00000011b ; 5:Write mode
  229. fGrp5Test EQU 00000100b ; 5:Test condition
  230. fGrp5RMod EQU 00001000b ; 5:Read mode(0=plane,1=compare)
  231. fGrp5SqAd EQU 00010000b ; 5:Seq'l mem addr'ing(vs. odd/even)
  232. fGrp5CGA EQU 00100000b ; 5:CGA 4 color mode addressing
  233. fGrp6Char EQU 00000001b ; 6:Char or graphics
  234. fGrp6Chain EQU 00000010b ; 6:Chain odd maps after even
  235. mGrp6Addr EQU 00001100b ; 6:Processor view of VRAM start addr
  236. ; 00=A000 for 128kb
  237. ; 01=A000 for 64kb
  238. ; 10=B000 for 32kb
  239. ; 11=B800 for 32kb
  240. bGrp6Addr EQU 2 ; First of 2 bits for start addr
  241. mGrp7Colr EQU 00001111b ; 7:Color don't care for read compare
  242. ; 8:Mask: use latch value vs. data
  243. ;
  244. ; VGA subsystem enable
  245. ;
  246. pVGAEna EQU 3C3h ; VGA enable register
  247. fVGAEna EQU 00000001b ; Enable access to VGA
  248. ;
  249. ; VGA DAC
  250. ;
  251. pDACWindx EQU 3C8h ; DAC Write index(R/W)
  252. pDACRindx EQU 3C7h ; DAC Read index(RO)
  253. pDACState EQU pDACRindx ; DAC state
  254. pDACData EQU 3C9h ; DAC data(3 successive accesses)
  255. pDACMask EQU 3CAh ; DAC mask
  256. ;
  257. ; VGA read access to write only registers
  258. ;
  259. pMiscRead EQU 3CCh ; Port to read Misc output register
  260. pFeatRead EQU 3CAh ; Port to read Feature output register
  261. ;
  262. ; 8514 DAC
  263. ;
  264. p8514DACWindx EQU 2ECh ; DAC Write index(R/W)
  265. p8514DACRindx EQU 2EBh ; DAC Read index(RO)
  266. p8514DACState EQU pDACRindx ; DAC state
  267. p8514DACData EQU 2EDh ; DAC data(3 successive accesses)
  268. ;
  269. ; values returned from reads of port pDACState:
  270. ;
  271. vDAC_Read_Mode EQU 0
  272. vDAC_Write_Mode EQU 3
  273. xC_CTMiscRead EQU 0Fh ; CHIPS Misc output read index
  274. xC_CTFeatRead EQU 0Eh ; CHIPS Feat output read index
  275. xC_CT400 EQU 0F9h ; CHIPS 400 line reg index
  276. xC_CTTempFE EQU 0FEh ; CHIPS CRTC temp reg FEh
  277. xG_CTCtl EQU 0F7h ; CHIPS control reg index
  278. ;
  279. pCMode EQU 3C6h ; Control mode(Compaq specific)
  280. ATiVGA_extended_reg EQU 01ceh
  281. TVGA_3C5_B_WrMode equ 0
  282. TVGA_3C5_B_RdMode equ 1
  283. ;
  284. ; Definition for IBM XGA video adapter Id.
  285. ;
  286. IBM_XGA_ID_LOW EQU 8FD8h
  287. IBM_XGA_ID_HIGH EQU 8FDBh
  288. MCA_POS_DATA_SIZE EQU 6
  289. ;
  290. ; Misc. V7 VRAM definitions
  291. ;
  292. VRAM2_ROM_ID_1 EQU 108h
  293. VRAM2_ROM_ID_2 EQU 208h
  294. VRAM2ERGO_ROM_ID EQU 308h
  295. V7_ID_OFFSET EQU 86h ; The offset to V7VGA ROM id
  296. ;
  297. ; WD extended registers
  298. ;
  299. WD_EXT_IO_PORT EQU 23C0h
  300. ;
  301. ; Misc. definitions
  302. ;
  303. FONT_POINTERS EQU 700h ; physical addr to store font pointers
  304. ; This is also the DOS loaded area
  305. VIDEO_SEG EQU 0C000h ; Video memory segment