summaryrefslogtreecommitdiffstats
path: root/gst/goom/surf3d.s
blob: f8c8c5d440f0f138f64dce8214987c56a024f45a (plain)
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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
	.file	"surf3d.c"
	.version	"01.01"
gcc2_compiled.:
.text
	.align 4
.globl grid3d_new
	.type	 grid3d_new,@function
grid3d_new:
	pushl %ebp
	movl %esp,%ebp
	subl $44,%esp
	pushl %edi
	pushl %esi
	pushl %ebx
	movl 20(%ebp),%eax
	movl 12(%ebp),%esi
	movl %eax,-8(%ebp)
	addl $-12,%esp
	pushl $44
	call malloc
	movl %esi,%edx
	imull -8(%ebp),%edx
	movl %eax,%edi
	movl %edx,-12(%ebp)
	leal (%edx,%edx,2),%ebx
	movl %edx,8(%edi)
	addl $-12,%esp
	sall $2,%ebx
	pushl %ebx
	call malloc
	addl $32,%esp
	movl %eax,(%edi)
	addl $-12,%esp
	pushl %ebx
	call malloc
	movl %eax,4(%edi)
	movl 24(%ebp),%eax
	movl %eax,12(%edi)
	movl 28(%ebp),%eax
	movl %eax,16(%edi)
	movl 32(%ebp),%eax
	movl %eax,20(%edi)
	movl 8(%ebp),%eax
	movl %eax,28(%edi)
	movl %esi,24(%edi)
	movl -8(%ebp),%edx
	movl 16(%ebp),%eax
	movl %edx,32(%edi)
	movl %eax,36(%edi)
	movl $0,40(%edi)
	testl %edx,%edx
	je .L480
	movl %esi,%eax
	movl %esi,-28(%ebp)
	shrl $31,%eax
	addl %eax,%esi
	movl -8(%ebp),%eax
	shrl $31,%eax
	addl -8(%ebp),%eax
	movl -12(%ebp),%edx
	sarl $1,%eax
	movl %edx,-24(%ebp)
	negl -28(%ebp)
	movl %esi,-16(%ebp)
	movl %eax,-20(%ebp)
	.p2align 4,,7
.L481:
	movl -28(%ebp),%eax
	addl %eax,-24(%ebp)
	decl -8(%ebp)
	movl 12(%ebp),%esi
	testl %esi,%esi
	je .L479
	movl -8(%ebp),%eax
	subl -20(%ebp),%eax
	movl %eax,-4(%ebp)
	fildl -4(%ebp)
	movl %esi,-4(%ebp)
	movl -24(%ebp),%edx
	leal (%edx,%esi),%eax
	movl -16(%ebp),%ebx
	fildl 16(%ebp)
	leal (%eax,%eax,2),%eax
	sarl $1,%ebx
	leal 0(,%eax,4),%ecx
	fmulp %st,%st(1)
	fildl 20(%ebp)
	fdivrp %st,%st(1)
	fildl 8(%ebp)
	fildl -4(%ebp)
	jmp .L484
.L487:
	fxch %st(2)
	.p2align 4,,7
.L484:
	decl %esi
	movl %esi,%eax
	movl (%edi),%edx
	subl %ebx,%eax
	movl %eax,-4(%ebp)
	fildl -4(%ebp)
	addl $-12,%ecx
	fmul %st(2),%st
	fdiv %st(1),%st
	fstps (%edx,%ecx)
	fxch %st(2)
	movl (%edi),%eax
	movl $0,4(%eax,%ecx)
	movl (%edi),%eax
	fsts 8(%eax,%ecx)
	testl %esi,%esi
	jne .L487
	fstp %st(0)
	fstp %st(0)
	fstp %st(0)
.L479:
	cmpl $0,-8(%ebp)
	jne .L481
.L480:
	leal -56(%ebp),%esp
	popl %ebx
	movl %edi,%eax
	popl %esi
	popl %edi
	leave
	ret
.Lfe1:
	.size	 grid3d_new,.Lfe1-grid3d_new
.section	.rodata
	.align 8
.LC48:
	.long 0x0,0x3fe00000
	.align 4
.LC49:
	.long 0x3f19999a
	.align 4
.LC50:
	.long 0x3ee3d70a
.text
	.align 4
.globl grid3d_update
	.type	 grid3d_update,@function
grid3d_update:
	pushl %ebp
	movl %esp,%ebp
	subl $32,%esp
	pushl %esi
	pushl %ebx
	flds 12(%ebp)
	movl 8(%ebp),%ebx
	movl 16(%ebp),%ecx
	fld %st(0)
#APP
	fsin
#NO_APP
	fstps -4(%ebp)
	flds -4(%ebp)
	fxch %st(1)
#APP
	fcos
#NO_APP
	fstps -4(%ebp)
	flds -4(%ebp)
	cmpl $0,40(%ebx)
	jne .L519
	testl %ecx,%ecx
	je .L520
	xorl %esi,%esi
	cmpl 24(%ebx),%esi
	jge .L520
	fldl .LC48
	xorl %edx,%edx
	.p2align 4,,7
.L524:
	movl (%ebx),%eax
	fld %st(0)
	fld %st(1)
	fxch %st(1)
	fmuls 4(%eax,%edx)
	fxch %st(1)
	fmuls (%ecx,%esi,4)
	faddp %st,%st(1)
	incl %esi
	fstps 4(%eax,%edx)
	addl $12,%edx
	cmpl 24(%ebx),%esi
	jl .L524
	fstp %st(0)
.L520:
	movl 24(%ebx),%esi
	cmpl 8(%ebx),%esi
	jge .L519
	leal (%esi,%esi,2),%eax
	flds .LC49
	flds .LC50
	leal 0(,%eax,4),%ecx
	.p2align 4,,7
.L529:
	movl (%ebx),%eax
	flds 4(%eax,%ecx)
	fmul %st(2),%st
	fstps 4(%eax,%ecx)
	movl %esi,%eax
	subl 24(%ebx),%eax
	movl (%ebx),%edx
	leal (%eax,%eax,2),%eax
	flds 4(%edx,%eax,4)
	fmul %st(1),%st
	fadds 4(%edx,%ecx)
	incl %esi
	fstps 4(%edx,%ecx)
	addl $12,%ecx
	cmpl 8(%ebx),%esi
	jl .L529
	fstp %st(0)
	fstp %st(0)
.L519:
	xorl %esi,%esi
	cmpl 8(%ebx),%esi
	jge .L536
	xorl %ecx,%ecx
	.p2align 4,,7
.L534:
	movl (%ebx),%eax
	flds (%eax,%ecx)
	flds 8(%eax,%ecx)
	fmul %st(2),%st
	fxch %st(1)
	fmul %st(3),%st
	fsubp %st,%st(1)
	movl 4(%ebx),%edx
	incl %esi
	fstps (%edx,%ecx)
	movl (%ebx),%eax
	flds (%eax,%ecx)
	flds 8(%eax,%ecx)
	fxch %st(1)
	fmul %st(2),%st
	fxch %st(1)
	fmul %st(3),%st
	faddp %st,%st(1)
	movl 4(%ebx),%edx
	fstps 8(%edx,%ecx)
	movl (%ebx),%eax
	flds 4(%eax,%ecx)
	movl 4(%ebx),%edx
	fstps 4(%edx,%ecx)
	movl 4(%ebx),%eax
	flds (%eax,%ecx)
	fadds 12(%ebx)
	fstps (%eax,%ecx)
	movl 4(%ebx),%eax
	flds 4(%eax,%ecx)
	fadds 16(%ebx)
	fstps 4(%eax,%ecx)
	movl 4(%ebx),%eax
	flds 8(%eax,%ecx)
	fadds 20(%ebx)
	fstps 8(%eax,%ecx)
	addl $12,%ecx
	cmpl 8(%ebx),%esi
	jl .L534
.L536:
	fstp %st(0)
	fstp %st(0)
	popl %ebx
	popl %esi
	leave
	ret
.Lfe2:
	.size	 grid3d_update,.Lfe2-grid3d_update
.section	.rodata
	.align 4
.LC51:
	.long 0x40000000
	.align 8
.LC52:
	.long 0x0,0x42380000
.text
	.align 4
.globl surf3d_draw
	.type	 surf3d_draw,@function
surf3d_draw:
	pushl %ebp
	movl %esp,%ebp
	subl $60,%esp
	pushl %edi
	pushl %esi
	pushl %ebx
	movl $0,-20(%ebp)
	movl -20(%ebp),%edx
	movl 8(%ebp),%eax
	cmpl 8(%eax),%edx
	jge .L493
	fldl .LC52
	flds .LC51
	xorl %edi,%edi
	.p2align 4,,7
.L495:
	movl 8(%ebp),%eax
	movl 4(%eax),%eax
	movl %eax,-36(%ebp)
	fcoms 8(%eax,%edi)
	fnstsw %ax
	andb $69,%ah
	cmpb $1,%ah
	jne .L496
	fildl 16(%ebp)
	movl -36(%ebp),%edx
	fld %st(0)
	fmuls (%edx,%edi)
	fdivs 8(%edx,%edi)
	fld %st(3)
	faddp %st,%st(1)
	fstpl -32(%ebp)
	movl -32(%ebp),%eax
	movl -28(%ebp),%edx
	movl %eax,-40(%ebp)
	sarl $16,-40(%ebp)
	movl -36(%ebp),%edx
	fmuls 4(%edx,%edi)
	fdivs 8(%edx,%edi)
	movl -40(%ebp),%ecx
	fld %st(2)
	faddp %st,%st(1)
	fstpl -32(%ebp)
	movl -32(%ebp),%eax
	movl -28(%ebp),%edx
	movl %eax,-44(%ebp)
	movl 28(%ebp),%eax
	sarl $1,%eax
	addl %eax,%ecx
	movl 32(%ebp),%eax
	sarl $16,-44(%ebp)
	sarl $1,%eax
	movl %ecx,%ebx
	subl -44(%ebp),%eax
	movl %eax,%esi
	cmpl 28(%ebp),%ebx
	jge .L496
	testl %ecx,%ecx
	jl .L496
	cmpl 32(%ebp),%esi
	jge .L496
	testl %eax,%eax
	jge .L499
.L496:
	xorl %esi,%esi
	xorl %ebx,%ebx
.L499:
	movl 20(%ebp),%eax
	movl %ebx,%edx
	leal (%eax,%edx,4),%edx
	movl 28(%ebp),%eax
	imull %esi,%eax
	leal (%edx,%eax,4),%eax
	testl %ebx,%ebx
	je .L494
	testl %esi,%esi
	je .L494
#APP
	movd (%eax), %mm0
	paddusb 12(%ebp), %mm0
	movd %mm0, (%eax)
#NO_APP
.L494:
	incl -20(%ebp)
	addl $12,%edi
	movl -20(%ebp),%eax
	movl 8(%ebp),%edx
	cmpl 8(%edx),%eax
	jl .L495
	fstp %st(0)
	fstp %st(0)
.L493:
	popl %ebx
	popl %esi
	popl %edi
	leave
	ret
.Lfe3:
	.size	 surf3d_draw,.Lfe3-surf3d_draw
	.align 4
.globl surf3d_rotate
	.type	 surf3d_rotate,@function
surf3d_rotate:
	pushl %ebp
	movl %esp,%ebp
	subl $32,%esp
	pushl %esi
	pushl %ebx
	flds 12(%ebp)
	movl 8(%ebp),%ebx
	fld %st(0)
#APP
	fsin
#NO_APP
	fstps -4(%ebp)
	flds -4(%ebp)
	fxch %st(1)
#APP
	fcos
#NO_APP
	fstps -4(%ebp)
	xorl %esi,%esi
	flds -4(%ebp)
	cmpl 8(%ebx),%esi
	jge .L537
	xorl %ecx,%ecx
	.p2align 4,,7
.L508:
	movl (%ebx),%eax
	flds (%eax,%ecx)
	flds 8(%eax,%ecx)
	fmul %st(2),%st
	fxch %st(1)
	fmul %st(3),%st
	fsubp %st,%st(1)
	movl 4(%ebx),%edx
	incl %esi
	fstps (%edx,%ecx)
	movl (%ebx),%eax
	flds (%eax,%ecx)
	flds 8(%eax,%ecx)
	fxch %st(1)
	fmul %st(2),%st
	fxch %st(1)
	fmul %st(3),%st
	faddp %st,%st(1)
	movl 4(%ebx),%edx
	fstps 8(%edx,%ecx)
	movl (%ebx),%eax
	flds 4(%eax,%ecx)
	movl 4(%ebx),%edx
	fstps 4(%edx,%ecx)
	addl $12,%ecx
	cmpl 8(%ebx),%esi
	jl .L508
.L537:
	fstp %st(0)
	fstp %st(0)
	popl %ebx
	popl %esi
	leave
	ret
.Lfe4:
	.size	 surf3d_rotate,.Lfe4-surf3d_rotate
	.align 4
.globl surf3d_translate
	.type	 surf3d_translate,@function
surf3d_translate:
	pushl %ebp
	movl %esp,%ebp
	pushl %ebx
	movl 8(%ebp),%ecx
	xorl %ebx,%ebx
	cmpl 8(%ecx),%ebx
	jge .L512
	xorl %edx,%edx
	.p2align 4,,7
.L514:
	movl 4(%ecx),%eax
	flds (%eax,%edx)
	fadds 12(%ecx)
	incl %ebx
	fstps (%eax,%edx)
	movl 4(%ecx),%eax
	flds 4(%eax,%edx)
	fadds 16(%ecx)
	fstps 4(%eax,%edx)
	movl 4(%ecx),%eax
	flds 8(%eax,%edx)
	fadds 20(%ecx)
	fstps 8(%eax,%edx)
	addl $12,%edx
	cmpl 8(%ecx),%ebx
	jl .L514
.L512:
	popl %ebx
	leave
	ret
.Lfe5:
	.size	 surf3d_translate,.Lfe5-surf3d_translate
	.ident	"GCC: (GNU) 2.95.3 19991030 (prerelease)"