source: golgotha/src/render/software/affine_map_unlit_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.1 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(w16 *start_pixel,
12                                   sw32 start_x,
13                                   void *left, //actually 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 esi,dword ptr [r1_software_texture_ptr] //esi has texture base ptr
24    mov ebx,dword ptr [edi]affine_span.s //get s in ecx
25   
26    shr esi,1 //get half the texture pointer   
27    mov eax,dword ptr [edi]affine_span.t //get t in edx
28
29    sar ebx,16 //get integral part of s
30    mov cl,byte ptr [r1_software_twidth_log2]
31   
32    sar eax,16 //get integral part of t
33    add esi,ebx //setup starting texture ptr
34
35    shl eax,cl //shift left to multiply t by texture width   
36   
37    mov ecx,dword ptr [edi]affine_span.s //get s in ecx
38    add esi,eax //finish setup of starting texture ptr
39
40    sal ecx,16 //shift left to get fractional part of s
41    mov edx,[edi]affine_span.t //get t again in edx
42           
43    sal edx,16 //shift left to get fractional part of t               
44    mov edi,dword ptr [start_pixel]
45
46    mov ebx,dword ptr [width_global] //setup loop counter
47    add edi,dword ptr [start_x]
48
49    push ebp           
50
51    ALIGN 16       
52loopcount:
53    mov ax,word ptr [esi*2]   
54    add edx,dword ptr [dtdx_frac]
55
56    sbb ebp,ebp
57    mov word ptr [edi],ax
58
59    add edi,2
60    add ecx,dword ptr [dsdx_frac]
61
62    adc esi,dword ptr [4+s_t_carry+ebp*4]           
63    dec ebx
64   
65    jnz loopcount
66    pop ebp
67  } 
68}
Note: See TracBrowser for help on using the repository browser.