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.

189 lines
5.7 KiB

  1. ;----------------------------Module-Header------------------------------;
  2. ; Module Name: DEVCONST.BLT
  3. ;
  4. ; Device-specific constants.
  5. ;
  6. ; Created: In Windows' distant past (c. 1983)
  7. ;
  8. ; Copyright (c) 1983 - 1987 Microsoft Corporation
  9. ;
  10. ; This file is part of a set that makes up the Windows BitBLT function
  11. ; at driver-level.
  12. ;-----------------------------------------------------------------------;
  13. ; MAX_BLT_SIZE is the maximum stack space required for the BITBLT
  14. ; code. This is a hard number to compute. It must be based on
  15. ; the worst case situation:
  16. ;
  17. ; worst phase alignment
  18. ; worst color conversions
  19. ; first byte present
  20. ; last byte present
  21. ; full inner loop
  22. ; jump into the inner loop
  23. ;
  24. ; and any other factor which could increase the size of the code.
  25. MAX_BLT_SIZE = 452 ;Max stack space a BLT will require
  26. ifdef GEN_COLOR_BLT
  27. ; The following flags are used in the inner loops to both control
  28. ; the EGA read/write enable registers, and the plane loop count.
  29. ;
  30. ; They are based on a simple relationship of the EGA's Map Mask
  31. ; register and Read Map Select Register when used as a three plane
  32. ; system:
  33. ;
  34. ; Map Mask: D3 D2 D1 D0 Read Map: D2 D1 D0
  35. ;
  36. ; C0 plane 0 0 0 1 0 0 0
  37. ; C1 plane 0 0 1 0 0 0 1
  38. ; C2 plane 0 1 0 0 0 1 0
  39. ;
  40. ;
  41. ; Note that to convert the map mask into a read mask for the
  42. ; same plane only requires a "SHR x,1" instruction. This trick
  43. ; would not work if all four planes were used.
  44. ;
  45. ; In four plane mode, when the above mapping occurs becomes:
  46. ;
  47. ; C3 plane 1 0 0 0 1 0 0
  48. ;
  49. ; To map this into the correct read map register of 11b:
  50. ;
  51. ; cmp mask,100b ;Set 'C' if not C3
  52. ; adc mask,-1 ;sub -1 only if C3
  53. ;
  54. ;
  55. ;
  56. ; The "loop counter" will consist of a bit shifted left every
  57. ; interation of the loop, which will be used as stated above.
  58. ; When this bit mask reaches a predetermined value, the loop
  59. ; will terminate.
  60. COLOR_OP equ C0_BIT ;Color operations start with C0
  61. MONO_OP equ MONO_BIT ;Mono operations start with mono bit
  62. ifdef FOUR_PLANE
  63. END_OP equ (C3_BIT+MONO_BIT) SHL 1 ;Loop terminating bits
  64. else
  65. END_OP equ (C2_BIT+MONO_BIT) SHL 1 ;Loop terminating bits
  66. endif
  67. ; dl_moore_flags
  68. ;
  69. ; dl_moore_flags pertain to color conversion only. If color
  70. ; conversion doesn't apply to the BLT, these flags will not
  71. ; be defined.
  72. ;
  73. ;
  74. ; F1_REP_OK When F1_REP_OK is set, then the innerloop code can
  75. ; use a REP MOVSx instruction. This will be the
  76. ; case if:
  77. ;
  78. ; a) The source is the EGA and the color compare
  79. ; register can be used to do the conversion
  80. ; from color to monochrome.
  81. ;
  82. ; b) The source is monochrome, the background
  83. ; color white, and the foreground color black,
  84. ; in which case color converison of the source
  85. ; would just give the source.
  86. ;
  87. ; F1_NO_MUNGE Set under the same conditions as "b" above.
  88. F1_REP_OK equ 10000000b ;Using REP is ok (when F0_GAG_CHOKE)
  89. F1_NO_MUNGE equ 01000000b ;No mono ==> color conversion table
  90. ; equ 00100000b
  91. ; equ 00010000b
  92. ; equ 00001000b
  93. ; equ 00000100b
  94. ; equ 00000010b
  95. ; equ 00000001b
  96. endif ;GEN_COLOR_BLT
  97. page
  98. ; The DEV structure contains all the information taken from the
  99. ; PDevices passed in. PDevices are copied to the frame to reduce
  100. ; the number of long pointer loads required. Having the data
  101. ; contained in the structure allows MOVSW to be used when copying
  102. ; the data.
  103. ;
  104. ; width_bits The number of pixels wide the device is.
  105. ;
  106. ; height The number of scans high the device is.
  107. ;
  108. ; width_b The width of a scan in bytes.
  109. ;
  110. ; lp_bits The pointer to the actual bits of the device.
  111. ; It will be adjusted as necessary to point to the
  112. ; first byte to be modified by the BLT operation.
  113. ;
  114. ; plane_w Width of one plane of data. Only used if the
  115. ; device is a small color bitmap.
  116. ;
  117. ; seg_index Index to get to the next segment of the bitmap.
  118. ; Only defined if the bitmap is a huge bitmap.
  119. ;
  120. ; scans_seg Number of scan lines per 64K segment. Only
  121. ; defined if the bitmap is a huge bitmap.
  122. ;
  123. ; fill_bytes Number of unused bytes per 64K segment. Only
  124. ; defined if the bitmap is a huge bitmap.
  125. ;
  126. ; dev_flags Device Specific Flags
  127. ; SPANS_SEG - BLT will span 64K segment of the device
  128. ; IS_DEVICE - This is the physical device
  129. ; COLOR_UP - Generate color scan line update
  130. ; IS_COLOR - Device is a color device
  131. ;
  132. ; comp_test JC or JNC opcode, used in the huge bitmap scan line
  133. ; update code. This opcode is based on whether the
  134. ; BLT is Y+, or Y-.
  135. ;
  136. ; comp_value Range of addresses to compare the offset against
  137. ; to determine if overflow occured. comp_test is the
  138. ; conditional jump to use for no overflow after doing
  139. ; a compare with the offset register and this value.
  140. ;
  141. ; next_scan Bias to get to the next (previous) scan line.
  142. DEV struc
  143. width_bits dw ? ;Width in bits
  144. height dw ? ;Height in scans
  145. width_b dw ? ;Width in bytes
  146. lp_bits dd ? ;Pointer to the bits
  147. plane_w dw ? ;Increment to next plane
  148. seg_index dw ? ;Index to next segment if huge bitmap
  149. scans_seg dw ? ;Scans per segment if huge
  150. fill_bytes dw ? ;Filler bytes per segment if huge
  151. dev_flags db ? ;Device flags as given above
  152. comp_test db ? ;JC or JNC opcode
  153. comp_value dw ? ;Huge bitmap overflow range
  154. next_scan dw ? ;Index to next scan
  155. DEV ends
  156. ; Constants for use in dev_flags field of DEV structure:
  157. IS_COLOR equ 00000001b ;Device is color
  158. IS_DEVICE equ 00000010b ;Physical Device
  159. COLOR_UP equ 00000100b ;Color scan line update
  160. SPANS_SEG equ 10000000b ;BLT spans a segment boundary
  161. OFF_LP_BITS equ wptr lp_bits ;Offset portion of lp_bits
  162. SEG_LP_BITS equ wptr lp_bits+2 ;Segment portion of lp_bits