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.

236 lines
11 KiB

  1. ;---------------------------Module-Header------------------------------;
  2. ; Module Name: driver.inc
  3. ;
  4. ; Contains prototypes for the 256 colour VGA driver.
  5. ;
  6. ; NOTE: Must mirror driver.h!
  7. ;
  8. ; Copyright (c) 1992 Microsoft Corporation
  9. ;-----------------------------------------------------------------------;
  10. ; Sizes assumed for 1-window and 2 RW-window banks.
  11. BANK_SIZE_1_WINDOW equ 10000h
  12. BANK_SIZE_2RW_WINDOW equ 8000h
  13. ; Specifies desired justification for requestion scan line within bank window
  14. JustifyTop equ 0
  15. JustifyBottom equ 1
  16. ; Specifies which window is to be mapped by two-window bank handler.
  17. MapSourceBank equ 0
  18. MapDestBank equ 1
  19. ;------------------------------------------------------------------------;
  20. ; Miscellaneous driver flags
  21. DRIVER_PLANAR_CAPABLE equ 1
  22. DRIVER_OFFSCREEN_REFRESHED equ 2
  23. DRIVER_HAS_OFFSCREEN equ 4
  24. ; Bank status flags
  25. BANK_BROKEN_RASTER1 equ 1 ; If bank1 or read bank has broken raster
  26. BANK_BROKEN_RASTER2 equ 2 ; If bank2 or write bank has broken raster
  27. BANK_BROKEN_RASTERS equ (BANK_BROKEN_RASTER1 + BANK_BROKEN_RASTER2)
  28. ;------------------------------------------------------------------------;
  29. ; Structures for maintaining a realized brush:
  30. RBRUSH_BLACKWHITE equ 001h ; Black and white brush
  31. RBRUSH_2COLOR equ 002h ; 2 color brush
  32. RBRUSH_NCOLOR equ 004h ; n color brush
  33. RBRUSH_4PELS_WIDE equ 008h ; Brush is 4xN
  34. BRUSH_SIZE equ 64 ; An 8x8 8bpp brush needs 64 bytes
  35. RBRUSH struc
  36. rb_fl dd ? ; Flags
  37. rb_xBrush dd ? ; Realized brush's x brush origin
  38. ; Pattern in planar format
  39. rb_ulFgColor dd ? ; Foreground color for 2-color
  40. rb_ulBkColor dd ? ; Background color for 2-color
  41. rb_cy dd ? ; Height of pattern
  42. rb_cyLog2 dd ? ; log2 of height
  43. rb_iCache dd ? ; Cache entry index; 0 not valid
  44. rb_aulPattern dd (BRUSH_SIZE / 4) dup (?)
  45. RBRUSH ends
  46. BRUSHCACHEENTRY struc
  47. bce_prbVerifyRealization dd ? ; For verifying cache entry valid
  48. bce_yCache dd ? ; Scan where entry's bits live
  49. bce_ulCache dd ? ; Planar (!) offset to cache entry
  50. BRUSHCACHEENTRY ends
  51. ;------------------------------------------------------------------------;
  52. ; The Physical Device data structure.
  53. PDEV struc
  54. pdev_fl dd ? ; Driver flags
  55. pdev_hDriver dd ? ; Handle to \Device\Screen
  56. pdev_hdevEng dd ? ; Engine's handle to PDEV
  57. pdev_hsurfEng dd ? ; Engine's handle to surface
  58. pdev_hsurfBm dd ? ; Handle to the "punt" surface
  59. pdev_pSurfObj dd ? ; Pointer to the locked "punt" surface
  60. pdev_hpalDefault dd ? ; Handle to the default palette for device.
  61. pdev_pjScreen dd ? ; This is pointer to base screen address
  62. pdev_cxScreen dd ? ; Visible screen width
  63. pdev_cyScreen dd ? ; Visible screen height
  64. pdev_ulMode dd ? ; Mode in which the mini-port driver is
  65. pdev_lDeltaScreen dd ? ; Distance from one scan to the next
  66. pdev_flRed dd ? ; For bitfields device, Red Mask
  67. pdev_flGreen dd ? ; For bitfields device, Green Mask
  68. pdev_flBlue dd ? ; For bitfields device, Blue Mask
  69. pdev_cPaletteShift dd ? ; Number of bits the palette must be shifted by
  70. pdev_ulBitCount dd ? ; # of bits per pel 8,16 are only supported
  71. pdev_ulrm0_wmX dd ? ; Values to set GC5 to to select read mode
  72. ; 0 together with write modes 0-3
  73. pdev_pjGlyphFlipTableBase dd ? ; Base allocated address for flip table;
  74. ; the pointer we use is this pointer
  75. ; rounded up to the nearest 256-byte
  76. ; boundary
  77. pdev_pjGlyphFlipTable dd ? ; Pointer to table used to flip glyph bits
  78. ; 0-3 and 4-7
  79. pdev_pPal dd ? ; If this is pal managed, this is the pal
  80. ; Off Screen Save Stuff:
  81. pdev_hbmTmp dd ? ; Handle to temporary buffer
  82. pdev_psoTmp dd ? ; Temporary surface
  83. ; DCI:
  84. pdev_bSupportDCI dd ? ; Does miniport support DCI?
  85. ; Brush cache:
  86. pdev_iCache dd ? ; Index for last brush to be allocated
  87. pdev_iCacheLast dd ? ; Last valid cache index
  88. pdev_pbceCache dd ? ; Pointer to allocated cache
  89. ; Saved screen bits stuff
  90. pdev_rclSavedBitsRight dd ?,?,?,? ; right rect of vga memory that's unused
  91. pdev_rclSavedBitsBottom dd ?,?,?,? ; bottom rect of vga memory that's unused
  92. pdev_bBitsSaved dd ? ; TRUE if bits are currently saved
  93. ; Bank manager stuff common between planar and non-planar modes:
  94. pdev_cTotalScans dd ? ; Number of usable on & off screen scans
  95. pdev_pBankInfo dd ? ; Bank info for current mode
  96. pdev_flBank dd ? ; Flags for current bank state
  97. pdev_ulBitmapSize dd ? ; Length of bitmap if there were no
  98. ; banking, in CPU addressable bytes
  99. pdev_ulWindowBank dd ?,? ; Current banks mapped into windows
  100. ; 0 & 1 (used in 2 window mode only)
  101. pdev_pvBitmapStart dd ? ; Single-window bitmap start pointer
  102. ; (adjusted as necessary to make
  103. ; window map in at proper offset)
  104. pdev_pvBitmapStart2Window dd ?,? ; Double-window window 0 and 1 bitmap
  105. ; start
  106. ; Non-planar mode specific bank management control stuff:
  107. pdev_vbtBankingType dd ? ; Type of banking
  108. pdev_pfnBankSwitchCode dd ? ; Pointer to bank switch code
  109. pdev_lNextScan dd ? ; Offset to next bank in bytes
  110. pdev_pjJustifyTopBank dd ? ; Pointer to lookup table for
  111. ; converting scans to banks
  112. pdev_pbiBankInfo dd ? ; Pointer to array of bank clip info
  113. pdev_ulJustifyBottomOffset dd ? ; Number of scans from top to bottom
  114. ; of bank, for bottom justifying
  115. pdev_iLastBank dd ? ; Index of last valid bank in
  116. pdev_ulBank2RWSkip dd ? ; Offset from one bank index to next
  117. ; to make two 32K banks appear to be
  118. ; one seamless 64K bank
  119. pdev_pfnBankControl dd ? ; Pointer to bank control function
  120. pdev_pfnBankControl2Window dd ? ; Pointer to double-window bank
  121. ; control function
  122. pdev_pfnBankNext dd ? ; Pointer to next bank function
  123. pdev_pfnBankNext2Window dd ? ; Pointer to double-window next bank
  124. ; function
  125. pdev_rcl1WindowClip db (size RECTL) dup (?)
  126. ; Single-window banking clip rect
  127. pdev_rcl2WindowClip db (2*(size RECTL)) dup (?)
  128. ; Double-window banking clip rects for
  129. ; windows 0 & 1
  130. ; Planar mode specific bank management control stuff:
  131. pdev_vbtPlanarType dd ? ; Type of planar banking
  132. pdev_pfnPlanarSwitchCode dd ? ; Pointer to planar bank switch code
  133. pdev_lPlanarNextScan dd ? ; Offset to next planar bank in bytes
  134. pdev_pjJustifyTopPlanar dd ? ; Pointer to lookup table for
  135. ; converting scans to planar banks
  136. pdev_pbiPlanarInfo dd ? ; Pointer to array of bank clip info
  137. pdev_ulPlanarBottomOffset dd ? ; Number of scans from top to bottom
  138. ; of bank, for bottom justifying
  139. pdev_iLastPlanar dd ? ; Index of last valid bank in
  140. pdev_ulPlanar2RWSkip dd ? ; Offset from one bank index to next
  141. ; to make two 32K banks appear to be
  142. ; one seamless 64K bank
  143. pdev_pfnPlanarControl dd ? ; Pointer to bank control function
  144. pdev_pfnPlanarControl2 dd ? ; Pointer to double-window bank
  145. ; control function
  146. pdev_pfnPlanarNext dd ? ; Pointer to next bank function
  147. pdev_pfnPlanarNext2 dd ? ; Pointer to double-window next bank
  148. ; function
  149. pdev_rcl1PlanarClip db (size RECTL) dup (?)
  150. ; Single-window banking clip rect
  151. pdev_rcl2PlanarClip db (2*(size RECTL)) dup (?)
  152. ; Double-window banking clip rects for
  153. pdev_pfnPlanarEnable dd ? ; Function to enable planar mode
  154. pdev_pfnPlanarDisable dd ? ; Function to disable planar mode
  155. ; Smart bank management stuff:
  156. pdev_iLastScan dd ? ; Last scan we want to enumerate
  157. pdev_pvScanScan0 dd ? ; Surface's original pvScan0
  158. pdev_rclSaveBounds db (size RECTL) dup (?)
  159. ; Clip object's original bounds
  160. pdev_pcoNull dd ? ; Pointer to empty clip object
  161. pdev_iSaveDComplexity db ? ; Clip object's original complexity
  162. pdev_fjSaveOptions db ? ; Clip object's original flags
  163. pdev_ajFiller db ?,? ; Pack to dword alignment
  164. pdev_pvTmpBuf dd ? ; Ptr to buffer attached to pdev
  165. PDEV ends
  166. pdev_rcl2WindowClipS equ (pdev_rcl2WindowClip)
  167. pdev_rcl2WindowClipD equ (pdev_rcl2WindowClip + (size RECTL))
  168. pdev_rcl2PlanarClipS equ (pdev_rcl2PlanarClip)
  169. pdev_rcl2PlanarClipD equ (pdev_rcl2PlanarClip + (size RECTL))
  170. pdev_pvBitmapStart2WindowS equ (pdev_pvBitmapStart2Window)
  171. pdev_pvBitmapStart2WindowD equ (pdev_pvBitmapStart2Window + dword)
  172. ;------------------------------------------------------------------------;
  173. ; Macro to do a simple RET, with no stack stuff, in a proc.
  174. PLAIN_RET macro
  175. db 0c3h
  176. endm
  177. ; Macro to replace a CALL followed immediately by a JMP:
  178. CALL_AND_JUMP macro CALL_ADDR,JUMP_ADDR
  179. push offset JUMP_ADDR
  180. jmp CALL_ADDR
  181. endm