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