|
|
1.1 ! root 1: ;---------------------------Module-Header------------------------------; ! 2: ; Module Name: bitblt.inc ! 3: ; ! 4: ; Copyright (c) 1992 Microsoft Corporation ! 5: ;-----------------------------------------------------------------------; ! 6: ! 7: ;-----------------------------------------------------------------------; ! 8: ; INCREASE is the flag used to show that the BLT operation will be ! 9: ; increasing in Y (Y+). ! 10: ; ! 11: ; DECREASE is the flag used to show that the BLT operation will be ! 12: ; decreasing in Y (Y-). ! 13: ; ! 14: ; STEPLEFT is the flag used to show that the BLT will be stepping ! 15: ; left (i.e. start at the right hand corner of the source, stepping ! 16: ; left, or X-). ! 17: ; ! 18: ; STEPRIGHT is the flag used to show that the BLT will be stepping ! 19: ; right (i.e. start at the left hand corner of the source, stepping ! 20: ; right, or X+). ! 21: ;-----------------------------------------------------------------------; ! 22: ! 23: INCREASE equ 1 ;Incrementing ! 24: DECREASE equ -1 ;Decrementing ! 25: STEPLEFT equ 0 ;Stepping to the left ! 26: STEPRIGHT equ 1 ;Stepping to the right ! 27: ! 28: ;-----------------------------------------------------------------------; ! 29: ; gl_the_flags ! 30: ; ! 31: ; F0_GAG_CHOKE Set if the source and destination are of different ! 32: ; color formats. When set, some form of color ! 33: ; conversion will be required. ! 34: ; ! 35: ; Once you see what all is involved with color ! 36: ; conversion, you'll understand why this flag is ! 37: ; called this. ! 38: ; ! 39: ; F0_COLOR_PAT Set if color pattern fetch code will be used. If ! 40: ; clear, then mono pattern fetch code will be used. ! 41: ; Mono/color pattern fetch is always based on the ! 42: ; destination being mono/color (it is the same). ! 43: ; ! 44: ; F0_PAT_PRESENT Set if a pattern is involved in the BLT. ! 45: ; ! 46: ; F0_SRC_PRESENT Set if a source is involved in the BLT. ! 47: ; ! 48: ; F0_SRC_IS_DEV Set if the source is the physical device. Clear if ! 49: ; the source is a memory bitmap. ! 50: ; ! 51: ; F0_SRC_IS_COLOR Set if the source is color, clear if monochrome. ! 52: ; ! 53: ; F0_DEST_IS_DEV Set if the destination is the physical device. ! 54: ; Clear if the destination is a memory bitmap. ! 55: ; ! 56: ; F0_DEST_IS_COLOR ! 57: ; Set if the destination is color, clear if ! 58: ; monochrome. ! 59: ;-----------------------------------------------------------------------; ! 60: ! 61: F0_GAG_CHOKE equ 10000000b ;Going mono <==> color ! 62: F0_COLOR_PAT equ 01000000b ;Use color pattern fetch code ! 63: F0_PAT_PRESENT equ 00100000b ;Pattern is involved in blt ! 64: F0_SRC_PRESENT equ 00010000b ;Source is involved in blt ! 65: F0_SRC_IS_DEV equ 00001000b ;Source is the device ! 66: F0_SRC_IS_COLOR equ 00000100b ;Source is color ! 67: F0_DEST_IS_DEV equ 00000010b ;Destination is the device ! 68: F0_DEST_IS_COLOR equ 00000001b ;Destination is color ! 69: ! 70: ;-----------------------------------------------------------------------; ! 71: ; Definitions for fbFetch ! 72: ;-----------------------------------------------------------------------; ! 73: ! 74: FF_NO_LAST_FETCH equ 00000010b ;Final fetch might GP ! 75: FF_TWO_INIT_FETCHES equ 00000001b ;Two initial fetches needed ! 76: FF_ONE_INIT_FETCH equ 0 ;One initial fetch needed ! 77: FF_ONLY_1_DEST_BYTE equ 00000100b ;Only one destination byte ! 78: FF_ONLY_1_SRC_BYTE equ 00001000b ;Only one source byte ! 79: ! 80: ;-----------------------------------------------------------------------; ! 81: ; MAX_BLT_SIZE is the maximum stack space required for the BITBLT ! 82: ; code. This is a hard number to compute. It must be based on ! 83: ; the worst case situation: ! 84: ; ! 85: ; worst phase alignment ! 86: ; worst color conversions ! 87: ; first byte present ! 88: ; last byte present ! 89: ; full inner loop ! 90: ; jump into the inner loop ! 91: ; ! 92: ; and any other factor which could increase the size of the code. ! 93: ;-----------------------------------------------------------------------; ! 94: ! 95: MAX_BLT_SIZE = 400h ;Max stack space a BLT will require ! 96: ! 97: ;-----------------------------------------------------------------------; ! 98: ; The following flags are used in the inner loops to both control ! 99: ; the EGA read/write enable registers, and the plane loop count. ! 100: ; ! 101: ; They are based on a simple relationship of the EGA's Map Mask ! 102: ; register and Read Map Select Register when used as a three plane ! 103: ; system: ! 104: ; ! 105: ; Map Mask: D3 D2 D1 D0 Read Map: D2 D1 D0 ! 106: ; ! 107: ; C0 plane 0 0 0 1 0 0 0 ! 108: ; C1 plane 0 0 1 0 0 0 1 ! 109: ; C2 plane 0 1 0 0 0 1 0 ! 110: ; ! 111: ; ! 112: ; Note that to convert the map mask into a read mask for the ! 113: ; same plane only requires a "SHR x,1" instruction. This trick ! 114: ; would not work if all four planes were used. ! 115: ; ! 116: ; In four plane mode, when the above mapping occurs becomes: ! 117: ; ! 118: ; C3 plane 1 0 0 0 1 0 0 ! 119: ; ! 120: ; To map this into the correct read map register of 11b: ! 121: ; ! 122: ; cmp mask,100b ;Set 'C' if not C3 ! 123: ; adc mask,-1 ;sub -1 only if C3 ! 124: ; ! 125: ; ! 126: ; ! 127: ; The "loop counter" will consist of a bit shifted left every ! 128: ; interation of the loop, which will be used as stated above. ! 129: ; When this bit mask reaches a predetermined value, the loop ! 130: ; will terminate. ! 131: ;-----------------------------------------------------------------------; ! 132: ! 133: COLOR_OP equ C0_BIT ;Color ops start with C0 ! 134: MONO_OP equ MONO_BIT ;Mono ops start with mono bit ! 135: PLANE_1 equ 00010001b ;Loop starting bits ! 136: END_OP equ (C3_BIT+MONO_BIT) SHL 1 ;Loop terminating bits ! 137: ! 138: ;-----------------------------------------------------------------------; ! 139: ; dl_moore_flags ! 140: ; ! 141: ; dl_moore_flags pertain to color conversion only. If color ! 142: ; conversion doesn't apply to the BLT, these flags will not ! 143: ; be defined. ! 144: ; ! 145: ; ! 146: ; F1_REP_OK When F1_REP_OK is set, then the innerloop code can ! 147: ; use a REP MOVSx instruction. This will be the ! 148: ; case if: ! 149: ; ! 150: ; a) The source is the EGA and the color compare ! 151: ; register can be used to do the conversion ! 152: ; from color to monochrome. ! 153: ; ! 154: ; b) The source is monochrome, the background ! 155: ; color white, and the foreground color black, ! 156: ; in which case color converison of the source ! 157: ; would just give the source. ! 158: ; ! 159: ; F1_NO_MUNGE Set under the same conditions as "b" above. ! 160: ;-----------------------------------------------------------------------; ! 161: ! 162: F1_REP_OK equ 10000000b ;Using REP is ok (when F0_GAG_CHOKE) ! 163: F1_NO_MUNGE equ 01000000b ;No mono ==> color conversion table ! 164: ! 165: ;-----------------------------------------------------------------------; ! 166: ; The DEV structure contains all the information taken from the ! 167: ; PDevices passed in. PDevices are copied to the frame to reduce ! 168: ; the number of long pointer loads required. Having the data ! 169: ; contained in the structure allows MOVSW to be used when copying ! 170: ; the data. ! 171: ; ! 172: ; width_bits The number of pixels wide the device is. ! 173: ; ! 174: ; height The number of scans high the device is. ! 175: ; ! 176: ; width_b The width of a scan in bytes. ! 177: ; ! 178: ; lp_bits The pointer to the actual bits of the device. ! 179: ; It will be adjusted as necessary to point to the ! 180: ; first byte to be modified by the BLT operation. ! 181: ; ! 182: ; dev_flags Device Specific Flags ! 183: ; IS_DEVICE - This is the physical device ! 184: ; COLOR_UP - Generate color scan line update ! 185: ; IS_COLOR - Device is a color device ! 186: ; ! 187: ; next_scan Bias to get to the next (previous) scan line. ! 188: ;-----------------------------------------------------------------------; ! 189: ! 190: DEV struc ! 191: width_bits dw ? ;Width in bits ! 192: height dw ? ;Height in scans ! 193: width_b dw ? ;Width in bytes ! 194: lp_bits dd ? ;Pointer to the bits ! 195: dev_flags db ? ;Device flags as given above ! 196: db ? ;Alignment ! 197: next_scan dd ? ;Index to next scan ! 198: next_plane dd ? ;Index to next plane ! 199: DEV ends ! 200: ! 201: ; Constants for use in dev_flags field of DEV structure: ! 202: ! 203: IS_COLOR equ 00000001b ;Device is color ! 204: IS_DEVICE equ 00000010b ;Physical Device ! 205: COLOR_UP equ 00000100b ;Color scan line update ! 206: ! 207: ;-----------------------------------------------------------------------; ! 208: ; The following structure is used to define all the local variables ! 209: ; we will be accessing. We do this since there are no cmacros for ! 210: ; flatland and masm386 put scope in. ! 211: ;-----------------------------------------------------------------------; ! 212: ! 213: FRAME struc ! 214: ! 215: ; Copys of the passed parameters, so called functions can get them ! 216: ! 217: pdsurfDst dd ? ! 218: DestxOrg dw ? ! 219: DestyOrg dw ? ! 220: pdsurfSrc dd ? ! 221: SrcxOrg dw ? ! 222: SrcyOrg dw ? ! 223: xExt dw ? ! 224: yExt dw ? ! 225: Rop dd ? ! 226: lpPBrush dd ? ! 227: bkColor dd ? ! 228: TextColor dd ? ! 229: pptlBrush dd ? ! 230: ! 231: ; locals ! 232: ! 233: phase_h db ? ;Horizontal phase (rotate count) ! 234: pat_row db ? ;Current row for patterns [0..7] ! 235: direction db ? ;Increment/decrement flag ! 236: the_flags db ? ! 237: first_fetch db ? ;Number of first fetches needed ! 238: step_direction db ? ;Direction of move (left right) ! 239: start_mask dw ? ;Mask for first dest byte ! 240: last_mask dw ? ;Mask for last dest byte ! 241: mask_p dw ? ;Horizontal phase mask ! 242: inner_loop_count dd ? ;# of entire bytes to BLT in innerloop ! 243: operands dw ? ;Operand string ! 244: start_fl dd ? ;Start of fetch/logic operation ! 245: end_fl dd ? ;End of fetch/logic operation ! 246: end_fls dd ? ;End of fetch/logic/store operation ! 247: blt_addr dd ? ;BLT address ! 248: cFetchCode dd ? ;size of the fetch code alone ! 249: both_colors dw ? ;Foreground and Background colors ! 250: brush_accel db ? ;Brush accelerator ! 251: moore_flags db ? ;More flags ! 252: addr_brush_index dd ? ;Address of brush index in code ! 253: pNextPlane dd ? ;Address of next plane logic ! 254: ! 255: ; variable sized locals ! 256: ! 257: ppcBlt db (SIZE PACKEDPELCONV) dup (?);Packed pel conversion data ! 258: src db (SIZE DEV) dup (?) ;Source device data ! 259: dest db (SIZE DEV) dup (?) ;Destination device data ! 260: ajM2C db (NUMBER_PLANES * 2) dup (?) ;Mono ==> color munge table ! 261: a_brush db (NUMBER_PLANES * SIZE_PATTERN) dup (?) ;Temp brush ! 262: aulMap dd 16 dup (?) ;Packed pel conversion table ! 263: ! 264: FRAME ends ! 265: ! 266: ! 267: if 0 ! 268: ! 269: ;-----------------------------------------------------------------------; ! 270: ; Definitions of the bitblt frame for enterframe, useframe, leaveframe ! 271: ;-----------------------------------------------------------------------; ! 272: ! 273: ! 274: ; Define the frame for bitblt, using PASCAL conventions ! 275: ! 276: parm_bitblt struc ! 277: pdsurfDst dd ? ;Pointer to destination DEVSURF ! 278: DestxOrg dd ? ;Destination X origin ! 279: DestyOrg dd ? ;Destination Y origin ! 280: pdsurfSrc dd ? ;Pointer to optional source DEVSURF ! 281: SrcxOrg dd ? ;Source X origin ! 282: SrcyOrg dd ? ;Source Y origin ! 283: xExt dd ? ;X extent of the blt ! 284: yExt dd ? ;Y extent of the blt ! 285: Rop dd ? ;Mix mode ! 286: lpPBrush dd ? ;Pointer to the brush ! 287: bkColor dd ? ;Background color for mono==>color blts ! 288: TextColor dd ? ;Foreground color for mono==>color blts ! 289: pulXlateVec dd ? ;Color translation vector ! 290: pptlBrush dd ? ;Pointer to POINTL for brush origin ! 291: parm_bitblt ends ! 292: ! 293: ! 294: loc_bitblt struc ! 295: ppcBlt db (SIZE PACKEDPELCONV) dup (?);Packed pel conversion data ! 296: src db (SIZE DEV) dup (?) ;Source device data ! 297: dest db (SIZE DEV) dup (?) ;Destination device data ! 298: ajM2C db (NUMBER_PLANES * 2) dup (?) ;Mono ==> color munge table ! 299: a_brush db (NUMBER_PLANES * SIZE_PATTERN) dup (?) ;Temp brush ! 300: aulMap dd 16 dup (?) ;Packed pel conversion table ! 301: ! 302: ! 303: phase_h db ? ;Horizontal phase (rotate count) ! 304: pat_row db ? ;Current row for patterns [0..7] ! 305: direction db ? ;Increment/decrement flag ! 306: the_flags db ? ! 307: first_fetch db ? ;Number of first fetches needed ! 308: step_direction db ? ;Direction of move (left right) ! 309: brush_accel db ? ;Brush accelerator ! 310: moore_flags db ? ;More flags ! 311: ! 312: start_mask dw ? ;Mask for first dest byte ! 313: last_mask dw ? ;Mask for last dest byte ! 314: mask_p dw ? ;Horizontal phase mask ! 315: operands dw ? ;Operand string ! 316: both_colors dw ? ;Foreground and Background colors ! 317: dw ? ;Alignment ! 318: ! 319: inner_loop_count dd ? ;# of entire bytes to BLT in innerloop ! 320: start_fl dd ? ;Start of fetch/logic operation ! 321: end_fl dd ? ;End of fetch/logic operation ! 322: end_fls dd ? ;End of fetch/logic/store operation ! 323: blt_addr dd ? ;BLT address ! 324: cFetchCode dd ? ;size of the fetch code alone ! 325: addr_brush_index dd ? ;Address of brush index in code ! 326: pNextPlane dd ? ;Address of next plane logic ! 327: loc_bitblt ends ! 328: ! 329: ! 330: ! 331: endif ! 332:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.