-
Notifications
You must be signed in to change notification settings - Fork 3
/
r_phase4.gas
1394 lines (1195 loc) · 24.2 KB
/
r_phase4.gas
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
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
.long
.dc.l codeend - _ref4_start
_ref4_start::
.gpu
.org $f03100
DIVCONTROL .equ $f0211c
S_LE .ccdef $14 ; PL
U_LE .ccdef $04 ; CC
S_GT .ccdef $18 ; MI
U_GT .ccdef $08 ; CS
S_LT .ccdef $15 ; PL+NE
U_LT .ccdef $05 ; CC+NE
alt_viewx .equr r10
alt_viewy .equr r11
alt_viewangle .equr r12
alt_firstflat .equr r13
FP .equr r14
scratch .equr r10
scratch2 .equr r11
RETURNVALUE .equr r29
RETURNPOINT .equr r28
MATH_A .equr r27
MATH_B .equr r26
MATH_C .equr r25
MATH_RTS .equr r24
MATH_SIGN .equr r23
.extern _viewx,_viewy,_viewangle,_firstflat
;
; load up values from main memory
;
movei #_viewx,scratch
load (scratch),scratch
moveta scratch,alt_viewx
movei #_viewy,scratch
load (scratch),scratch
moveta scratch,alt_viewy
movei #_viewangle,scratch
load (scratch),scratch
moveta scratch,alt_viewangle
movei #_firstflat,scratch
load (scratch),scratch
moveta scratch,alt_firstflat
movei #codestart,scratch
jump T,(scratch)
nop
GPU_IMUL:
move MATH_A,MATH_SIGN
xor MATH_B,MATH_SIGN
abs MATH_A
abs MATH_B
move MATH_A,MATH_C
mult MATH_B,MATH_C
move MATH_B,scratch2
shrq #16,scratch2
mult MATH_A,scratch2
shlq #16,scratch2
add scratch2,MATH_C
move MATH_A,scratch2
shrq #16,scratch2
mult MATH_B,scratch2
shlq #16,scratch2
add scratch2, MATH_C
btst #31,MATH_SIGN
jump EQ,(MATH_RTS)
nop
jump T,(MATH_RTS)
neg MATH_C
; fixed_t FixedMul (fixed_t a, fixed_t b)
_G_FixedMul::
; ah al
; bh bl
;------
; bl*al
; bl*ah
; bh*al
;ah*bh
;-----------
; xx xx
load (FP),MATH_A
load (FP+1),MATH_B
move MATH_A,MATH_SIGN
xor MATH_B,MATH_SIGN
abs MATH_A
abs MATH_B
move MATH_A,RETURNVALUE
mult MATH_B,RETURNVALUE ; al*bl
shrq #16,RETURNVALUE
move MATH_B,scratch2
shrq #16,scratch2
mult MATH_A,scratch2 ; al*bh
add scratch2,RETURNVALUE
move MATH_A,scratch2
shrq #16,scratch2
mult MATH_B,scratch2 ; bl*ah
add scratch2, RETURNVALUE
move MATH_A,scratch2
shrq #16,scratch2
move MATH_B,scratch
shrq #16,scratch
mult scratch,scratch2 ; bh*ah
shlq #16,scratch2
add scratch2, RETURNVALUE
btst #31,MATH_SIGN
jump EQ,(RETURNPOINT)
nop
jump T,(RETURNPOINT)
neg RETURNVALUE
;============================================================================
_R_CheckPixels::
;============================================================================
.extern _lumpcache, _cacheneeded, _framecount
load (FP),scratch ; local lumpnum
shlq #2,scratch
movei #_lumpcache,scratch2
add scratch2,scratch
load (scratch),RETURNVALUE
or RETURNVALUE,RETURNVALUE
jr NE,incache
moveq #1,scratch ; harmless delay slot
movei #_cacheneeded,scratch2
store scratch,(scratch2)
jump T,(RETURNPOINT)
load (FP),RETURNVALUE
incache:
movei #_framecount,scratch2
load (scratch2),scratch
move RETURNVALUE,scratch2
subq #12,scratch2
jump T,(RETURNPOINT)
store scratch,(scratch2) ; memblock->lockframe = framecount
;============================================================================
_R_PointToDist::
;============================================================================
pd_angle .equr r9
pd_dx .equr r8
pd_dy .equr r7
pd_temp .equr r6
.extern _tantoangle,_finesine
load (FP),scratch
movefa alt_viewx,pd_dx
sub scratch,pd_dx
abs pd_dx
load (FP+1),scratch
movefa alt_viewy,pd_dy
sub scratch,pd_dy
abs pd_dy
movei #DIVCONTROL,scratch ; divide unit control
moveq #1,scratch2
store scratch2,(scratch) ; turn on frac div
cmp pd_dx,pd_dy
jr U_GT,noflip
move pd_dx,pd_temp ; harmless delay slot
move pd_dy,pd_dx
move pd_temp,pd_dy
noflip:
div pd_dx,pd_dy ; FixedDiv
shrq #5,pd_dy
shlq #2,pd_dy
movei #_tantoangle,scratch2
add pd_dy,scratch2
load (scratch2),pd_angle
movei #$40000000,scratch2
add scratch2,pd_angle
shrq #19,pd_angle
shlq #2,pd_angle
movei #_finesine,scratch2
add scratch2,pd_angle
load (pd_angle),pd_angle
div pd_angle,pd_dx ; FixedDiv
move pd_dx,RETURNVALUE ; make sure it completes
moveq #0,scratch2
jump T,(RETURNPOINT)
store scratch2,(scratch) ; turn off frac div
;============================================================================
_R_ScaleFromGlobalAngle::
;fixed_t R_ScaleFromGlobalAngle (fixed_t rw_distance, angle_t visangle)
;============================================================================
sg_distance .equr r9
sg_visangle .equr r8
sg_sinea .equr r7
sg_sineb .equr r6
sg_viewangle .equr r5
sg_finesine .equr r4
load (FP),sg_distance
load (FP+1),sg_visangle
movei #$40000000,scratch
add scratch,sg_visangle
movei #_finesine,sg_finesine
movefa alt_viewangle,scratch
neg scratch
add sg_visangle,scratch
shrq #19,scratch
shlq #2,scratch
add sg_finesine,scratch
load (scratch),sg_sinea
movei #_normalangle,scratch
load (scratch),scratch
neg scratch
add sg_visangle,scratch
shrq #19,scratch
shlq #2,scratch
add sg_finesine,scratch
load (scratch),sg_sineb
movei #22*8,scratch
mult scratch,sg_sineb
movei #DIVCONTROL,scratch2 ; divide unit control
moveq #1,scratch
store scratch,(scratch2) ; turn on frac div
move sg_distance,scratch
shrq #16,scratch
mult sg_sinea,sg_distance
mult sg_sinea,scratch
shrq #16,sg_distance
add scratch,sg_distance
div sg_distance,sg_sineb ; FixedDiv
move sg_sineb,RETURNVALUE
moveq #0,scratch
jump T,(RETURNPOINT)
store scratch,(scratch2) ; turn off frac div
;===========================================================================
_R_FinishWallPrep::
;5 dag registers 3 register variables
;localoffset:8 regoffset:24 argoffset:60
;===========================================================================
.extern _firstflat,_skytexturep,_xtoviewangle
fw_wc .equr r15
fw_offsetangle .equr r19
fw_actionbits .equr r19 ; not used for long
fw_texture .equr r18
fw_R_CheckPixels .equr r17
load (FP),fw_wc
movei #60,scratch
sub scratch,FP
store r28,(FP+6) ; push ;(RETURNPOINT) ; store returnpoint once
movei #_R_CheckPixels,fw_R_CheckPixels
load (fw_wc+6),fw_actionbits
btst #2,fw_actionbits ; AC_TOPTEXTURE
jr EQ,notoptex
nop
load (fw_wc+10),fw_texture
moveq #20,scratch
add fw_texture,scratch
load (scratch),r0 ; texture->lumpnum
store r0,(FP) ; arg[]
move pc,RETURNPOINT
jump T,(fw_R_CheckPixels)
addq #6,RETURNPOINT
addq #16,fw_texture
store RETURNVALUE,(fw_texture) ;texture->data
notoptex:
btst #3,fw_actionbits ; AC_BOTTOMTEXTURE
jr EQ,nobottex
nop
load (fw_wc+14),fw_texture
moveq #20,scratch
add fw_texture,scratch
load (scratch),r0 ; texture->lumpnum
store r0,(FP) ; arg[]
move pc,RETURNPOINT
jump T,(fw_R_CheckPixels)
addq #6,RETURNPOINT
addq #16,fw_texture
store RETURNVALUE,(fw_texture)
nobottex:
movefa alt_firstflat,r0
load (fw_wc+4),r1 ; wc->floorpic
add r1,r0
store r0,(FP) ; arg[]
move pc,RETURNPOINT
jump T,(fw_R_CheckPixels)
addq #6,RETURNPOINT
store RETURNVALUE,(fw_wc+4) ; wc->floorpic
load (fw_wc+5),r1 ; wc->ceilingpic
btst #31,r1
jr EQ,notskywall
nop
movei #_skytexturep,r0
load (r0),r0
move r0,r1
addq #20,r1
load (r1),r1
store r1,(FP) ; arg[]
move pc,RETURNPOINT
jump T,(fw_R_CheckPixels)
addq #6,RETURNPOINT
addq #16,r0
jr T,gotceiling
store RETURNVALUE,(r0) ; delay slot, skytexturep->data
notskywall:
movefa alt_firstflat,r0
add r1,r0
store r0,(FP) ; arg[]
move pc,RETURNPOINT
jump T,(fw_R_CheckPixels)
addq #6,RETURNPOINT
store RETURNVALUE,(fw_wc+5) ; wc->ceilingpic
gotceiling:
load (FP+15),r0 ; local wc
load (r0),r1
move r1,r16 ;(seg)
movei #_normalangle,r1
moveq #12,r2
move r16,r3 ;(seg)
add r2,r3
load (r3),r3
movei #1073741824,r4
add r4,r3
store r3,(r1)
load (r1),r1
add r2,r0
load (r0),r0
sub r0,r1
move r1,fw_offsetangle ;(offsetangle)
move fw_offsetangle,r0 ;(offsetangle)
moveq #0,r1
cmp r0,r1
movei #L118,scratch
jump EQ,(scratch)
nop
jump MI,(scratch)
nop
neg fw_offsetangle ; offsetangle
L118:
movei #1073741824,r0
cmp fw_offsetangle,r0 ;(offsetangle)
movei #L120,scratch
jump CC,(scratch)
nop
movei #1073741824,r0
move r0,fw_offsetangle ;(offsetangle)
L120:
move FP,r0
addq #12,r0 ; &distangle
movei #1073741824,r1
sub fw_offsetangle,r1 ;(offsetangle)
store r1,(r0)
load (r16),r0 ;(seg)
load (r0),r1
addq #4,r0
load (r0),r0
store r1,(FP) ; arg[]
store r0,(FP+1) ; arg[]
movei #_R_PointToDist,r0
move pc,RETURNPOINT
jump T,(r0)
addq #6,RETURNPOINT
movei #_hyp,r0
store RETURNVALUE,(r0) ;(RETURNVALUE)
move FP,r0
addq #16,r0 ; &sineval
load (FP+3),r1 ; local distangle
shrq #19,r1
shlq #2,r1
movei #_finesine,r2
add r2,r1
load (r1),r1
store r1,(r0)
movei #_hyp,r1
load (r1),r1
load (r0),r0
store r1,(FP) ; arg[]
store r0,(FP+1) ; arg[]
movei #_G_FixedMul,r0
move pc,RETURNPOINT
jump T,(r0)
addq #6,RETURNPOINT
store RETURNVALUE,(FP+2) ; rw_distance
load (FP+15),r0 ; local wc
movei #104,r1
add r1,r0
move r29,r1 ;(RETURNVALUE)
store r1,(r0)
load (FP+2),r0 ; local rw_distance
store r0,(FP) ; arg[]
movei #_viewangle,r0
load (r0),r0
load (FP+15),r1 ; local wc
move r1,r2
addq #4,r2
load (r2),r2
shlq #2,r2
movei #_xtoviewangle,r3
add r3,r2
load (r2),r2
add r2,r0
or r0,scratch ; scoreboard bug
store r0,(FP+1) ; arg[]
movei #_R_ScaleFromGlobalAngle,r0
move pc,RETURNPOINT
jump T,(r0)
addq #6,RETURNPOINT
movei #84,r0
add r0,r1
move r29,r0 ;(RETURNVALUE)
store r0,(r1)
move r0,r17 ;(scale2)
move FP,r1
addq #20,r1 ; &scalefrac
store r0,(r1)
load (FP+15),r0 ; local wc
move r0,r1
addq #8,r1
load (r1),r1
addq #4,r0
load (r0),r0
cmp r1,r0
movei #L122,scratch
jump PL,(scratch)
nop
load (FP+2),r0 ; local rw_distance
store r0,(FP) ; arg[]
movei #_viewangle,r0
load (r0),r0
load (FP+15),r1 ; local wc
addq #8,r1
load (r1),r1
shlq #2,r1
movei #_xtoviewangle,r2
add r2,r1
load (r1),r1
add r1,r0
or r0,scratch ; scoreboard bug
store r0,(FP+1) ; arg[]
movei #_R_ScaleFromGlobalAngle,r0
move pc,RETURNPOINT
jump T,(r0)
addq #6,RETURNPOINT
move RETURNVALUE,r17 ;(RETURNVALUE)(scale2)
load (FP+15),r0 ; local wc
movei #92,r1
move r0,r2
add r1,r2
load (FP+5),r1 ; local scalefrac
move r17,r3 ;(scale2)
sub r1,r3
move r0,r1
addq #8,r1
load (r1),r1
addq #4,r0
load (r0),r0
sub r0,r1
move r1,MATH_SIGN
move r1,MATH_B
xor r3,MATH_SIGN
move r3,r0
abs MATH_B
abs r0
div MATH_B,r0
btst #31, MATH_SIGN
jr EQ,L135
nop
neg r0
L135:
store r0,(r2)
L122:
load (FP+15),r0 ; local wc
movei #88,r1
add r1,r0
move r17,r1 ;(scale2)
store r1,(r0)
load (FP+15),r0 ; local wc
addq #24,r0
load (r0),r0
moveq #12,r1
and r1,r0
moveq #0,r1
cmp r0,r1
movei #L124,scratch
jump EQ,(scratch)
nop
load (FP+15),r0 ; local wc
addq #24,r0
load (r0),r1
movei #128,r2
or r2,r1
store r1,(r0)
load (FP+15),r0 ; local wc
store r0,(FP) ; arg[]
movei #_R_SetupCalc,r0
move pc,RETURNPOINT
jump T,(r0)
addq #6,RETURNPOINT
L124:
load (FP+6), RETURNPOINT ; pop
movei #60,scratch
jump T,(RETURNPOINT)
add scratch,FP ; delay slot
codestart:
;====================
_R_LatePrep::
;2 dag registers 2 register variables
;localoffset:4 regoffset:4 argoffset:24
;====================
subq #24,FP
movei #_cacheneeded,r0
moveq #0,r1
store r1,(r0)
movei #_viswalls,r0
move r0,r16 ;(wall)
movei #L55,r0
jump T,(r0)
nop
L52:
store r16,(FP) ; arg[] ;(wall)
movei #_R_FinishWallPrep,r0
store r28,(FP+1) ; push ;(RETURNPOINT)
store r16,(FP+2) ; push ;(wall)
movei #L69,RETURNPOINT
jump T,(r0)
store r15,(FP+3) ; delay slot push ;(spr)
L69:
load (FP+2),r16 ; pop ;(wall)
load (FP+3),r15 ; pop ;(spr)
load (FP+1), RETURNPOINT ; pop
L53:
movei #112,r0
move r16,r1 ;(wall)
add r0,r1
move r1,r16 ;(wall)
L55:
move r16,r0 ;(wall)
movei #_lastwallcmd,r1
load (r1),r1
cmp r0,r1
movei #L52,scratch
jump U_LT,(scratch)
nop
movei #_vissprites,r0
move r0,r15 ;(spr)
movei #L59,r0
jump T,(r0)
nop
L56:
store r15,(FP) ; arg[] ;(spr)
movei #_R_FinishSprite,r0
store r28,(FP+1) ; push ;(RETURNPOINT)
store r16,(FP+2) ; push ;(wall)
movei #L70,RETURNPOINT
jump T,(r0)
store r15,(FP+3) ; delay slot push ;(spr)
L70:
load (FP+2),r16 ; pop ;(wall)
load (FP+3),r15 ; pop ;(spr)
load (FP+1), RETURNPOINT ; pop
L57:
movei #60,r0
move r15,r1 ;(spr)
add r0,r1
move r1,r15 ;(spr)
L59:
move r15,r0 ;(spr)
movei #_lastsprite_p,r1
load (r1),r1
cmp r0,r1
movei #L56,scratch
jump U_LT,(scratch)
nop
movei #L63,r0
jump T,(r0)
nop
L60:
store r15,(FP) ; arg[] ;(spr)
movei #_R_FinishPSprite,r0
store r28,(FP+1) ; push ;(RETURNPOINT)
store r16,(FP+2) ; push ;(wall)
movei #L71,RETURNPOINT
jump T,(r0)
store r15,(FP+3) ; delay slot push ;(spr)
L71:
load (FP+2),r16 ; pop ;(wall)
load (FP+3),r15 ; pop ;(spr)
load (FP+1), RETURNPOINT ; pop
L61:
movei #60,r0
move r15,r1 ;(spr)
add r0,r1
move r1,r15 ;(spr)
L63:
move r15,r0 ;(spr)
movei #_vissprite_p,r1
load (r1),r1
cmp r0,r1
movei #L60,scratch
jump U_LT,(scratch)
nop
movei #_phasetime+16,r0
movei #_samplecount,r1
load (r1),r1
store r1,(r0)
movei #_cacheneeded,r0
load (r0),r0
moveq #0,r1
cmp r0,r1
movei #L65,scratch
jump EQ,(scratch)
nop
movei #_gpucodestart,r0
movei #_ref5_start,r1
store r1,(r0)
movei #L66,r0
jump T,(r0)
nop
L65:
movei #_phasetime+20,r0
movei #_phasetime+16,r1
load (r1),r1
store r1,(r0)
movei #_gpucodestart,r0
movei #_ref6_start,r1
store r1,(r0)
L66:
movei #_cacheneeded,r0
load (r0),r0
move r0,RETURNVALUE
L51:
jump T,(RETURNPOINT)
addq #24,FP ; delay slot
;====================
_R_FinishSprite::
;3 dag registers 8 register variables
;localoffset:8 regoffset:8 argoffset:56
;====================
movei #56,scratch
sub scratch,FP
load (FP+14),r0 ; local vis
addq #32,r0
load (r0),r1
move r1,r20 ;(lump)
move r20,r1 ;(lump)
shlq #4,r1
movei #_lumpinfo,r2
load (r2),r2
add r2,r1
load (r1),r1
movei #_wadfileptr,r2
load (r2),r2
add r2,r1
move r1,r17 ;(patch)
store r1,(r0)
move r20,r0 ;(lump)
addq #1,r0
store r0,(FP) ; arg[]
movei #_R_CheckPixels,r0
store r28,(FP+2) ; push ;(RETURNPOINT)
store r22,(FP+3) ; push ;(80)
store r21,(FP+4) ; push ;(77)
store r20,(FP+5) ; push ;(lump)
store r19,(FP+6) ; push ;(xscale)
store r18,(FP+7) ; push ;(x2)
store r17,(FP+8) ; push ;(patch)
store r16,(FP+9) ; push ;(tx)
movei #L87,RETURNPOINT
jump T,(r0)
store r15,(FP+10) ; delay slot push ;(x1)
L87:
load (FP+3),r22 ; pop ;(80)
load (FP+4),r21 ; pop ;(77)
load (FP+5),r20 ; pop ;(lump)
load (FP+6),r19 ; pop ;(xscale)
load (FP+7),r18 ; pop ;(x2)
load (FP+8),r17 ; pop ;(patch)
load (FP+9),r16 ; pop ;(tx)
load (FP+10),r15 ; pop ;(x1)
load (FP+2), RETURNPOINT ; pop
load (FP+14),r0 ; local vis
movei #56,r1
add r1,r0
move r29,r1 ;(RETURNVALUE)
store r1,(r0)
load (FP+14),r0 ; local vis
load (r0),r1
move r1,r16 ;(tx)
addq #12,r0
load (r0),r0
move r0,r19 ;(xscale)
move r17,r0 ;(patch)
addq #4,r0
loadw (r0),r0
movei #$ffff8000,scratch
add scratch,r0
xor scratch,r0
shlq #16,r0
move r16,r1 ;(tx)
sub r0,r1
move r1,r16 ;(tx)
store r16,(FP) ; arg[] ;(tx)
or r19,scratch ; scoreboard bug ;(xscale)
store r19,(FP+1) ; arg[] ;(xscale)
movei #_G_FixedMul,r0
store r28,(FP+2) ; push ;(RETURNPOINT)
store r22,(FP+3) ; push ;(80)
store r21,(FP+4) ; push ;(77)
store r20,(FP+5) ; push ;(lump)
store r19,(FP+6) ; push ;(xscale)
store r18,(FP+7) ; push ;(x2)
store r17,(FP+8) ; push ;(patch)
store r16,(FP+9) ; push ;(tx)
movei #L88,RETURNPOINT
jump T,(r0)
store r15,(FP+10) ; delay slot push ;(x1)
L88:
load (FP+3),r22 ; pop ;(80)
load (FP+4),r21 ; pop ;(77)
load (FP+5),r20 ; pop ;(lump)
load (FP+6),r19 ; pop ;(xscale)
load (FP+7),r18 ; pop ;(x2)
load (FP+8),r17 ; pop ;(patch)
load (FP+9),r16 ; pop ;(tx)
load (FP+10),r15 ; pop ;(x1)
load (FP+2), RETURNPOINT ; pop
movei #5242880,r0
move r29,r1 ;(RETURNVALUE)
add r0,r1
move r1,r0
sharq #16,r0
move r0,r15 ;(x1)
movei #160,r0
cmp r15,r0 ;(x1)
movei #L73,scratch
jump PL,(scratch)
nop
load (FP+14),r0 ; local vis
addq #32,r0
moveq #0,r1
store r1,(r0)
movei #L72,r0
jump T,(r0)
nop
L73:
loadw (r17),r0 ;(patch)
movei #$ffff8000,scratch
add scratch,r0
xor scratch,r0
shlq #16,r0
move r16,r1 ;(tx)
add r0,r1
move r1,r16 ;(tx)
store r16,(FP) ; arg[] ;(tx)
or r19,scratch ; scoreboard bug ;(xscale)
store r19,(FP+1) ; arg[] ;(xscale)
movei #_G_FixedMul,r0
store r28,(FP+2) ; push ;(RETURNPOINT)
store r22,(FP+3) ; push ;(80)
store r21,(FP+4) ; push ;(77)
store r20,(FP+5) ; push ;(lump)
store r19,(FP+6) ; push ;(xscale)
store r18,(FP+7) ; push ;(x2)
store r17,(FP+8) ; push ;(patch)
store r16,(FP+9) ; push ;(tx)
movei #L89,RETURNPOINT
jump T,(r0)
store r15,(FP+10) ; delay slot push ;(x1)
L89:
load (FP+3),r22 ; pop ;(80)
load (FP+4),r21 ; pop ;(77)
load (FP+5),r20 ; pop ;(lump)
load (FP+6),r19 ; pop ;(xscale)
load (FP+7),r18 ; pop ;(x2)
load (FP+8),r17 ; pop ;(patch)
load (FP+9),r16 ; pop ;(tx)
load (FP+10),r15 ; pop ;(x1)
load (FP+2), RETURNPOINT ; pop
movei #5242880,r0
move r29,r1 ;(RETURNVALUE)
add r0,r1
move r1,r0
sharq #16,r0
subq #1,r0
move r0,r18 ;(x2)
moveq #0,r0
cmp r18,r0 ;(x2)
movei #L75,scratch
jump EQ,(scratch)
nop
jump MI,(scratch)
nop
load (FP+14),r0 ; local vis
addq #32,r0
moveq #0,r1
store r1,(r0)
movei #L72,r0
jump T,(r0)
nop
L75:
load (FP+14),r0 ; local vis
movei #52,r1
move r0,r2
add r1,r2
movei #48,r1
add r1,r0
load (r0),r0
move r17,r1 ;(patch)
addq #6,r1
loadw (r1),r1
movei #$ffff8000,scratch
add scratch,r1
xor scratch,r1
shlq #16,r1
add r1,r0
store r0,(r2)
load (FP+14),r0 ; local vis
move r0,r1
addq #28,r1
movei #52,r2
add r2,r0
load (r0),r0
movei #_viewz,r2
load (r2),r2
sub r2,r0
store r0,(r1)
moveq #0,r0
cmp r15,r0 ;(x1)
movei #L78,scratch
jump EQ,(scratch)
nop
jump MI,(scratch)
nop
moveq #0,r0
move r0,r21 ;(77)
movei #L79,r0
jump T,(r0)
nop
L78:
move r15,r21 ;(x1)(77)
L79:
load (FP+14),r0 ; local vis
store r21,(r0) ;(77)
movei #160,r0
cmp r18,r0 ;(x2)
movei #L81,scratch
jump S_LT,(scratch)
nop
movei #159,r0
move r0,r22 ;(80)
movei #L82,r0
jump T,(r0)
nop
L81:
move r18,r22 ;(x2)(80)
L82:
load (FP+14),r0 ; local vis
addq #4,r0
store r22,(r0) ;(80)
load (FP+14),r0 ; local vis
addq #16,r0
load (r0),r0
moveq #0,r1
cmp r0,r1
movei #L83,scratch
jump EQ,(scratch)
nop
jump MI,(scratch)
nop