1 ; $Id: tmerge_a.asm,v 1.2 2002-07-17 21:55:19 bradleyb Exp $
2 ;THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 ;SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
4 ;END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ;ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 ;IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 ;SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 ;FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 ;CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
10 ;AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
11 ;COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
22 ; void gr_merge_textures( ubyte * lower, ubyte * upper, ubyte * dest )
24 global _gr_merge_textures, _gr_merge_textures_1, _gr_merge_textures_2, _gr_merge_textures_3
25 global gr_merge_textures, gr_merge_textures_1, gr_merge_textures_2, gr_merge_textures_3
29 ; for (y=0; y<64; y++ )
30 ; for (x=0; x<64; x++ ) {
31 ; c = top_data[ 64*x+(63-y) ];
33 ; c = bottom_data[ 64*y+x ];
39 ; for (y=0; y<64; y++ )
40 ; for (x=0; x<64; x++ ) {
41 ; c = top_data[ 64*(63-y)+(63-x) ];
43 ; c = bottom_data[ 64*y+x ];
49 ; for (y=0; y<64; y++ )
50 ; for (x=0; x<64; x++ ) {
51 ; c = top_data[ 64*(63-x)+y ];
53 ; c = bottom_data[ 64*y+x ];
84 second_must_be_not_trans:
102 ; DH OR DL ARE INVISIBLE
108 je second_must_be_not_trans
126 ; -----------------------------------------------------------------------------------------
127 ; case 1, normal in x, flip in y
128 _gr_merge_textures_1:
131 ; eax = background data
132 ; edx = foreground data
133 ; ebx = destination address
144 mov ch, 255 ; transparent color, stick in a register, is this faster?
146 mov esi, 63 ; esi will be the offset to the current pixel
149 mov ebp, 64 ; do for 64 pixels
152 gmt1_1: mov cl, [edx + esi] ; get foreground pixel
153 add esi, 64 ; point at next row
154 cmp cl, ch ; see if transparent
155 jne not_transparent_1 ; dl contains a solid color, just write it
157 mov cl,[eax] ; get background pixel
159 not_transparent_1: mov [ebx], cl ; write pixel
160 inc ebx ; point at next destination address
163 dec ebp ; see if done a whole row
164 jne gmt1_1 ; no, so do next pixel
166 mov ebp, 64 ; do for 64 pixels
168 dec dword [row_count] ; advance to next row
169 mov esi, [row_count] ; doing next row, get offset, DANGER: DOESN'T SET FLAGS, BEWARE ON 68000, POWERPC!!
170 jns gmt1_1 ; no (going down to 0)
178 ; -----------------------------------------------------------------------------------------
179 ; case 1, normal in x, flip in y
180 _gr_merge_textures_2:
183 ; eax = background data
184 ; edx = foreground data
185 ; ebx = destination address
196 mov ch, 255 ; transparent color, stick in a register, is this faster?
198 mov esi, 63 + 64*63 ; esi will be the offset to the current pixel
201 gmt1_2: mov cl, [edx + esi] ; get foreground pixel
202 cmp cl, ch ; see if transparent
203 jne not_transparent_2 ; dl contains a solid color, just write it
205 mov cl,[eax] ; get background pixel
207 not_transparent_2: mov [ebx], cl ; write pixel
208 inc ebx ; point at next destination address
211 dec esi ; advance to next row
212 jns gmt1_2 ; no (going down to 0)
220 ; -----------------------------------------------------------------------------------------
221 ; case 1, normal in x, flip in y
222 _gr_merge_textures_3:
225 ; eax = background data
226 ; edx = foreground data
227 ; ebx = destination address
238 mov ch, 255 ; transparent color, stick in a register, is this faster?
240 mov esi, 64*63 ; esi will be the offset to the current pixel
241 mov dword [row_count], 64
243 mov ebp, 32 ; do for 64 pixels (2x loop)
247 gmt1_3: mov cl, [edx + esi] ; get foreground pixel
248 sub esi, 64 ; point at next row
249 cmp cl, ch ; see if transparent
250 jne not_transparent_3 ; dl contains a solid color, just write it
252 mov cl,[eax] ; get background pixel
254 not_transparent_3: inc eax
255 mov [ebx], cl ; write pixel
256 inc ebx ; point at next destination address
258 ; second copy of loop
259 mov cl, [edx + esi] ; get foreground pixel
260 sub esi, 64 ; point at next row
261 cmp cl, ch ; see if transparent
262 jne nt_3a ; dl contains a solid color, just write it
264 mov cl,[eax] ; get background pixel
267 mov [ebx], cl ; write pixel
268 inc ebx ; point at next destination address
270 dec ebp ; see if done a whole row
271 jne gmt1_3 ; no, so do next pixel
273 mov ebp, 32 ; do for 64 pixels
275 add esi, 64*64+1 ; doing next row, get offset, DANGER: DOESN'T SET FLAGS, BEWARE ON 68000, POWERPC!!
277 dec dword [row_count] ; advance to next row
278 jne gmt1_3 ; no (going down to 0)