1 ;THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
2 ;SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
3 ;END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
4 ;ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
5 ;IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
6 ;SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
7 ;FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
8 ;CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
9 ;AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
10 ;COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
21 ; void gr_merge_textures( ubyte * lower, ubyte * upper, ubyte * dest )
23 global _gr_merge_textures, _gr_merge_textures_1, _gr_merge_textures_2, _gr_merge_textures_3
24 global gr_merge_textures, gr_merge_textures_1, gr_merge_textures_2, gr_merge_textures_3
28 ; for (y=0; y<64; y++ )
29 ; for (x=0; x<64; x++ ) {
30 ; c = top_data[ 64*x+(63-y) ];
32 ; c = bottom_data[ 64*y+x ];
38 ; for (y=0; y<64; y++ )
39 ; for (x=0; x<64; x++ ) {
40 ; c = top_data[ 64*(63-y)+(63-x) ];
42 ; c = bottom_data[ 64*y+x ];
48 ; for (y=0; y<64; y++ )
49 ; for (x=0; x<64; x++ ) {
50 ; c = top_data[ 64*(63-x)+y ];
52 ; c = bottom_data[ 64*y+x ];
83 second_must_be_not_trans:
101 ; DH OR DL ARE INVISIBLE
107 je second_must_be_not_trans
125 ; -----------------------------------------------------------------------------------------
126 ; case 1, normal in x, flip in y
127 _gr_merge_textures_1:
130 ; eax = background data
131 ; edx = foreground data
132 ; ebx = destination address
143 mov ch, 255 ; transparent color, stick in a register, is this faster?
145 mov esi, 63 ; esi will be the offset to the current pixel
148 mov ebp, 64 ; do for 64 pixels
151 gmt1_1: mov cl, [edx + esi] ; get foreground pixel
152 add esi, 64 ; point at next row
153 cmp cl, ch ; see if transparent
154 jne not_transparent_1 ; dl contains a solid color, just write it
156 mov cl,[eax] ; get background pixel
158 not_transparent_1: mov [ebx], cl ; write pixel
159 inc ebx ; point at next destination address
162 dec ebp ; see if done a whole row
163 jne gmt1_1 ; no, so do next pixel
165 mov ebp, 64 ; do for 64 pixels
167 dec dword [row_count] ; advance to next row
168 mov esi, [row_count] ; doing next row, get offset, DANGER: DOESN'T SET FLAGS, BEWARE ON 68000, POWERPC!!
169 jns gmt1_1 ; no (going down to 0)
177 ; -----------------------------------------------------------------------------------------
178 ; case 1, normal in x, flip in y
179 _gr_merge_textures_2:
182 ; eax = background data
183 ; edx = foreground data
184 ; ebx = destination address
195 mov ch, 255 ; transparent color, stick in a register, is this faster?
197 mov esi, 63 + 64*63 ; esi will be the offset to the current pixel
200 gmt1_2: mov cl, [edx + esi] ; get foreground pixel
201 cmp cl, ch ; see if transparent
202 jne not_transparent_2 ; dl contains a solid color, just write it
204 mov cl,[eax] ; get background pixel
206 not_transparent_2: mov [ebx], cl ; write pixel
207 inc ebx ; point at next destination address
210 dec esi ; advance to next row
211 jns gmt1_2 ; no (going down to 0)
219 ; -----------------------------------------------------------------------------------------
220 ; case 1, normal in x, flip in y
221 _gr_merge_textures_3:
224 ; eax = background data
225 ; edx = foreground data
226 ; ebx = destination address
237 mov ch, 255 ; transparent color, stick in a register, is this faster?
239 mov esi, 64*63 ; esi will be the offset to the current pixel
240 mov dword [row_count], 64
242 mov ebp, 32 ; do for 64 pixels (2x loop)
246 gmt1_3: mov cl, [edx + esi] ; get foreground pixel
247 sub esi, 64 ; point at next row
248 cmp cl, ch ; see if transparent
249 jne not_transparent_3 ; dl contains a solid color, just write it
251 mov cl,[eax] ; get background pixel
253 not_transparent_3: inc eax
254 mov [ebx], cl ; write pixel
255 inc ebx ; point at next destination address
257 ; second copy of loop
258 mov cl, [edx + esi] ; get foreground pixel
259 sub esi, 64 ; point at next row
260 cmp cl, ch ; see if transparent
261 jne nt_3a ; dl contains a solid color, just write it
263 mov cl,[eax] ; get background pixel
266 mov [ebx], cl ; write pixel
267 inc ebx ; point at next destination address
269 dec ebp ; see if done a whole row
270 jne gmt1_3 ; no, so do next pixel
272 mov ebp, 32 ; do for 64 pixels
274 add esi, 64*64+1 ; doing next row, get offset, DANGER: DOESN'T SET FLAGS, BEWARE ON 68000, POWERPC!!
276 dec dword [row_count] ; advance to next row
277 jne gmt1_3 ; no (going down to 0)