-
Notifications
You must be signed in to change notification settings - Fork 2
/
r_alias68k.s
255 lines (213 loc) · 5.2 KB
/
r_alias68k.s
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
**
** Quake for AMIGA
** r_alias.c assembler implementations by Frank Wille <[email protected]>
**
INCLUDE "quakedef68k.i"
XREF _aliastransform
XREF _r_avertexnormals
XREF _r_plightvec
XREF _r_ambientlight
XREF _r_shadelight
XREF _ziscale
XREF _aliasxscale
XREF _aliasyscale
XREF _aliasxcenter
XREF _aliasycenter
XDEF _R_AliasTransformVector
XDEF _R_AliasTransformFinalVert
XDEF _R_AliasProjectFinalVert
fpu
******************************************************************************
*
* void _R_AliasTransformVector (vec3_t in, vec3_t out)
*
******************************************************************************
cnop 0,4
_R_AliasTransformVector
***** stackframe
rsreset
.fpuregs rs.x 4
rs.l 1
.in rs.l 1
.out rs.l 1
fmovem.x fp2-fp5,-(sp)
move.l .in(sp),a0
move.l .out(sp),a1
fmove.s (a0)+,fp0
fmove.s (a0)+,fp1
fmove.s (a0)+,fp2
lea _aliastransform,a0
fmove.s (a0)+,fp3
fmul fp0,fp3
fmove.s (a0)+,fp4
fmul fp1,fp4
fadd fp4,fp3
fmove.s (a0)+,fp4
fmul fp2,fp4
fadd fp4,fp3
fadd.s (a0)+,fp3
fmove.s fp3,(a1)+
fmove.s (a0)+,fp3
fmul fp0,fp3
fmove.s (a0)+,fp4
fmul fp1,fp4
fadd fp4,fp3
fmove.s (a0)+,fp4
fmul fp2,fp4
fadd fp4,fp3
fadd.s (a0)+,fp3
fmove.s fp3,(a1)+
fmul.s (a0)+,fp0
fmul.s (a0)+,fp1
fadd fp1,fp0
fmul.s (a0)+,fp2
fadd fp2,fp0
fadd.s (a0)+,fp0
fmove.s fp0,(a1)+
fmovem.x (sp)+,fp2-fp5
rts
******************************************************************************
*
* void _R_AliasTransformFinalVert (finalvert_t *fv, auxvert_t *av,
* trivertx_t *pverts, stvert_t *pstverts)
*
******************************************************************************
cnop 0,4
_R_AliasTransformFinalVert
***** stackframe
rsreset
.fpuregs rs.x 3
.intregs rs.l 1
rs.l 1
.fv rs.l 1
.av rs.l 1
.tv rs.l 1
.sv rs.l 1
move.l a2,-(sp)
fmovem.x fp2-fp4,-(sp)
move.l .av(sp),a1
move.l .tv(sp),a2
* av->fv[0] = DotProduct(pverts->v, aliastransform[0]) +
* aliastransform[0][3];
* av->fv[1] = DotProduct(pverts->v, aliastransform[1]) +
* aliastransform[1][3];
* av->fv[2] = DotProduct(pverts->v, aliastransform[2]) +
* aliastransform[2][3];
lea _aliastransform,a0
moveq #0,d0
move.b (a2),d0
fmove.l d0,fp0
move.b 1(a2),d0
fmove.l d0,fp1
move.b 2(a2),d0
fmove.l d0,fp2
fmove.s (a0)+,fp3
fmul fp0,fp3
fmove.s (a0)+,fp4
fmul fp1,fp4
fadd fp4,fp3
fmove.s (a0)+,fp4
fmul fp2,fp4
fadd fp4,fp3
fadd.s (a0)+,fp3
fmove.s fp3,(a1)+
fmove.s (a0)+,fp3
fmul fp0,fp3
fmove.s (a0)+,fp4
fmul fp1,fp4
fadd fp4,fp3
fmove.s (a0)+,fp4
fmul fp2,fp4
fadd fp4,fp3
fadd.s (a0)+,fp3
fmove.s fp3,(a1)+
fmove.s (a0)+,fp3
fmul fp0,fp3
fmove.s (a0)+,fp4
fmul fp1,fp4
fadd fp4,fp3
fmove.s (a0)+,fp4
fmul fp2,fp4
fadd fp4,fp3
fadd.s (a0)+,fp3
fmove.s fp3,(a1)+
* fv->v[2] = pstverts->s;
* fv->v[3] = pstverts->t;
*
* fv->flags = pstverts->onseam;
move.l .fv(sp),a0
move.l .sv(sp),a1
move.l SV_S(a1),8(a0)
move.l SV_T(a1),12(a0)
move.l SV_ONSEAM(a1),FV_FLAGS(a0)
* plightnormal = r_avertexnormals[pverts->lightnormalindex];
* lightcos = DotProduct (plightnormal, r_plightvec);
* temp = r_ambientlight;
lea _r_avertexnormals,a1
moveq #0,d0
move.b TV_LIGHTNORMALINDEX(a2),d0
muls #12,d0
add.l d0,a1
lea _r_plightvec,a2
fmove.s (a2)+,fp0
fmove.s (a2)+,fp1
fmove.s (a2)+,fp2
fmul.s (a1)+,fp0
fmul.s (a1)+,fp1
fadd fp1,fp0
fmul.s (a1)+,fp2
fadd fp2,fp0
move.l _r_ambientlight,d0
* if (lightcos < 0)
* {
* temp += (int)(r_shadelight * lightcos);
*
* // clamp; because we limited the minimum ambient and shading light, we
* // don't have to clamp low light, just bright
* if (temp < 0)
* temp = 0;
* }
*
* fv->v[4] = temp;
ftst fp0
fboge.w .cont
fmul.s _r_shadelight,fp0
fmove.l fp0,d1
add.l d1,d0
bge.b .cont
moveq #0,d0
.cont
move.l d0,16(a0)
fmovem.x (sp)+,fp2-fp4
move.l (sp)+,a2
rts
******************************************************************************
*
* void _R_AliasProjectFinalVert (finalvert_t *fv, auxvert_t *av,)
*
******************************************************************************
cnop 0,4
_R_AliasProjectFinalVert
***** stackframe
rsreset
rs.l 1
.fv rs.l 1
.av rs.l 1
move.l .av(sp),a0
move.l .fv(sp),a1
fmove.s 8(a0),fp0
fmove.s #1,fp1
fdiv fp0,fp1
fmove.s _ziscale,fp0
fmul fp1,fp0
fmove.l fp0,20(a1)
fmove.s _aliasxscale,fp0
fmul fp1,fp0
fmul.s (a0),fp0
fadd.s _aliasxcenter,fp0
fmove.l fp0,(a1)
fmul.s _aliasyscale,fp1
fmul.s 4(a0),fp1
fadd.s _aliasycenter,fp1
fmove.l fp1,4(a1)
rts