source: golgotha/src/render/software/affine_map_unlit_holy_asm.cc @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 11 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 2.4 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#include "software/r1_software_globals.hh"
10
11void texture_scanline_affine_unlit_holy(w16 *start_pixel,
12                                        sw32 start_x,
13                                        void *left, //affine_span *left
14                                        sw32 width)
15{
16  _asm
17  {   
18    mov eax,dword ptr [width]
19   
20    mov edi,dword ptr [left]
21    mov dword ptr [width_global],eax
22   
23    mov eax,dword ptr [dsdx_frac]
24    mov ebx,dword ptr [dtdx_frac]
25
26    mov dword ptr [s_frac_add_patch+2],eax
27    mov dword ptr [t_frac_add_patch+2],ebx
28
29    mov esi,dword ptr [r1_software_texture_ptr] //esi has texture base ptr
30    mov ebx,dword ptr [edi]affine_span.s //get s in ecx
31   
32    shr esi,1 //get half the texture pointer   
33    mov eax,dword ptr [edi]affine_span.t //get t in edx
34
35    sar ebx,16 //get integral part of s
36    mov cl,byte ptr [r1_software_twidth_log2]
37   
38    sar eax,16 //get integral part of t
39    add esi,ebx //setup starting texture ptr
40
41    shl eax,cl //shift left to multiply t by texture width   
42   
43    mov edx,dword ptr [edi]affine_span.s //get s in ebx
44    add esi,eax //finish setup of starting texture ptr
45
46    sal edx,16 //shift right to get fractional part of s
47    mov ecx,dword ptr [edi]affine_span.t //get t again in edx
48           
49    sal ecx,16 //shift right to get fractional part of t               
50    mov edi,dword ptr [start_pixel]
51
52    add edi,dword ptr [start_x]
53    push ebp
54
55    mov eax,0
56    mov ebx,dword ptr [width_global] //setup loop counter   
57
58    ALIGN 16       
59loopcount:
60    mov ax,word ptr [esi*2]   
61t_frac_add_patch:
62    add ecx,0xDDDDDDDD
63
64    sbb ebp,ebp
65    and eax,eax
66   
67    jz skip_ye_old_pixel
68    mov word ptr [edi],ax
69
70skip_ye_old_pixel:
71    add edi,2
72s_frac_add_patch:
73    add edx,0xDDDDDDDD   
74
75    adc esi,dword ptr [4+s_t_carry+ebp*4]           
76    dec ebx   
77    jnz loopcount
78   
79end_affine_lit:
80    pop ebp
81  } 
82}
Note: See TracBrowser for help on using the repository browser.