1 ; $Id: tmapfade.asm,v 1.2 2003-02-18 20:15:48 btb 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.
17 ; Revision 1.6 1995/02/20 18:23:01 john
18 ; Put all the externs in the assembly modules into tmap_inc.asm.
19 ; Also, moved all the C versions of the inner loops into a new module,
22 ; Revision 1.5 1995/02/20 17:09:15 john
23 ; Added code so that you can build the tmapper with no assembly!
25 ; Revision 1.4 1994/12/02 23:29:36 mike
26 ; change jb/ja to jl/jg.
28 ; Revision 1.3 1994/11/30 00:57:36 mike
29 ; *** empty log message ***
31 ; Revision 1.2 1994/10/06 18:38:49 john
32 ; Added the ability to fade a scanline by calling gr_upoly_tmap
33 ; with Gr_scanline_darkening_level with a value < MAX_FADE_LEVELS.
35 ; Revision 1.1 1994/10/06 18:04:42 john
40 global _asm_tmap_scanline_shaded
41 global asm_tmap_scanline_shaded
45 %include "tmap_inc.asm"
50 ; --------------------------------------------------------------------------------------------------
52 ; _xleft fixed point left x coordinate
53 ; _xright fixed point right x coordinate
54 ; _y fixed point y coordinate
55 ;**; _pixptr address of source pixel map
57 ; for (x = (int) xleft; x <= (int) xright; x++) {
58 ; _setcolor(read_pixel_from_tmap(srcb,((int) (u/z)) & 63,((int) (v/z)) & 63));
65 _asm_tmap_scanline_shaded:
66 asm_tmap_scanline_shaded:
70 ; mov fs, [_gr_fade_table_selector] ; DPH: No selectors in windows
72 ; Setup for loop: _loop_count iterations = (int) xright - (int) xleft
73 ; edi initial row pointer = y*320+x
75 ; set edi = address of first pixel to modify
77 cmp edi,_window_bottom
80 imul edi,[_bytes_per_row]
87 add edi,[_write_buffer]
89 ; set _loop_count = # of iterations
92 cmp eax,[_window_right]
94 mov eax,[_window_right]
95 eax_ok1: cmp eax,[_window_left]
97 mov eax,[_window_left]
102 cmp eax,[_window_width]
104 mov eax,[_window_width]
106 mov [_loop_count], eax
109 mov ch,[_tmap_flat_shade_value]
112 ;_size = (_end1 - _start1)/num_iters
114 sub eax,[_loop_count]
116 inc eax ; sort of a hack, but we can get -1 here and want to be graceful
117 jns j_eax_ok1 ; if we jump, we had -1, which is kind of ok, if not, we int 3
118 int 3 ; oops, going to jump behind _start1, very bad...
119 sub eax,eax ; ok to continue
120 j_eax_ok1: imul eax,eax,(_end1 - _start1)/num_iters
121 add eax, _start1 ;originally offset _start1
128 mov cl, [edi] ; get pixel
129 mov al, [_gr_fade_table + ecx] ; darken pixel
130 mov [edi], al ; write pixel
131 inc edi ; goto next pixel