Annotation of ntddk/src/video/displays/vga/i386/ropdefs.inc, revision 1.1.1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.