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.

240 lines
8.8 KiB

  1. ;----------------------------Module-Header------------------------------;
  2. ; Module Name: ROPDEFS.BLT
  3. ;
  4. ; Constants relating to raster operation definitions.
  5. ;
  6. ; Copyright (c) 1988 - 1992 Microsoft Corporation
  7. ;
  8. ; These constants are used mainly in the file ROPTABLE.BLT, in which
  9. ; the raster operation code templates are defined.
  10. ;
  11. ; This file is part of a set that makes up the Windows BitBLT function
  12. ; at driver-level.
  13. ;-----------------------------------------------------------------------;
  14. subttl Raster Operation Definitions
  15. page
  16. if 0 ; Not passed to us anymore !!!
  17. ; Raster Op Definitions
  18. ;
  19. ;
  20. ; The include file COMMENT.BLT contains a good description
  21. ; of the encoding of the raster operations. It should be
  22. ; read before examining the definitions that follow.
  23. ;
  24. ; The sixteen-bit number indicating which raster Op is to be
  25. ; performed is encoded in the following manner:
  26. EPS_OFF = 0000000000000011b ;Offset within parse string
  27. EPS_INDEX = 0000000000011100b ;Parse string index
  28. LogPar = 0000000000100000b ;(1 indicates implied NOT as Logop6)
  29. LogOp1 = 0000000011000000b ;Logical Operation #1
  30. LogOp2 = 0000001100000000b ;Logical Operation #2
  31. LogOp3 = 0000110000000000b ;Logical Operation #3
  32. LogOp4 = 0011000000000000b ;Logical Operation #4
  33. LogOp5 = 1100000000000000b ;Logical Operation #5
  34. ; The parity bit is used to encode an optional sixth logical operation
  35. ; which will always be a "NOT". In most cases this is used to get an
  36. ; even number of "NOT"s so that reduction can take place (two sequential
  37. ; trailing "NOT"s cancel each other out and thus are eliminated).
  38. ; Each LogOp (Logical Operation) is encoded as follows:
  39. LogNOT = 00b ;NOT result
  40. LogXOR = 01b ;XOR result with next operand
  41. LogOR = 10b ;OR result with next operand
  42. LogAND = 11b ;AND result with next operand
  43. ; The parse string is a string which contains the operands for
  44. ; the logical operation sequences (source, destination, pattern).
  45. ; The logic opcodes are applied to the current result and the next
  46. ; element of the given string (unless the LogOp is a NOT which only
  47. ; affects the result).
  48. ;
  49. ; The string is encoded as eight two-bit numbers indicating which
  50. ; operand is to be used
  51. opDefs struc
  52. OpSpec db ? ;Special Operand as noted below
  53. OpSrc db ? ;Operand is source field
  54. OpDest db ? ;Operand is destination field
  55. OpPat db ? ;Operand is pattern field
  56. opDefs ends
  57. ; The special operand is used for a few rops that would not fit into
  58. ; an RPN format. On the first occurance of an OpSpec, the current result
  59. ; is "PUSHED", and the next operand is loaded. On the second occurance
  60. ; of the OpSpec, the given logic operation is performed between the
  61. ; current result and the "PUSHED" value.
  62. ;
  63. ; **NOTE** Since there can be no guarantee that the client will call
  64. ; the BLT routine with one of the 256 published raster ops, it is
  65. ; possible that a value might be "PUSHED" and then never "POPPED".
  66. ; If these "PUSHES" are made to the stack, then care must be made to
  67. ; remove the "PUSHED" value.
  68. ;
  69. ; In any case, since the raster op was not one of the published
  70. ; "magic numbers", the BLT can be aborted or the result can be
  71. ; computed to the extent possible. The only restriction is that it
  72. ; must not crash the system (i.e. don't leave extra stuff on the stack).
  73. ;
  74. ; Simply: Compute garbage, but don't crash!
  75. ; Define the parse strings to be allocated later.
  76. ;
  77. ; An example parse string for the pattern "SDPSDPSD" would be
  78. ; "0110110110110110b"
  79. parseStr0 = 07AAAh ;src,pat,dest,dest,dest,dest,dest,dest
  80. parseStr1 = 079E7h ;src,pat,dest,src,pat,dest,src,pat
  81. parseStr2 = 06DB6h ;src,dest,pat,src,dest,pat,src,dest
  82. parseStr3 = 0AAAAh ;dest,dest,dest,dest,dest,dest,dest,dest
  83. parseStr4 = 0AAAAh ;dest,dest,dest,dest,dest,dest,dest,dest
  84. parseStr5 = 04725h ;src,spec,src,pat,spec,dest,src,src
  85. parseStr6 = 04739h ;src,spec,src,pat,spec,pat,dest,src
  86. parseStr7 = 04639h ;src,spec,src,dest,spec,pat,dest,src
  87. ; The following equates are for certain special functions that are
  88. ; derived from the very first string (index of SpecParseStrIndex).
  89. ;
  90. ; These strings will have their innerloops special cased for
  91. ; speed enhancements (i.e MOVSx and STOSx for pattern copys and
  92. ; white/black fill, and MOVSx for source copy if possible)
  93. PAT_COPY equ 0021h ;P - dest = Pattern
  94. NOTPAT_COPY equ 0001h ;Pn - dest = NOT Pattern
  95. FILL_BLACK equ 0042h ;DDx - dest = 0 (black)
  96. FILL_WHITE equ 0062h ;DDxn - dest = 1
  97. SOURCE_COPY equ 0020h ;S - dest = source
  98. errnz LogXOR-01b ;These must hold true for above equates
  99. errnz LogOp1-0000000011000000b
  100. errnz LogPar-0000000000100000b
  101. errnz parseStr0-7AAAh ; plus the string must be SPDD
  102. SPEC_PARSE_STR_INDEX equ 0 ;Special cased strings index
  103. endif
  104. ; The raster operation table consists of a word for each of
  105. ; the first 128 raster operations (00 through 7F). The second
  106. ; half of the raster operations (FF through 80) are the inverse
  107. ; of the first half.
  108. ;
  109. ; The table is encoded as follows:
  110. ;
  111. ; N S P LLL OOOOOOOOOO
  112. ; | | | | |
  113. ; | | | | |_____ Offset of code from roptable.
  114. ; | | | |
  115. ; | | | |____________ Length index
  116. ; | | |
  117. ; | | |_______________ Pattern is present
  118. ; | |
  119. ; | |_________________ Source is present
  120. ; |
  121. ; |___________________ Generate trailing NOT
  122. ;
  123. ;
  124. ; To map the ROPS 80h through FFh to 00h through 7Fh, take the
  125. ; 1's complement of the ROP, and invert 'N' above.
  126. ;
  127. ;
  128. ; Notes:
  129. ;
  130. ; 1) An offset of 0 is reserved for source copy. This
  131. ; was done to reduce the number of LLLs to 8, so that
  132. ; the above encoding could fit into a 16-bit integer.
  133. ;
  134. ;
  135. ; 2) LLL only allows a maximum of 8 different template sizes!
  136. ; Actual length is at roptable+256+LLL.
  137. ;
  138. ;
  139. ;
  140. ;
  141. ; ROP is the macro that generates the equates which will be
  142. ; stored into the roptable as specified above.
  143. ;
  144. ; Usage:
  145. ;
  146. ; ROPDEF Pattern,Number
  147. ;
  148. ; Where
  149. ;
  150. ; Pattern Is the RPN definition of the raster operation.
  151. ; It is used as the label of the first byte of
  152. ; the template. It also is used to determine
  153. ; is there is a (S)ource, (P)attern, and if the
  154. ; final result is to be (n)egated.
  155. ;
  156. ; Number is the boolean result of the raster operation
  157. ; based on a P=F0, S=CC, and D=AA. These labels
  158. ; and indexes can be found in the file COMMENT.BLT
  159. ;
  160. ; Since there are many equivelent boolean expresions,
  161. ; some of the rops will not match the label given.
  162. ; The label is for reference only. The final result
  163. ; is what counts.
  164. ROPOffset equ 0000001111111111b
  165. ROPLength equ 0001110000000000b
  166. SOURCE_PRESENT equ 0010000000000000b
  167. PATTERN_PRESENT equ 0100000000000000b
  168. NEGATE_NEEDED equ 1000000000000000b
  169. ; Define the eight template length indices.
  170. ROPLen0 equ 0
  171. ROPLen2 equ 1
  172. ROPLen4 equ 2
  173. ROPLen6 equ 3
  174. ROPLen8 equ 4
  175. ROPLen10 equ 5
  176. ROPLen12 equ 6
  177. ROPLen14 equ 7
  178. ; Binary raster ops
  179. R2_BLACK equ 1
  180. R2_NOTMERGEPEN equ 2
  181. R2_MASKNOTPEN equ 3
  182. R2_NOTCOPYPEN equ 4
  183. R2_MASKPENNOT equ 5
  184. R2_NOT equ 6
  185. R2_XORPEN equ 7
  186. R2_NOTMASKPEN equ 8
  187. R2_MASKPEN equ 9
  188. R2_NOTXORPEN equ 10
  189. R2_NOP equ 11
  190. R2_MERGENOTPEN equ 12
  191. R2_COPYPEN equ 13
  192. R2_MERGEPENNOT equ 14
  193. R2_MERGEPEN equ 15
  194. R2_WHITE equ 16
  195. R2_LAST equ 16
  196.