-
Notifications
You must be signed in to change notification settings - Fork 0
/
mxdrv17.s
2810 lines (2619 loc) · 43.1 KB
/
mxdrv17.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
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
;=============================================
; Filename sound/mxdrv/2.06+17_Rel.X5-S/mxdrv17.x
;
;
; Base address 000000
; Exec address 0017ea
; Text size 001ba6 byte(s)
; Data size 000000 byte(s)
; Bss size 0006a2 byte(s)
; 447 Labels
;
; Commandline dis -h -k -m68030 -q1 -B -M -w16 -o120 -gsound/mxdrv/2.06+17_Rel.X5-S/mxdrv17.lab --overwrite sound/mxdrv/2.06+17_Rel.X5-S/mxdrv17.x sound/mxdrv/2.06+17_Rel.X5-S/mxdrv17.s
; DIS version 3.16
;=============================================
.include inc/doscall.mac
.include inc/iocscall.mac
.include inc/fefunc.mac
.cpu 68030
.text
L000000:
.dc.b 'EX17'
L000004:
.dc.b 'mxdrv206'
Trap4Handler:
movem.l d1-d7/a0-a6,-(a7)
lea.l (L00220c,pc),a5
cmp.b #$20,d0 ;' '
bcc L000024
add.w d0,d0
move.w (MXDRVCallTable,pc,d0.w),d0
jsr (MXDRVCallTable,pc,d0.w)
L000024:
movem.l (a7)+,d1-d7/a0-a6
rte
MXDRVCallTable:
.dc.w MXDRVFree-MXDRVCallTable
.dc.w MXDRVError-MXDRVCallTable
.dc.w L_SETMDX-MXDRVCallTable
.dc.w L_SETPDX-MXDRVCallTable
.dc.w L_PLAY-MXDRVCallTable
.dc.w L_STOP-MXDRVCallTable
.dc.w L_PAUSE-MXDRVCallTable
.dc.w L_CONT-MXDRVCallTable
.dc.w L_GetMDXTitle-MXDRVCallTable
.dc.w L_GetPDXFilename-MXDRVCallTable
.dc.w L_0A-MXDRVCallTable
.dc.w L_0B-MXDRVCallTable
.dc.w L_FadeOut-MXDRVCallTable
.dc.w L_0D-MXDRVCallTable
.dc.w L_SetChannelMask-MXDRVCallTable
.dc.w L_PlayWithMask-MXDRVCallTable
.dc.w L_GetOPMBuf-MXDRVCallTable
.dc.w L_11-MXDRVCallTable
.dc.w L_GetPlaybackFlags-MXDRVCallTable
.dc.w L_SetIgnoreKeys-MXDRVCallTable
.dc.w L_14-MXDRVCallTable
.dc.w L_15-MXDRVCallTable
.dc.w L_16-MXDRVCallTable
.dc.w L_17-MXDRVCallTable
.dc.w L_GetPCMBuf-MXDRVCallTable
.dc.w L_19-MXDRVCallTable
.dc.w L_1A-MXDRVCallTable
.dc.w L_1B-MXDRVCallTable
.dc.w L_1C-MXDRVCallTable
.dc.w L_1D-MXDRVCallTable
.dc.w L_1E-MXDRVCallTable
.dc.w L_1F-MXDRVCallTable
L_0A:
move.b d1,(-$03f8,a5)
rts
L_0B:
move.b d1,(-$03f7,a5)
rts
L_FadeOut:
move.w d1,(-$03ee,a5)
st.b (-$03f5,a5)
L00007e:
rts
L_SetChannelMask:
move.w d1,(-$03f0,a5)
rts
L_GetOPMBuf:
lea.l (OPMBuf,pc),a0
move.l a0,d0
rts
L_11:
lea.l (L001e0e,pc),a0
tst.l d1
bmi L00009a
move.b d1,(a0)
rts
L00009a:
move.b (a0),d0
rts
L_GetPlaybackFlags:
move.b (-$03fa,a5),-(a7)
move.w (a7)+,d0
move.b (-$03f9,a5),d0
rts
L_SetIgnoreKeys:
move.b (-$0402,a5),d0
move.b d1,(-$0402,a5)
rts
L_14:
move.w (-$0406,a5),d0
not.w d0
rts
L_15:
move.b (-$0401,a5),d0
move.b d1,(-$0401,a5)
rts
L_16:
move.b (-$0404,a5),d0
move.b d1,(-$0404,a5)
bsr L_STOP
rts
L_17:
move.b (-$0404,a5),d0
beq L0001ee
L0000dc:
movem.l d1-d7/a0-a6,-(a7)
st.b ($0039,a5)
lea.l (L001e1e,pc),a0
lea.l (fadeout_enable,pc),a1
tst.b (a1)
beq L000174
bpl L0000fc
move.b #$7f,(a1)
move.w (a0),($0002,a0)
L0000fc:
tst.w ($0002,a0)
bmi L000108
subq.w #2,($0002,a0)
bra L000174
L000108:
lea.l (fadeout_offset,pc),a1
cmpi.b #$0a,(a1)
bge L000120
L000112:
cmpi.b #$3e,(a1) ;'>'
bge L000126
addq.b #1,(a1)
move.w (a0),($0002,a0)
bra L000174
L000120:
st.b (-$03f7,a5)
bra L000112
L000126:
tst.b (-$03f4,a5)
beq L000134
bsr L00077a
bra L0001d6
L000134:
move.b #$7f,(a1)
clr.b (-$03f5,a5)
move.b #$01,(-$03f9,a5)
bsr L_PAUSE
movea.l ($0088),a0
move.l (-$0008,a0),d0
cmp.l #$50434d34,d0 ;'PCM4'
beq L00015e
cmp.l #$50434d38,d0 ;'PCM8'
bne L000164
L00015e:
move.w #$0100,d0
trap #2
L000164:
tst.b (-$0418,a5)
beq L000174
move.w #$01ff,d0
trap #2
clr.b (-$0418,a5)
L000174:
lea.l (opm_tempo,pc),a0
move.b (a0),d2
moveq.l #$12,d1
tst.b (-$03f9,a5)
bne L0001d6
addq.w #1,(-$0666,a5)
lea.l (L001f3c,pc),a6
moveq.l #$00,d7
L00018c:
bsr L001050
bsr L0011b4
move.w (channel_mask,pc),d0
btst.l d7,d0
bne L0001a0
bsr L000c66
L0001a0:
lea.l ($0050,a6),a6
addq.w #1,d7
cmp.w #$0009,d7
bcs L00018c
tst.b (-$0418,a5)
beq L0001d6
lea.l (L001bc4,pc),a6
L0001b6:
bsr L001050
bsr L0011b4
move.w (channel_mask,pc),d0
btst.l d7,d0
bne L0001ca
bsr L000c66
L0001ca:
lea.l ($0050,a6),a6
addq.w #1,d7
cmp.w #$0010,d7
bcs L0001b6
L0001d6:
tst.b ($00e90003)
bmi L0001d6
move.b #$1b,($00e90001)
clr.b ($0039,a5)
movem.l (a7)+,d1-d7/a0-a6
L0001ee:
move.b (-$03fa,a5),-(a7)
move.w (a7)+,d0
move.b (-$03f9,a5),d0
rts
L_GetPCMBuf:
lea.l (L001bc4,pc),a0
move.l a0,d0
rts
L_19:
lea.l (pcm_work_area,pc),a0
move.l a0,d0
rts
L_1A:
bsr L000216
tst.l d0
bmi L000214
move.l d1,($0004,a7)
L000214:
rts
L000216:
movem.l d2-d4/a0-a2,-(a7)
movea.l a0,a1
moveq.l #$00,d0
moveq.l #$ff,d3
moveq.l #$00,d1
L000222:
move.l (a1)+,d4
move.l (a1)+,d2
and.l #$00ffffff,d4
beq L00025a
cmp.l (-$0008,a1),d4
bne L000260
and.l #$00ffffff,d2
beq L00025a
cmp.l (-$0004,a1),d2
bne L000260
add.l d4,d2
cmp.l d1,d2
bcs L00024a
move.l d2,d1
L00024a:
cmp.l d4,d3
bcs L000250
move.l d4,d3
L000250:
lea.l (a0,d3.l),a2
cmpa.l a2,a1
beq L00025e
bhi L000266
L00025a:
addq.w #1,d0
bra L000222
L00025e:
addq.w #1,d0
L000260:
movem.l (a7)+,d2-d4/a0-a2
rts
L000266:
moveq.l #$ff,d0
movem.l (a7)+,d2-d4/a0-a2
rts
L_1B:
movem.l d1-d5/a0-a2,-(a7)
bsr L000216
move.l d0,d2
bmi L0002e4
move.l d0,d5
lsl.l #3,d0
moveq.l #$60,d3 ;'`'
L00027e:
sub.l d3,d2
bcc L00027e
add.l d3,d2
beq L0002e4
sub.l d2,d3
move.l d3,d4
lsl.l #3,d3
move.l d1,d2
addq.l #1,d2
and.w #$fffe,d2
lea.l (a0,d2.l),a2
add.l d3,d1
lea.l (a0,d1.l),a1
sub.l d0,d2
lsr.l #1,d2
move.l d2,d0
lsr.l #1,d0
subq.l #1,d0
swap.w d0
L0002aa:
swap.w d0
L0002ac:
move.l -(a2),-(a1)
dbra d0,L0002ac
swap.w d0
dbra d0,L0002aa
and.w #$0001,d2
beq L0002c0
move.w -(a2),-(a1)
L0002c0:
subq.w #1,d4
L0002c2:
clr.l -(a1)
clr.l -(a1)
dbra d4,L0002c2
subq.l #1,d5
swap.w d5
L0002ce:
swap.w d5
L0002d0:
move.l (a0)+,d0
beq L0002d8
add.l d3,(-$0004,a0)
L0002d8:
addq.w #4,a0
dbra d5,L0002d0
swap.w d5
dbra d5,L0002ce
L0002e4:
move.l d1,d0
movem.l (a7)+,d1-d5/a0-a2
rts
L_1C:
movem.l d1-d7/a0-a4,-(a7)
bsr L000216
tst.l d0
bmi L000462
add.l a0,d1
addq.l #1,d1
and.w #$fffe,d1
move.l d1,d3
move.l d3,d7
move.l d0,d2
exg.l a0,a1
bsr L000216
tst.l d0
bmi L000462
add.l d1,d3
add.l a0,d1
move.l d1,d6
move.l d0,d1
lsl.l #3,d1
add.l a0,d1
move.l d1,d4
suba.l d3,a2
bcs L00045a
moveq.l #$60,d1 ;'`'
move.l d2,d3
L00032c:
sub.l d1,d3
bcc L00032c
add.l d1,d3
beq L000342
sub.l d1,d3
neg.l d3
move.l d3,d1
lsl.l #3,d3
cmp.l a2,d3
bhi L00045a
L000342:
add.l d0,d3
lsl.l #3,d3
add.l d7,d3
movea.l a0,a4
cmp.l a0,d3
bcs L00037a
move.l d0,d1
lsl.l #3,d1
cmp.l (-$0664,a5),d1
bhi L00045e
movea.l (-$0660,a5),a4
movea.l a0,a3
move.l d0,d1
subq.l #1,d1
swap.w d1
L000366:
swap.w d1
L000368:
move.l (a3)+,(a4)+
move.l (a3)+,(a4)+
dbra d1,L000368
swap.w d1
dbra d1,L000366
movea.l (-$0660,a5),a4
L00037a:
lsl.l #3,d0
move.l d0,d5
exg.l a0,a1
bsr L_1B
tst.l d0
bmi L000466
bsr L000216
move.l d0,d2
bmi L000462
add.l a0,d1
addq.l #1,d1
and.w #$fffe,d1
movea.l d1,a2
add.l d5,d1
lsl.l #3,d0
add.l a0,d0
add.l d5,d0
movea.l d1,a3
movea.l a3,a1
sub.l d0,d1
move.l d1,d7
lsr.l #2,d1
move.w sr,-(a7)
subq.l #1,d1
swap.w d1
L0003b6:
swap.w d1
L0003b8:
move.l -(a2),-(a3)
dbra d1,L0003b8
swap.w d1
dbra d1,L0003b6
move.w (a7)+,sr
bcc L0003ca
move.w -(a2),-(a3)
L0003ca:
movea.l d0,a2
suba.l d5,a2
cmpa.l a2,a4
beq L0003ea
move.l d5,d1
lsr.l #3,d1
subq.l #1,d1
swap.w d1
L0003da:
swap.w d1
L0003dc:
move.l (a4)+,(a2)+
move.l (a4)+,(a2)+
dbra d1,L0003dc
swap.w d1
dbra d1,L0003da
L0003ea:
movea.l d4,a2
sub.l d4,d6
move.l d6,d1
lsr.l #2,d1
subq.l #1,d1
swap.w d1
L0003f6:
swap.w d1
L0003f8:
move.l (a2)+,(a1)+
dbra d1,L0003f8
swap.w d1
dbra d1,L0003f6
move.w d6,d1
and.w #$0002,d1
beq L00040e
move.w (a2)+,(a1)+
L00040e:
and.w #$0001,d6
beq L000416
move.b (a2)+,(a1)+
L000416:
suba.l a0,a1
move.l d5,d1
move.l d2,d0
lsl.l #3,d0
add.l d0,d7
subq.l #1,d2
swap.w d2
L000424:
swap.w d2
L000426:
move.l (a0),d0
beq L00042c
add.l d1,(a0)
L00042c:
addq.w #8,a0
dbra d2,L000426
swap.w d2
dbra d2,L000424
lsr.l #3,d5
subq.l #1,d5
swap.w d5
L00043e:
swap.w d5
L000440:
move.l (a0),d0
beq L000446
add.l d7,(a0)
L000446:
addq.w #8,a0
dbra d5,L000440
swap.w d5
dbra d5,L00043e
move.l a1,d0
L000454:
movem.l (a7)+,d1-d7/a0-a4
rts
L00045a:
moveq.l #$ff,d0
bra L000454
L00045e:
moveq.l #$fe,d0
bra L000454
L000462:
moveq.l #$fd,d0
bra L000454
L000466:
moveq.l #$fc,d0
bra L000454
L_1D:
move.b (-$0404,a5),d4
move.w d1,d3
st.b (-$0404,a5)
move.w #$ffff,d1
movem.l d2-d4,-(a7)
bsr L_PlayWithMask
movem.l (a7)+,d2-d4
bra L000496
L_1E:
move.b (-$0404,a5),d4
move.w d1,d3
move.w #$ffff,(-$03f0,a5)
st.b (-$0404,a5)
L000496:
ori.w #$0700,sr
andi.b #$f7,($00e88009)
andi.w #$f8ff,sr
tst.b (-$03f9,a5)
bne L0004c0
subq.w #1,d2
bcs L0004c0
movem.l d2-d4,-(a7)
L0004b4:
bsr L0000dc
dbra d2,L0004b4
movem.l (a7)+,d2-d4
L0004c0:
move.w d3,(-$03f0,a5)
move.b d4,(-$0404,a5)
bne L_1F
tst.b (-$03f9,a5)
bne L_1F
bsr L00056a
moveq.l #$12,d1
move.b (-$0400,a5),d2
bsr WriteOPM
moveq.l #$14,d1
moveq.l #$3a,d2 ;':'
bsr WriteOPM
L_1F:
move.w (-$0666,a5),d0
rts
L_0D:
cmp.b #$f0,d1
beq L000552
cmp.b #$fc,d1
beq L00052e
tst.l d1
bmi L000534
tst.b (-$03f4,a5)
bne MXDRVError
move.l a2,(-$03dc,a5)
move.l a1,(-$03e8,a5)
move.l a1,(-$03e4,a5)
L000510:
tst.w (a1)
beq L000518
addq.w #6,a1
bra L000510
L000518:
subq.w #6,a1
move.l a1,(-$03e0,a5)
st.b (-$03f4,a5)
st.b (-$03f3,a5)
movea.l (L001e24,pc),a0
bra L000788
L00052e:
move.b (L001e19,pc),d0
rts
L000534:
clr.b (-$03f4,a5)
clr.b ($0024,a5)
clr.b ($0025,a5)
movea.l (mdx_data,pc),a0
move.l (a0),($000c,a5)
move.l ($0004,a0),($0010,a5)
bra StopPlayback
L000552:
bsr L000534
L000554:
movea.l (L001e30,pc),a0
pea.l (a0)
DOS _MFREE
addq.w #4,a7
moveq.l #$00,d0
move.l d0,(-$03dc,a5)
move.b d0,(-$03f3,a5)
rts
L00056a:
move.w sr,-(a7)
ori.w #$0700,sr
clr.b (-$03f9,a5)
tst.b (-$0404,a5)
bne L000596
lea.l (L_OPMINT,pc),a1
suba.l a0,a0
move.l a1,($010c,a0)
movea.l #$00e88000,a0
ori.b #$08,($0009,a0)
ori.b #$08,($0015,a0)
L000596:
move.w (a7)+,sr
rts
MXDRVFree:
bsr StopPlayback
move.l (a5),($0090,a0)
pea.l (L000000-$0000f0,pc)
DOS _MFREE
addq.w #4,a7
tst.b (-$03f3,a5)
beq L0005b2
bra L000554
L0005b2:
rts
L_SETMDX:
tst.b (-$03f4,a5)
beq L0005c4
movem.l d1/a1,-(a7)
bsr L000552
movem.l (a7)+,d1/a1
L0005c4:
lea.l ($0024,a5),a2
movea.l (mdx_data,pc),a0
move.l a0,($000c,a5)
move.l ($0014,a5),d0
bra L0005f8
L_SETPDX:
tst.b (-$03f4,a5)
beq L0005e8
movem.l d1/a1,-(a7)
bsr L000552
movem.l (a7)+,d1/a1
L0005e8:
lea.l ($0025,a5),a2
movea.l (pdx_data,pc),a0
move.l a0,($0010,a5)
move.l ($0018,a5),d0
L0005f8:
cmp.l d1,d0
bcs L000630
movem.l d1/a0-a2,-(a7)
bsr StopPlayback
movem.l (a7)+,d1/a0-a2
move.w d1,d0
andi.w #$0003,d0
lsr.l #2,d1
swap.w d1
L000610:
swap.w d1
L000612:
move.l (a1)+,(a0)+
dbra d1,L000612
swap.w d1
dbra d1,L000610
tst.w d0
beq L00062a
subq.w #1,d0
L000624:
move.b (a1)+,(a0)+
dbra d0,L000624
L00062a:
st.b (a2)
moveq.l #$00,d0
rts
L000630:
bset.l #$1f,d0
rts
L_STOP:
tst.b (-$03f4,a5)
bne L000552
StopPlayback:
move.b #$01,(-$03f9,a5)
move.w sr,-(a7)
ori.w #$0700,sr
bsr PausePlayback
movea.l ($0088),a0
move.l (-$0008,a0),d0
cmp.l #$50434d34,d0 ;'PCM4'
beq L000664
cmp.l #$50434d38,d0 ;'PCM8'
bne L00066a
L000664:
move.w #$0100,d0
trap #2
L00066a:
tst.b (-$0418,a5)
beq L00067a
move.w #$01ff,d0
trap #2
clr.b (-$0418,a5)
L00067a:
moveq.l #$0f,d2
moveq.l #$e0,d1
L00067e:
bsr WriteOPM
addq.b #1,d1
bne L00067e
lea.l (L00223c,pc),a0
lea.l (pcm_work_area,pc),a1
moveq.l #$07,d3
moveq.l #$00,d2
moveq.l #$08,d1
L000694:
bsr WriteOPM
move.b d2,(a0)+
move.b d2,(a1)+
addq.b #1,d2
dbra d3,L000694
movea.l #$00e88000,a0
andi.b #$f7,($0009,a0)
andi.b #$f7,($0015,a0)
suba.l a0,a0
move.l ($0004,a5),($010c,a0)
move.w (a7)+,sr
rts
L_PAUSE:
st.b (-$03fa,a5)
PausePlayback:
moveq.l #$07,d7
lea.l (L001f3c,pc),a6
L0006ca:
moveq.l #$7f,d0
bsr WriteTL
lea.l ($0050,a6),a6
dbra d7,L0006ca
movea.l ($0088),a0
move.l (-$0008,a0),d0
cmp.l #$50434d34,d0 ;'PCM4'
beq L0006f0
cmp.l #$50434d38,d0 ;'PCM8'
bne L00070c
L0006f0:
move.w #$01fc,d0
moveq.l #$ff,d1
trap #2
cmp.b #$01,d0
bne L000706
move.w #$0101,d0
trap #2
rts
L000706:
moveq.l #$67,d0 ;'g'
moveq.l #$01,d1
trap #15
L00070c:
moveq.l #$67,d0 ;'g'
moveq.l #$00,d1
trap #15
rts
L_CONT:
clr.b (-$03fa,a5)
moveq.l #$07,d7
lea.l (L001f3c,pc),a6
L00071e:
bsr SetOPMVolume
lea.l ($0050,a6),a6
dbra d7,L00071e
movea.l ($0088),a0
move.l (-$0008,a0),d0
cmp.l #$50434d34,d0 ;'PCM4'
beq L000742
cmp.l #$50434d38,d0 ;'PCM8'
bne EnableTimerIRQ
L000742:
move.w #$01fc,d0
moveq.l #$ff,d1
trap #2
cmp.b #$01,d0
bne EnableTimerIRQ
move.w #$0102,d0
trap #2
EnableTimerIRQ:
moveq.l #$30,d2 ;'0'
move.b (disable_timer_writes,pc),d1
bne L000760
moveq.l #$3a,d2 ;':'
L000760:
moveq.l #$14,d1
bra WriteOPM
L000766:
movea.l (L001e28,pc),a0
movea.l (L001e24,pc),a1
subq.w #6,a0
cmpa.l a1,a0
bcc L000788
movea.l (L001e2c,pc),a0
bra L000788
L00077a:
movea.l (L001e28,pc),a0
addq.w #6,a0
tst.w (a0)
bne L000788
movea.l (L001e24,pc),a0
L000788:
move.l a0,(-$03e4,a5)
move.w (a0),(-$03ea,a5)
movea.l ($0002,a0),a1
move.l (a1),($0010,a5)
addq.w #4,a1
move.w (a1),d0
not.w d0
move.w ($0002,a1),d1
not.w d1
move.b d0,($0024,a5)
move.b d1,($0025,a5)
move.l a1,($000c,a5)
clr.w (-$03f0,a5)
bra StartPlay
L_PLAY:
clr.w (-$03f0,a5)
bra StartPlay
L_PlayWithMask:
move.w d1,(-$03f0,a5)
StartPlay:
clr.b (-$03f8,a5)
clr.b (-$03f7,a5)
clr.b (-$03f5,a5)
clr.b (-$03f9,a5)
tst.b (-$03fa,a5)
beq L0007f4
movea.l ($0088),a0
move.l (-$0008,a0),d0
cmp.l #$50434d34,d0 ;'PCM4'
beq L0007ee
cmp.l #$50434d38,d0 ;'PCM8'
bne L0007f4
L0007ee:
move.w #$0100,d0
trap #2
L0007f4:
clr.b (-$03fa,a5)
clr.b (-$0418,a5)
move.w #$01ff,(-$03f2,a5)
move.w #$01ff,(-$0406,a5)
clr.w ($003a,a5)
clr.w (-$0666,a5)
move.b ($0024,a5),d0
beq MXDRVError
bsr StopPlayback
movea.l ($000c,a5),a2
move.w ($0002,a2),d1
bmi L000848
tst.b ($0025,a5)
beq MXDRVError
movea.l ($0010,a5),a0
bra L00083c
L000834:
tst.l (a0)
beq MXDRVError
adda.l (a0),a0
L00083c:
dbra d1,L000834
adda.w ($0004,a0),a0
move.l a0,($0020,a5)
L000848:
adda.w ($0004,a2),a2
movea.l a2,a1
movea.l a2,a0
moveq.l #$00,d0
move.w (a1)+,d0
adda.l d0,a2
move.l a2,($001c,a5)
lea.l (L001f3c,pc),a6
lea.l (L00095a,pc),a3
moveq.l #$ff,d6
moveq.l #$00,d7
L000866:
movea.l a0,a2
move.w (a1)+,d0
adda.l d0,a2
move.l a2,(a6)
move.l a3,($0026,a6)
move.l a3,($0040,a6)
move.w d6,($0014,a6)
move.b d6,($0023,a6)
move.b d7,($0018,a6)
move.b #$00,($001d,a6)
move.b #$01,($001a,a6)
move.b #$08,($0022,a6)
move.b #$c0,($001c,a6)
move.b #$08,($001e,a6)
clr.w ($0036,a6)
clr.w ($004a,a6)
clr.w ($0010,a6)
clr.b ($0024,a6)
clr.b ($001f,a6)
clr.b ($0019,a6)
clr.w ($0016,a6)
cmp.w #$0008,d7
bcc L0008d4
moveq.l #$38,d1 ;'8'
add.b d7,d1
moveq.l #$00,d2
bsr WriteOPM
addq.w #1,d7
lea.l ($0050,a6),a6
bra L000866
L0008d4:
move.b #$10,($001c,a6)
move.b #$08,($0022,a6)
move.b d7,($0018,a6)
andi.b #$07,($0018,a6)
ori.b #$80,($0018,a6)
clr.b ($0004,a6)
cmp.w #$000f,d7
beq L000910
addq.w #1,d7
lea.l ($0050,a6),a6
cmp.w #$0009,d7
bne L000866
lea.l (L001bc4,pc),a6
bra L000866
L000910:
lea.l (-$0416,a5),a0
moveq.l #$0f,d0
L000916:
clr.b (a0)+
dbra d0,L000916
clr.b ($0026,a5)