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.

230 lines
7.0 KiB

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