Quake-2

Quake 2 GPL Source Release
Log | Files | Refs

r_scana.asm (1434B)


      1  .386P
      2  .model FLAT
      3 ;
      4 ; d_scana.s
      5 ; x86 assembly-language turbulent texture mapping code
      6 ;
      7 
      8 include qasm.inc
      9 include d_if.inc
     10 
     11 if id386
     12 
     13 _DATA SEGMENT	
     14 
     15 _DATA ENDS
     16 _TEXT SEGMENT	
     17 
     18 ;----------------------------------------------------------------------
     19 ; turbulent texture mapping code
     20 ;----------------------------------------------------------------------
     21 
     22  align 4	
     23  public _D_DrawTurbulent8Span	
     24 _D_DrawTurbulent8Span:	
     25  push ebp	; preserve caller's stack frame pointer
     26  push esi	; preserve register variables
     27  push edi	
     28  push ebx	
     29 
     30  mov esi,ds:dword ptr[_r_turb_s]	
     31  mov ecx,ds:dword ptr[_r_turb_t]	
     32  mov edi,ds:dword ptr[_r_turb_pdest]	
     33  mov ebx,ds:dword ptr[_r_turb_spancount]	
     34 
     35 Llp:	
     36  mov eax,ecx	
     37  mov edx,esi	
     38  sar eax,16	
     39  mov ebp,ds:dword ptr[_r_turb_turb]	
     40  sar edx,16	
     41  and eax,offset CYCLE-1	
     42  and edx,offset CYCLE-1	
     43  mov eax,ds:dword ptr[ebp+eax*4]	
     44  mov edx,ds:dword ptr[ebp+edx*4]	
     45  add eax,esi	
     46  sar eax,16	
     47  add edx,ecx	
     48  sar edx,16	
     49  and eax,offset TURB_TEX_SIZE-1	
     50  and edx,offset TURB_TEX_SIZE-1	
     51  shl edx,6	
     52  mov ebp,ds:dword ptr[_r_turb_pbase]	
     53  add edx,eax	
     54  inc edi	
     55  add esi,ds:dword ptr[_r_turb_sstep]	
     56  add ecx,ds:dword ptr[_r_turb_tstep]	
     57  mov dl,ds:byte ptr[ebp+edx*1]	
     58  dec ebx	
     59  mov ds:byte ptr[-1+edi],dl	
     60  jnz Llp	
     61 
     62  mov ds:dword ptr[_r_turb_pdest],edi	
     63 
     64  pop ebx	; restore register variables
     65  pop edi	
     66  pop esi	
     67  pop ebp	; restore caller's stack frame pointer
     68  ret	
     69 
     70 
     71 _TEXT ENDS
     72 endif	;id386
     73  END