Fix for the problem that SDL applications exited
[AROS-Contrib.git] / Games / Quake / d_scana.s
blobbd4fd744734f4928bf5e7d02d4bd08b06cb8fe8c
1 /*
2 Copyright (C) 1996-1997 Id Software, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 // d_scana.s
22 // x86 assembly-language turbulent texture mapping code
25 #include "asm_i386.h"
26 #include "quakeasm.h"
27 #include "asm_draw.h"
28 #include "d_ifacea.h"
30 #if id386
32 .data
34 .text
36 //----------------------------------------------------------------------
37 // turbulent texture mapping code
38 //----------------------------------------------------------------------
40 .align 4
41 .globl C(D_DrawTurbulent8Span)
42 C(D_DrawTurbulent8Span):
43 pushl %ebp // preserve caller's stack frame pointer
44 pushl %esi // preserve register variables
45 pushl %edi
46 pushl %ebx
48 movl C(r_turb_s),%esi
49 movl C(r_turb_t),%ecx
50 movl C(r_turb_pdest),%edi
51 movl C(r_turb_spancount),%ebx
53 Llp:
54 movl %ecx,%eax
55 movl %esi,%edx
56 sarl $16,%eax
57 movl C(r_turb_turb),%ebp
58 sarl $16,%edx
59 andl $(CYCLE-1),%eax
60 andl $(CYCLE-1),%edx
61 movl (%ebp,%eax,4),%eax
62 movl (%ebp,%edx,4),%edx
63 addl %esi,%eax
64 sarl $16,%eax
65 addl %ecx,%edx
66 sarl $16,%edx
67 andl $(TURB_TEX_SIZE-1),%eax
68 andl $(TURB_TEX_SIZE-1),%edx
69 shll $6,%edx
70 movl C(r_turb_pbase),%ebp
71 addl %eax,%edx
72 incl %edi
73 addl C(r_turb_sstep),%esi
74 addl C(r_turb_tstep),%ecx
75 movb (%ebp,%edx,1),%dl
76 decl %ebx
77 movb %dl,-1(%edi)
78 jnz Llp
80 movl %edi,C(r_turb_pdest)
82 popl %ebx // restore register variables
83 popl %edi
84 popl %esi
85 popl %ebp // restore caller's stack frame pointer
86 ret
88 #endif // id386