1 ; $Id: tmap_flt.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.
14 ; Flat shader derived from texture mapper (kind of slow)
17 ; Revision 1.10 1995/02/20 18:22:53 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.9 1995/02/20 17:08:51 john
23 ; Added code so that you can build the tmapper with no assembly!
25 ; Revision 1.8 1994/12/02 23:29:21 mike
26 ; change jb/ja to jl/jg.
28 ; Revision 1.7 1994/11/12 16:39:35 mike
31 ; Revision 1.6 1994/08/09 11:27:53 john
34 ; Revision 1.5 1994/07/08 17:43:11 john
35 ; Added flat-shaded-zbuffered polygon.
37 ; Revision 1.4 1994/04/08 16:25:43 mike
38 ; optimize inner loop of flat shader.
40 ; Revision 1.3 1994/03/31 08:34:20 mike
41 ; Optimized (well, speeded-up) inner loop for tmap-based flat shader.
43 ; Revision 1.2 1993/11/22 10:24:57 mike
44 ; *** empty log message ***
46 ; Revision 1.1 1993/09/08 17:29:46 mike
54 global _asm_tmap_scanline_flat
55 global asm_tmap_scanline_flat
59 %include "tmap_inc.asm"
63 ; --------------------------------------------------------------------------------------------------
65 ; _xleft fixed point left x coordinate
66 ; _xright fixed point right x coordinate
67 ; _y fixed point y coordinate
68 ;**; _pixptr address of source pixel map
70 ; for (x = (int) xleft; x <= (int) xright; x++) {
71 ; _setcolor(read_pixel_from_tmap(srcb,((int) (u/z)) & 63,((int) (v/z)) & 63));
78 _asm_tmap_scanline_flat:
79 asm_tmap_scanline_flat:
82 ; Setup for loop: _loop_count iterations = (int) xright - (int) xleft
83 ;**; esi source pixel pointer = pixptr
84 ; edi initial row pointer = y*320+x
86 ; set esi = pointer to start of texture map data
89 ; set edi = address of first pixel to modify
91 cmp edi,[_window_bottom]
94 imul edi,[_bytes_per_row]
101 add edi,[_write_buffer]
103 ; set _loop_count = # of iterations
106 cmp eax,[_window_right]
108 mov eax,[_window_right]
109 eax_ok1: cmp eax,[_window_left]
111 mov eax,[_window_left]
117 cmp eax,[_window_width]
119 mov eax,[_window_width]
124 ; edi = destination pixel pointer
125 cmp dword [_tmap_flat_cthru_table], 0
128 mov al,[_tmap_flat_color]
142 _no_full_words: adc ecx,ecx ; if cy set, then write one more pixel (ecx == 0)
143 rep stosb ; write 0 or 1 pixel
149 mov esi, [_tmap_flat_cthru_table]
153 ; edi = dest, esi = table, ecx = count
156 mov al, [edi] ; get already drawn pixel
157 mov al, [eax+esi] ; xlat thru cthru table
158 mov [edi],al ; write it