|
|
1.1 root 1: ;---------------------------Module-Header------------------------------;
2: ; Module Name: devdata.inc
3: ;
4: ; Copyright (c) 1992 Microsoft Corporation
5: ;-----------------------------------------------------------------------;
6:
7: ; Instructions used in the compiler. Word quantities have already been
8: ; swapped so that they come out correctly when stored.
9:
10: I_ADD_AL_BYTE_I equ 004h ; ADD al,12h
11: I_ADD_EDI_DWORD_I equ 0C781h ; ADD edi,12345678h
12: I_ADD_ESI_DWORD_I equ 0C681h ; ADD esi,12345678h
13: I_AND_AL_BYTE_I equ 024h ; AND al,12h
14: I_AND_AL_MEM equ 00522h ; AND al,[byteaddr]
15: I_CALL_DISP32 equ 0E8h ; CALL 12345678h
16: I_DEC_ECX equ 049h ; DEC ecx
17: I_DEC_ESI_DEC_EDI equ 04F4Eh ; DEC esi
18: ; DEC edi
19: I_INC_ESI_INC_EDI equ 04746h ; INC esi
20: ; INC edi
21: I_JMP_DISP32 equ 0E9h ; JMP 12345678h
22: I_JNC_DISP32 equ 0830Fh ; JNC $+12345678h
23: I_JNZ_DISP32 equ 0850fh ; JNZ $+12345678h
24: I_LODSB equ 0ACh ; LODSB
25: I_LOOP equ 0E2h ; LOOP $
26: I_MOVSB equ 0A4h ; MOVSB
27: I_MOV_AH_AL equ 0E08Ah ; MOV ah,al
28: I_MOV_AH_DEST equ 0278Ah ; MOV ah,[edi]
29: I_MOV_AH_ESI_DISP32 equ 0A68Ah ; MOV ah,12345678h[esi]
30: I_MOV_AL_0FFH equ 0FFB0h ; MOV al,0FFH
31: I_MOV_AL_DH equ 0C68Ah ; MOV al,dh
32: I_MOV_AL_ESI_DISP32 equ 0868Ah ; MOV al,12345678h[esi]
33: I_MOV_AL_MEM equ 0A0h ; MOV al,[byteaddr]
34: I_MOV_BL_BYTE_I equ 0B3h ; MOV bl,12h
35: I_MOV_DH_EBX_DISP8 equ 0738Ah ; MOV dh,12h[ebx]
36: I_MOV_EBP_DWORD_I equ 0BDh ; MOV ebp,12345678h
37: I_MOV_EBX_DWORD_I equ 0BBh ; MOV ebx,12345678h
38: I_MOV_ECX_DWORD_I equ 0B9h ; MOV ecx,12345678h
39: I_MOV_EDX_DWORD_I equ 0BAh ; MOV ecx,12345678h
40: I_MOV_MEM_AL equ 0A2h ; MOV [byteaddr],al
41:
42: I_NEG_DH equ 0DEF6h ; NEG dh
43: I_NOT_AL equ 0D0F6h ; NOT al
44: I_OR_AH_AL equ 0E00Ah ; OR ah,al
45: I_OR_AL_AH equ 0C40Ah ; OR al,ah
46: I_POP_EBX equ 05Bh ; POP ebx
47: I_POP_EDI_POP_ECX equ 0595Fh ; POP edi
48: ; POP ecx
49: I_POP_ESI equ 05Eh ; POP esi
50: I_PUSH_EBX equ 053h ; PUSH ebx
51: I_PUSH_ECX_PUSH_EDI equ 05751h ; PUSH ecx
52: ; PUSH edi
53: I_PUSH_ESI equ 056h ; PUSH esi
54: I_REP equ 0F3h ; REP
55: I_RET equ 0C3h ; RET
56: I_ROL_AL_N equ 0C0C0h ; ROL al,2
57: I_ROR_AL_N equ 0C8C0h ; ROR al,2
58: I_SETNZ_DH equ 0C6950Fh ; SETNZ dh
59: I_SHL_BL_1 equ 0E3D0h ; SHL bl,1
60: I_SIZE_OVERRIDE equ 066h ; size override
61: I_STOSB equ 0AAh ; STOSB
62: I_TEST_BL_BYTE_I equ 0C3F6h ; TEST bl,12h
63: I_XOR_AL_BYTE_I equ 034h ; XOR al,12h
64: I_XOR_AL_MEM equ 00532h ; XOR al,[byteaddr]
65: I_XOR_BH_BH equ 0FF32h ; XOR BH,BH
66:
67: ; The following instructions require that I_SIZE_OVERRIDE preceed them
68:
69: I_MOVSW equ 0A5h ; MOVSW
70: I_MOV_BP_WORD_I equ 0BDh ; MOV bp,1234h
71: I_NOT_AX equ 0D0F7h ; NOT ax
72: I_STOSW equ 0ABh ; STOSW
73: I_XOR_AX_WORD_I equ 035h ; XOR ax,12h
74: I_XOR_EAX_EAX equ 0C033h ; xor eax, eax
75:
76:
77: ;-----------------------------------------------------------------------;
78: ; phase_align - Template for phase alignment code
79: ;
80: ; The following code is the template that performs the phase
81: ; alignment masking. The source has already been aligned to
82: ; the destination.
83: ;
84: ; A copy of the aligned source is made. The phase mask is then
85: ; applied to the source and the copy. The previously unused
86: ; bits are ORed into the used bits of the current source, and
87: ; the unused bits of the current source then become the unused
88: ; bits for the next source.
89: ;
90: ; It assumes:
91: ; BP = phase alignment mask
92: ; AL = current byte to mask
93: ; BH = old unused bits
94: ;-----------------------------------------------------------------------;
95:
96: phase_align:
97: mov ah,al ;Make a copy of aligned source
98: and ax,bp ;Masked used, unused bits
99: or al,bh ;Mask in old unused bits
100: mov bh,ah ;Save new unused bits
101:
102: PHASE_ALIGN_LEN equ $-phase_align ;Length of procedure
103:
104:
105: ;-----------------------------------------------------------------------;
106: ; masked_store - Template for storing first and last bytes of BLT
107: ;
108: ; The following code is a template for storing the first and last
109: ; bytes of a BLT. The unaltered bits are saved and the altered
110: ; bits set in the byte, then the byte is stored.
111: ;
112: ;
113: ; It assumes:
114: ;
115: ; AL = The byte to be BLTed to the destination bitmap.
116: ; All necessary logic operations have been performed
117: ; on this byte.
118: ;
119: ; AH = The destination byte.
120: ;
121: ;-----------------------------------------------------------------------;
122:
123: masked_store:
124: and ax,0FFFFh ;Mask altered/unaltered bits
125: or al,ah ;Combine the bits
126: stosb ;And store the result
127:
128: MASKED_STORE_LEN equ $-masked_store ;Length of the template
129: MASKED_STORE_MASK equ -5 ;Offset to where mask goes
130:
131:
132: ;-----------------------------------------------------------------------;
133: ; EGA Color Plane Setup Code
134: ;
135: ; The EGA Color Plane Setup Code is used when the EGA is involved
136: ; in the BLT, and the BLT isn't from the EGA to a monochrome bitmap.
137: ;
138: ; The template will be copied, and any required fixups will be
139: ; performed. The very first instruction will be generated on
140: ; the fly instead of being copied and fixed-up.
141: ;
142: ; It assumes:
143: ; BL = MapMask value
144: ;-----------------------------------------------------------------------;
145:
146: cps:
147: mov al,MM_ALL ;Set Map Mask
148: and al,bl ;Isolate the plane
149: mov dx,EGA_BASE + SEQ_DATA
150: out dx,al
151: shr al,1 ;Map plane into ReadMask
152: cmp al,100b ;Set Carry if not C3 (plane 3)
153: adc al,-1 ;Sub 1 only if C3
154: mov ah,al
155: mov al,GRAF_READ_MAP
156: mov dl,GRAF_ADDR
157: out dx,ax
158:
159: LENGTH_CPS = $ - cps ;Length of the code
160:
161:
162: ;-----------------------------------------------------------------------;
163: ; Mono ==> Color Fetch Code
164: ;
165: ; The mono ==> color fetch code is generated when the source
166: ; is a monochrome bitmap and the destination is color.
167: ;
168: ; When going from mono to color, 1 bits are considered to be
169: ; the background color, and 0 bits are considered to be the
170: ; foreground color.
171: ;
172: ; For each plane:
173: ;
174: ; If the foreground=background=1, then 1 can be used in
175: ; place of the source.
176: ;
177: ; If the foreground=background=0, then 0 can be used in
178: ; place of the source.
179: ;
180: ; If the foreground=0 and background=1, then the source
181: ; can be used as is.
182: ;
183: ; If the foreground=1 and background=0, then the source
184: ; must be complemented before using.
185: ;
186: ; A table will be created for processing the monochrome
187: ; bitmap for each plane of the destination. The table
188: ; should look like:
189: ;
190: ; BackGnd ForeGnd Result AND XOR
191: ; 1 1 1 00 FF
192: ; 0 0 0 00 00
193: ; 1 0 S FF 00
194: ; 0 1 not S FF FF
195: ;
196: ; From this, it can be seen that the XOR mask is the same as the
197: ; foreground color. The AND mask is the XOR of the foreground
198: ; and the background color.
199: ;
200: ; It can also be seen that if the background color is white and the
201: ; foreground (text) color is black, then the conversion needn't be
202: ; generated (it just gives the source).
203: ;
204: ; The template for rotating the AND and XOR table for the plane
205: ; select code is also shown. It just does a three word rotate
206: ; on the AND and XOR masks on the stack. It is performed at the
207: ; end of a scan in anticipation of the next color for that scan.
208: ;
209: ; lodsb ;Get next byte of source
210: ; and al,byte ptr ss:[1234h] ;Process against current AND
211: ; xor al,byte ptr ss:[1234h] ; and XOR masks
212: ;-----------------------------------------------------------------------;
213:
214: rot_and_xor:
215: ; lea ebp,ColorMungeTBl ;--> AND/XOR masks
216: mov ax,word ptr [ebp][6] ;Rotate next color's AND and
217: xchg ax,word ptr [ebp][4] ; XOR mask into place
218: xchg ax,word ptr [ebp][2] ; XOR mask into place
219: xchg ax,word ptr [ebp][0]
220: mov word ptr [ebp][6],ax
221:
222: LEN_ROT_AND_XOR = $-rot_and_xor
223: page
224:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.