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

Last change on this file since 80 was 80, checked in by Sam Hocevar, 12 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.6 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_blend(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+2],eax
27    mov dword ptr [t_frac_add_patch_2+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 edx
44    add esi,eax //finish setup of starting texture ptr
45
46    sal edx,16 //shift left to get fractional part of s
47    mov ecx,dword ptr [edi]affine_span.t //get t again in ecx
48           
49    sal ecx,16 //shift left 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 ebp,dword ptr [width_global] //setup loop counter   
56    mov eax,0
57
58    mov ebx,0
59   
60    ALIGN 16
61loopcount:
62    mov ax,[esi*2]
63    and eax,eax
64
65    jz  skip_a_pixel
66    mov bx,[edi]
67
68    shr eax,1
69    and ebx,dword ptr [pre_blend_and]
70       
71    shr ebx,1
72    and eax,dword ptr [post_blend_and]
73
74    add eax,ebx
75    mov [edi],ax
76
77skip_a_pixel: 
78t_frac_add_patch_2:
79    add ecx,0xDDDDDDDD     
80    sbb ebx,ebx   
81   
82    add edi,2
83s_frac_add_patch_2:
84    add edx,0xDDDDDDDD       
85       
86    adc esi,dword ptr [4+s_t_carry+ebx*4]
87    mov ebx,0 //gotta clear this guy
88
89    dec ebp   
90    jnz loopcount
91   
92end_affine_lit:
93    pop ebp
94  } 
95}
Note: See TracBrowser for help on using the repository browser.