home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v5.zip / DDKX86 / SRC / VDH / VDH.INC < prev    next >
Text File  |  1995-04-14  |  10KB  |  312 lines

  1. ;*DDK*************************************************************************/
  2. ;
  3. ; COPYRIGHT (C) Microsoft Corporation, 1989
  4. ; COPYRIGHT    Copyright (C) 1995 IBM Corporation
  5. ;
  6. ;    The following IBM OS/2 WARP source code is provided to you solely for
  7. ;    the purpose of assisting you in your development of OS/2 WARP device
  8. ;    drivers. You may use this code in accordance with the IBM License
  9. ;    Agreement provided in the IBM Device Driver Source Kit for OS/2. This
  10. ;    Copyright statement may not be removed.;
  11. ;*****************************************************************************/
  12. ;/*****************************************************************************
  13. ;*
  14. ;* SOURCE FILE NAME = VDH.INC
  15. ;*
  16. ;* DESCRIPTIVE NAME = VDH macros and definitions
  17. ;*
  18. ;*
  19. ;* VERSION      V2.0
  20. ;*
  21. ;* DATE         
  22. ;*
  23. ;* DESCRIPTION  VDH macros and definitions 
  24. ;*
  25. ;* FUNCTIONS    NONE
  26. ;*
  27. ;* NOTES        NONE
  28. ;*
  29. ;* STRUCTURES   NONE
  30. ;*
  31. ;* EXTERNAL REFERENCES
  32. ;*
  33. ;*              NONE
  34. ;*
  35. ;* EXTERNAL FUNCTIONS
  36. ;*
  37. ;*              NONE
  38. ;*
  39. ;* CHANGE ACTIVITY =
  40. ;*   DATE      FLAG        APAR    CHANGE DESCRIPTION
  41. ;*   --------  ----------  -----   --------------------------------------
  42. ;*   mm/dd/yy  @Vr.mpppxx  xxxxx   xxxxxxx
  43. ;*                         B726708 Removing IDC-specific code.  -AJP
  44. ;*   03/09/89                      Add new display type equates
  45. ;*   04/26/89              B701352 GET_ROMCP needed for accessfont routine  
  46. ;*                         B701338
  47. ;*   08/04/89              B785016 Remove unnecessary reg saves in FixVGABug  
  48. ;*                         B785017
  49. ;*   09/12/89              B708207 Fix from Steve Thompson for video buf 
  50. ;*                         3789    corruption problem.
  51. ;*   02/16/90              B788124 Optimize SwitchIfReverse macro  
  52. ;*   09/11/90              D1085   Add short delay macro for use between I/O's
  53. ;*   11/28/90              B718134 Define  ColorMonoMode as a byte,
  54. ;*   02/12/92              B732894 Use kernel IoDelay macro  
  55. ;*   03/01/92                      Compaq OEM fix
  56. ;*****************************************************************************/
  57.  
  58. NOT_MONO                equ     1       ;xxxxxxxb b=0 Mono-compat, b=1 Other
  59. GET_ROMCP               equ     2                                       ;           
  60. GET                     equ     1
  61. SET                     equ     0
  62. SETWORD                 equ     2
  63.  
  64. WORDS                   equ     1
  65. BYTES                   equ     0
  66.  
  67. COLOR                   equ     1
  68.  
  69. TRUE                    equ     1
  70. FALSE                   equ     0
  71. NONE                    equ     0
  72.  
  73. SAVE                    equ     0
  74. RESTORE                 equ     1
  75.  
  76. Attributes_CMD          equ     1
  77. Sequencers_CMD          equ     2
  78.  
  79. CursorHidden            equ     00100000B
  80.  
  81. ;/*
  82. ;**  Display types                                                             |
  83. ;*/
  84.  
  85. Mono8503                equ     03h     ;   VDHVGA, VDH8514A
  86. Color8512_8513          equ     04h     ;   VDHVGA, VDH8514A
  87. Color8514               equ     09h     ;   VDH8514A
  88. Mono8507_8604           equ     0Bh     ;   VDH8514A ;          
  89. Color8515               equ     0Ch     ;   VDH8514A ;          
  90.  
  91. MEM_1MB                 equ     1
  92. VDHERROR_NO_ADAPTER     equ     0
  93.  
  94. CRTCtlAddressRegMono    equ     03B4h   ; CRT Controller Address Register (monochrome)
  95. CRTCtlAddressRegColor   equ     03D4h   ; CRT Controller Address Register (color)
  96.  
  97.  
  98. SeqAddressPort          equ     03C4h
  99. GraphAddressPort        equ     03CEh
  100. FeatureControlWrite     equ     03BAh   ; Read Feature Control Register
  101. ColorAdjustment         equ     20h
  102. AttAddressPort          equ     03C0h
  103. MiscOutputRegRead       equ     03CCh   ; Read Miscellaneous Output Register
  104. MiscOutputRegWrite      equ     03C2h   ; Write Miscellaneous Output Register
  105. MonoAdjustment          equ     0
  106. CRTCtlAddressReg        equ     03B4h   ; CRT Controller Address Register
  107. CRTCtlDataReg           equ     03B5h   ; CRT Controller Data Register
  108. IndMaxScanLine          equ     09h     ; CRT Maximum scan line
  109. CHAR_SCANLINES          equ     00011111b       ; scan lines per char bits
  110. PELAddressRead          equ     03C7h   ; PEL Address Register for data read
  111. PELAddressWrite         equ     03C8h   ; PEL Address Register for data write
  112. SeqDataPort             equ     03C5h
  113. AttCtlInitializeReg     equ     03BAh   ; Feature Control Register - init AttCtl flip-flop
  114. IndClockModeReg         equ     01h     ; Address Clocking Mode in Sequencer
  115. IndUnderlineLoc         equ     14h     ; Address Underline Location Register
  116. AttDataReadPort         equ     03C1h
  117. AttDataWritePort        equ     03C0h
  118. IndOverscanColor        equ     11h     ; Address Overscan Color Register
  119. IndCursorStart          equ     0Ah     ; Address Cursor Start Register
  120. IndCursorEnd            equ     0Bh     ; Address Cursor End Register
  121. IndAttModeCtl           equ     10h     ; Address Attribute Mode Control Register
  122. PELDataRegister         equ     03C9h   ; PEL Data Register
  123.  
  124. IndCursorHighLoc        equ     0Eh     ; Address Cursor Location High Register
  125. IndCursorLowLoc         equ     0Fh     ; Address Cursor Location Low Register
  126.  
  127.  
  128. ColorMonoFixup          equ     WORD PTR [bp-2]
  129.  
  130. MapMask                 equ     <BYTE PTR [bp+6]>
  131. ReadMap                 equ     <BYTE PTR [bp+8]>
  132. TableIndex              equ     WORD PTR [bp+6]
  133. fbType                  equ     WORD PTR [bp+6]
  134. ParameterPacket         equ     DWORD PTR [bp+6]
  135. Direction               equ     WORD PTR [bp+10]
  136. ColorMode               equ     <WORD PTR [bp+12]>
  137. CharacterColumns        equ     WORD PTR [bp+14]
  138. WordByte                equ     <WORD PTR [bp+14]>
  139. AddressPacket           equ     DWORD PTR [bp+16]
  140. AddressPkt              equ     DWORD PTR [bp+12]
  141. ColorMonoMode           equ     <BYTE PTR [bp+6]>               ;;;MERGE change
  142.  
  143. WriteFunction           equ     4
  144.  
  145. VioCursorType STRUC
  146.         CursorTopScanLine dw ?
  147.         CursorBottomScanLine dw ?
  148.         CursorWidth dw ?
  149.         CursorAttribute dw ?
  150. VioCursorType ENDS
  151.  
  152. VioCursorPos STRUC
  153.         CursorRow dw ?
  154.         CursorColumn dw ?
  155. VioCursorPos ENDS
  156.  
  157. PaletteCLUT STRUC
  158.         DataArea dd ?
  159.         FirstEntry dw ?
  160.         NumEntries dw ?
  161. PaletteCLUT ENDS
  162.  
  163. RegAddress STRUC
  164.         RegAddressPort dw ?
  165.         RegDataPort dw ?
  166.         RegColorAdjust dw ?
  167.         RegFlags dw ?
  168. RegAddress ENDS
  169.  
  170. Blink   equ     0
  171. Overscan equ    0
  172. Underscore equ  0
  173. VideoEnable equ 0
  174. DisplayMask equ 0
  175.  
  176. ;/*
  177. ;**  Macros                                                                    |
  178. ;*/
  179.  
  180. ;/****************************************************************************
  181. ;*
  182. ;* MACRO NAME    = @SwitchIfReverse
  183. ;*
  184. ;* DESCRIPTION   = 
  185. ;*
  186. ;* INPUT         = 
  187. ;* OUTPUT        = NONE
  188. ;*
  189. ;* RETURN-NORMAL = NONE
  190. ;* RETURN-ERROR  = NONE
  191. ;*
  192. ;****************************************************************************/
  193.  
  194. @SwitchIfReverse macro
  195.  
  196.         .if     < Mode eq RESTORE >
  197.             push    es
  198.             push    ds
  199.             xchg    si,di                                   ;          
  200.             pop     es
  201.             pop     ds
  202.         .endif
  203.         endm
  204.  
  205. ;/*
  206. ;** Ensure synchonization of Attribute flip-flop by reading both the Mono
  207. ;**     and the Color ports, then set the Attribute Address port.
  208. ;*/
  209.  
  210. ;/****************************************************************************
  211. ;*
  212. ;* MACRO NAME    = @SetAttAddressPort
  213. ;*
  214. ;* DESCRIPTION   = 
  215. ;*
  216. ;* INPUT         = 
  217. ;* OUTPUT        = NONE
  218. ;*
  219. ;* RETURN-NORMAL = NONE
  220. ;* RETURN-ERROR  = NONE
  221. ;*
  222. ;****************************************************************************/
  223.  
  224. @SetAttAddressPort macro
  225.  
  226.         mov     dx,3BAh                 ;Mono status register
  227.         cli                             ;Disallow interrupts
  228.         in      al,dx                   ;Read port to reset flip-flop
  229.         mov     dx,3DAh                 ;Color status register
  230.         in      al,dx                   ;Read port to reset flip-flop
  231.         mov     dx,AttAddressPort       ;Get the Attribute Address Port
  232.  
  233.         endm
  234.  
  235. ;/****************************************************************************
  236. ;*
  237. ;* MACRO NAME    = @VideoOn
  238. ;*
  239. ;* DESCRIPTION   = 
  240. ;*
  241. ;* INPUT         = 
  242. ;* OUTPUT        = NONE
  243. ;*
  244. ;* RETURN-NORMAL = NONE
  245. ;* RETURN-ERROR  = NONE
  246. ;*
  247. ;****************************************************************************/
  248.  
  249. @VideoOn macro
  250.  
  251.         @SetAttAddressPort              ; Set EGA/VGA port
  252.         mov     al, 20h                 ; Enable video for EGA/VGA
  253.         out     dx, al                  ; Disable the video signal
  254.  
  255.         endm
  256.  
  257. ;/*
  258. ;** Avoid problem in VGA by writing to an undocumented I/O register.
  259. ;** If this is not done, the video buffer will be randomly corrupted
  260. ;** during a setmode.  This is not a problem using Bios since the
  261. ;** screen is always cleared after the mode has been set.
  262. ;*/
  263.  
  264. ;/****************************************************************************
  265. ;*
  266. ;* MACRO NAME    = @FixVGABug
  267. ;*
  268. ;* DESCRIPTION   = 
  269. ;*
  270. ;* INPUT         = 
  271. ;* OUTPUT        = NONE
  272. ;*
  273. ;* RETURN-NORMAL = NONE
  274. ;* RETURN-ERROR  = NONE
  275. ;*
  276. ;****************************************************************************/
  277.  
  278. @FixVGABug macro
  279.  
  280.         mov     dx,3c4h                 ;            
  281.         mov     ax,7                    ;            
  282.         out     dx,ax                   ;            
  283.  
  284.         mov     dx, MiscOutputRegRead   ; Read Miscellaneous Output Register
  285.         in      al, dx
  286.         mov     dx, CRTCtlAddressReg
  287.         test    al, 1
  288.         .if     < nz >
  289.             add     dx, ColorAdjustment
  290.         .endif
  291.         mov     al, 03FH                ; set up index
  292.         out     dx, al
  293.  
  294.         inc     dx                      ; point to the register
  295.         mov     al, 1                   ; set up the data
  296.         out     dx, al
  297.  
  298.         endm
  299.  
  300.  
  301. _DATA   SEGMENT WORD PUBLIC 'DATA'
  302. _DATA   ENDS
  303.  
  304. CONST   SEGMENT WORD PUBLIC 'CONST'
  305. CONST   ENDS
  306.  
  307. _BSS    SEGMENT WORD PUBLIC 'BSS'
  308. _BSS    ENDS
  309.  
  310. DGROUP  GROUP   CONST, _BSS, _DATA
  311.  
  312.