1 ; $Id: tmap_flt.asm,v 1.3 2004-08-28 23:17:46 schaffner 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)
20 global _asm_tmap_scanline_flat
21 global asm_tmap_scanline_flat
25 %include "tmap_inc.asm"
29 ; --------------------------------------------------------------------------------------------------
31 ; _xleft fixed point left x coordinate
32 ; _xright fixed point right x coordinate
33 ; _y fixed point y coordinate
34 ;**; _pixptr address of source pixel map
36 ; for (x = (int) xleft; x <= (int) xright; x++) {
37 ; _setcolor(read_pixel_from_tmap(srcb,((int) (u/z)) & 63,((int) (v/z)) & 63));
44 _asm_tmap_scanline_flat:
45 asm_tmap_scanline_flat:
48 ; Setup for loop: _loop_count iterations = (int) xright - (int) xleft
49 ;**; esi source pixel pointer = pixptr
50 ; edi initial row pointer = y*320+x
52 ; set esi = pointer to start of texture map data
55 ; set edi = address of first pixel to modify
57 cmp edi,[_window_bottom]
60 imul edi,[_bytes_per_row]
67 add edi,[_write_buffer]
69 ; set _loop_count = # of iterations
72 cmp eax,[_window_right]
74 mov eax,[_window_right]
75 eax_ok1: cmp eax,[_window_left]
77 mov eax,[_window_left]
83 cmp eax,[_window_width]
85 mov eax,[_window_width]
90 ; edi = destination pixel pointer
91 cmp dword [_tmap_flat_cthru_table], 0
94 mov al,[_tmap_flat_color]
108 _no_full_words: adc ecx,ecx ; if cy set, then write one more pixel (ecx == 0)
109 rep stosb ; write 0 or 1 pixel
115 mov esi, [_tmap_flat_cthru_table]
119 ; edi = dest, esi = table, ecx = count
122 mov al, [edi] ; get already drawn pixel
123 mov al, [eax+esi] ; xlat thru cthru table
124 mov [edi],al ; write it