1 ;Run me to assemble with PhxAss
(sets TEST
, too
)
3 PhxAss SYMDEBUG LINEDEBUG OPT NRQBPSMD SET
"TEST=1" PT-AHIPlay.s
7 ;TEST
=1 ; Set to
1 to enable small test code
8 ; The test code in
not reentrant
!
9 ; Change MixFreq AudioID module name around line
140.
12 **************************************************
13 * ----- Protracker V2.3
A Playroutine
----- *
14 **************************************************
16 * Adapted for
'ahi.device' by Martin Blom.
17 * FilterOnOff
and Funk commands are
not supported.
18 * FilterOnOff cannot
be be supported.
19 * Funk can
be supported by using AHI_DYNAMICSAMPLE
, but shouldn
't.
20 * The player part is fully reentrant.
22 * The audio mode you allocate MUST have these tags:
23 * AHIA_Channels AT LEAST 4 (No. 0-3 are used by the replayer)
24 * AHIA_Sounds,1 AT LEAST 1 (No. 0 is used by the replayer)
25 * AHIA_MinPlayerFreq Should be (32*2/5)<<16
26 * AHIA_MaxPlayerFreq Should be (255*2/5)<<16
29 * Available functions:
31 *********************************************************************
32 * success = mt_init( ptdata );
35 * Call to initialize module. d0= FALSE if error.
36 *********************************************************************
37 * success = mt_start( ptdata );
40 * Call to start module. d0= FALSE if error.
41 *********************************************************************
45 * Call to stop module.
46 *********************************************************************
50 * Call to deallocate resources taken by mt_init.
51 *********************************************************************
54 * Your PlayerFunc() should call this function.
55 *********************************************************************
91 include lvo/exec_lib.i
93 include utility/hooks.i
97 move.l #mt_data,ptd_ModuleAddress(a2) ;Initialize
100 move.l d0,ptd_AHIBase(a2) ;Initialize
104 jsr _LVOAHI_AllocAudioA(a6)
105 move.l d0,ptd_AudioCtrl(a2) ;Initialize
120 JSR _LVOOpenLibrary(A6)
133 JSR _LVOCloseLibrary(A6)
140 move.l ptd_AHIBase(a2),d0
143 move.l ptd_AudioCtrl(a2),a2
144 jsr _LVOAHI_FreeAudio(a6)
149 DOSname dc.b "dos.library",0
151 ptdata blk.b PTData_SIZEOF,0
154 dc.l AHIA_MixFreq,22050
157 dc.l AHIA_AudioID,$00020002 ; Just an example! No hardcoded values permitted!
158 dc.l AHIA_PlayerFunc,PlayerFunc
159 dc.l AHIA_PlayerFreq,50<<16
160 dc.l AHIA_MinPlayerFreq,(32*2/5)<<16
161 dc.l AHIA_MaxPlayerFreq,(255*2/5)<<16
177 incbin "st-00:Modules/mod/mod.avoidtune"
186 ;---- Playroutine ----
188 section ptplayer,code
191 * a2 Filled PTData structure
196 movem.l d1-d7/a0-a6,-(sp)
197 move.l ptd_ModuleAddress(a2),a0
215 add.l ptd_ModuleAddress(a2),d3 ;d3 is now start of samples
217 lea ptd_SampleStarts(a2),a1
229 ;d2 is now total sample length
230 ;Build AHISampleInfo strcuture on stack and declare it:
233 move.l #AHIST_M8S,-(sp)
235 move.l ptd_AHIBase(a2),a6
237 move.l ptd_AudioCtrl(a2),a2
239 moveq #AHIST_SAMPLE,d1
241 jsr _LVOAHI_LoadSound(a6)
247 move.w #$0001,n_dmabit+ptd_chan1temp(a2)
248 move.w #$0002,n_dmabit+ptd_chan2temp(a2)
249 move.w #$0004,n_dmabit+ptd_chan3temp(a2)
250 move.w #$0008,n_dmabit+ptd_chan4temp(a2)
254 movem.l (sp)+,d1-d7/a0-a6
262 * a2 Filled PTData structure
267 movem.l d1-d7/a0-a6,-(sp)
269 move.b #6,ptd_speed(a2)
270 clr.b ptd_counter(a2)
271 clr.b ptd_SongPos(a2)
272 clr.b ptd_PBreakPos(a2)
273 clr.b ptd_PosJumpFlag(a2)
274 clr.b ptd_PBreakFlag(a2)
275 clr.b ptd_LowMask(a2)
276 clr.b ptd_PattDelTime(a2)
277 clr.b ptd_PattDelTime2(a2)
279 clr.w ptd_PatternPos(a2)
280 clr.w ptd_DMACONtemp(a2)
282 move.l #TAG_DONE,-(sp)
284 move.l #AHIA_PlayerFreq,-(sp)
286 move.l #AHIC_Play,-(sp)
288 move.l ptd_AHIBase(a2),a6
289 move.l ptd_AudioCtrl(a2),a2
291 jsr _LVOAHI_ControlAudioA(a6)
297 movem.l (sp)+,d1-d7/a0-a6
304 * a2 Filled PTData structure
307 movem.l d0-d7/a0-a6,-(sp)
310 move.l #TAG_DONE,-(sp)
312 move.l #AHIC_Play,-(sp)
314 move.l ptd_AHIBase(a2),a6
315 move.l ptd_AudioCtrl(a2),a2
317 jsr _LVOAHI_ControlAudioA(a6)
319 movem.l (sp)+,d0-d7/a0-a6
323 * a2 Filled PTData structure
326 movem.l d0-d7/a0-a6,-(sp)
328 move.l ptd_AHIBase(a2),a6
329 move.l ptd_AudioCtrl(a2),a2
334 moveq #AHI_NOSOUND,d1
335 jsr _LVOAHI_SetSound(a6)
337 moveq #AHI_NOSOUND,d1
338 jsr _LVOAHI_SetSound(a6)
340 moveq #AHI_NOSOUND,d1
341 jsr _LVOAHI_SetSound(a6)
343 moveq #AHI_NOSOUND,d1
344 jsr _LVOAHI_SetSound(a6)
346 jsr _LVOAHI_UnloadSound(a6)
348 movem.l (sp)+,d0-d7/a0-a6
358 addq.w #1,ptd_NewTempo(a2)
359 move.w d0,ptd_Tempo(a2)
363 * a2 Filled PTData structure
366 movem.l d0-d7/a0-a6,-(sp)
371 move.l ptd_AHIBase(a3),a6
372 move.l ptd_AudioCtrl(a3),a2
376 tst.w pe_NewSample(a4)
378 clr.w pe_NewSample(a4)
381 move.l pe_Offset(a4),d2
383 move.w pe_Length(a4),d3
387 moveq #AHI_NOSOUND,d1
390 jsr _LVOAHI_SetSound(a6)
392 tst.w pe_NewLoopSample(a4)
394 clr.w pe_NewLoopSample(a4)
397 move.l pe_LoopOffset(a4),d2
399 move.w pe_LoopLength(a4),d3
403 moveq #AHI_NOSOUND,d1
406 jsr _LVOAHI_SetSound(a6)
408 tst.w pe_NewPeriod(a4)
410 clr.w pe_NewPeriod(a4)
412 move.w pe_Period(a4),d2
418 jsr _LVOAHI_SetFreq(a6)
420 tst.w pe_NewVolume(a4)
422 clr.w pe_NewVolume(a4)
424 move.w pe_Volume(a4),d1
430 move.l .pantable(pc,d2.l),d2
432 jsr _LVOAHI_SetVol(a6)
434 add.w #PaulaEmul_SIZEOF,a4
439 tst.w ptd_NewTempo(a3)
441 clr.w ptd_NewTempo(a3)
442 move.w ptd_Tempo(a3),d0
448 move.l #TAG_DONE,-(sp)
450 move.l #AHIA_PlayerFreq,-(sp)
452 jsr _LVOAHI_ControlAudioA(a6)
456 movem.l (sp)+,d0-d7/a0-a6
459 dc.l $00000,$10000,$00000,$10000
462 MOVEM.L D0-D4/A0-A6,-(SP)
465 ADDQ.B #1,ptd_counter(a2)
466 MOVE.B ptd_counter(a2),D0
467 CMP.B ptd_speed(a2),D0
469 CLR.B ptd_counter(a2)
470 TST.B ptd_PattDelTime2(a2)
472 BSR.S mt_NoNewAllChannels
476 BSR.S mt_NoNewAllChannels
481 LEA ptd_chan1temp(a2),A6
484 LEA ptd_chan2temp(a2),A6
487 LEA ptd_chan3temp(a2),A6
490 LEA ptd_chan4temp(a2),A6
494 MOVE.L ptd_ModuleAddress(a2),A0
496 LEA 952(A0),A1 ;pattpo
497 LEA 1084(A0),A0 ;patterndata
500 MOVE.B ptd_SongPos(a2),D0
504 ADD.W ptd_PatternPos(a2),D1
505 CLR.W ptd_DMACONtemp(a2)
508 LEA ptd_chan1temp(a2),A6
511 LEA ptd_chan2temp(a2),A6
514 LEA ptd_chan3temp(a2),A6
517 LEA ptd_chan4temp(a2),A6
526 MOVE.L (A0,D1.L),(A6)
539 LEA ptd_SampleStarts(a2),A1
544 MOVE.L (A1,D2.L),n_start(A6)
545 MOVE.W (A3,D4.L),n_length(A6)
546 MOVE.W (A3,D4.L),n_reallength(A6)
547 MOVE.B 2(A3,D4.L),n_finetune(A6)
548 MOVE.B 3(A3,D4.L),n_volume(A6)
549 MOVE.W 4(A3,D4.L),D3 ; Get repeat
552 MOVE.L n_start(A6),D2 ; Get start
554 ADD.L D3,D2 ; Add repeat
555 MOVE.L D2,n_loopstart(A6)
556 MOVE.L D2,n_wavestart(A6)
557 MOVE.W 4(A3,D4.L),D0 ; Get repeat
558 ADD.W 6(A3,D4.L),D0 ; Add replen
559 MOVE.W D0,n_length(A6)
560 MOVE.W 6(A3,D4.L),n_replen(A6) ; Save replen
562 MOVE.B n_volume(A6),D0
563 move.w d0,pe_Volume(a5)
564 addq.w #1,pe_NewVolume(a5)
565 ; MOVE.W D0,8(A5) ; Set volume
569 MOVE.L n_start(A6),D2
571 MOVE.L D2,n_loopstart(A6)
572 MOVE.L D2,n_wavestart(A6)
573 MOVE.W 6(A3,D4.L),n_replen(A6) ; Save replen
575 MOVE.B n_volume(A6),D0
576 move.w d0,pe_Volume(a5)
577 addq.w #1,pe_NewVolume(a5)
578 ; MOVE.W D0,8(A5) ; Set volume
582 BEQ mt_CheckMoreEfx ; If no note
586 BEQ.S mt_DoSetFineTune
589 CMP.B #3,D0 ; TonePortamento
590 BEQ.S mt_ChkTonePorta
592 BEQ.S mt_ChkTonePorta
593 CMP.B #9,D0 ; Sample Offset
607 MOVEM.L D0-D1/A0-A1,-(SP)
610 LEA mt_PeriodTable(PC),A1
620 MOVE.B n_finetune(A6),D1
623 MOVE.W (A1,D0.W),n_period(A6)
624 MOVEM.L (SP)+,D0-D1/A0-A1
628 CMP.W #$0ED0,D0 ; Notedelay
631 ; MOVE.W n_dmabit(A6),$DFF096
632 BTST #2,n_wavecontrol(A6)
634 CLR.B n_vibratopos(A6)
636 BTST #6,n_wavecontrol(A6)
638 CLR.B n_tremolopos(A6)
640 move.l n_start(A6),pe_Offset(a5)
641 move.w n_length(A6),pe_Length(a5)
642 addq.w #1,pe_NewSample(a5)
643 move.w n_period(A6),pe_Period(a5)
644 addq.w #1,pe_NewPeriod(a5)
646 ; MOVE.L n_start(A6),(A5) ; Set start
647 ; MOVE.W n_length(A6),4(A5) ; Set length
649 ; MOVE.W n_period(A6),D0
650 ; MOVE.W D0,6(A5) ; Set period
651 ; MOVE.W n_dmabit(A6),D0
652 ; OR.W D0,ptd_DMACONtemp(a2)
659 ; MOVE.W mt_DMACONtemp(PC),D0
664 ; DBRA D0,mt_WaitDMA2
667 ; LEA mt_chan4temp(PC),A6
668 ; MOVE.L n_loopstart(A6),$D0(A5)
669 ; MOVE.W n_replen(A6),$D4(A5)
670 ; LEA mt_chan3temp(PC),A6
671 ; MOVE.L n_loopstart(A6),$C0(A5)
672 ; MOVE.W n_replen(A6),$C4(A5)
673 ; LEA mt_chan2temp(PC),A6
674 ; MOVE.L n_loopstart(A6),$B0(A5)
675 ; MOVE.W n_replen(A6),$B4(A5)
676 ; LEA mt_chan1temp(PC),A6
677 ; MOVE.L n_loopstart(A6),$A0(A5)
678 ; MOVE.W n_replen(A6),$A4(A5)
680 move.l n_loopstart+ptd_chan1temp(A2),pe_LoopOffset+ptd_Ch1(a2)
681 move.w n_replen+ptd_chan1temp(A2),pe_LoopLength+ptd_Ch1(a2)
682 addq.w #1,pe_NewLoopSample+ptd_Ch1(a2)
684 move.l n_loopstart+ptd_chan2temp(A2),pe_LoopOffset+ptd_Ch2(a2)
685 move.w n_replen+ptd_chan2temp(A2),pe_LoopLength+ptd_Ch2(a2)
686 addq.w #1,pe_NewLoopSample+ptd_Ch2(a2)
688 move.l n_loopstart+ptd_chan3temp(A2),pe_LoopOffset+ptd_Ch3(a2)
689 move.w n_replen+ptd_chan3temp(A2),pe_LoopLength+ptd_Ch3(a2)
690 addq.w #1,pe_NewLoopSample+ptd_Ch3(a2)
692 move.l n_loopstart+ptd_chan4temp(A2),pe_LoopOffset+ptd_Ch4(a2)
693 move.w n_replen+ptd_chan4temp(A2),pe_LoopLength+ptd_Ch4(a2)
694 addq.w #1,pe_NewLoopSample+ptd_Ch4(a2)
698 ADD.W #16,ptd_PatternPos(a2)
699 MOVE.B ptd_PattDelTime(a2),D0
701 MOVE.B D0,ptd_PattDelTime2(a2)
702 CLR.B ptd_PattDelTime(a2)
703 mt_dskc TST.B ptd_PattDelTime2(a2)
705 SUBQ.B #1,ptd_PattDelTime2(a2)
707 SUB.W #16,ptd_PatternPos(a2)
708 mt_dska TST.B ptd_PBreakFlag(a2)
710 SF ptd_PBreakFlag(a2)
712 MOVE.B ptd_PBreakPos(a2),D0
713 CLR.B ptd_PBreakPos(a2)
715 MOVE.W D0,ptd_PatternPos(a2)
717 CMP.W #1024,ptd_PatternPos(a2)
721 MOVE.B ptd_PBreakPos(a2),D0
723 MOVE.W D0,ptd_PatternPos(a2)
724 CLR.B ptd_PBreakPos(a2)
725 CLR.B ptd_PosJumpFlag(a2)
726 ADDQ.B #1,ptd_SongPos(a2)
727 AND.B #$7F,ptd_SongPos(a2)
728 MOVE.B ptd_SongPos(a2),D1
729 MOVE.L ptd_ModuleAddress(a2),A0
732 CLR.B ptd_SongPos(a2)
734 TST.B ptd_PosJumpFlag(a2)
735 BNE.S mt_NextPosition
736 mt_exit MOVEM.L (SP)+,D0-D4/A0-A6
752 BEQ mt_TonePortamento
756 BEQ mt_TonePlusVolSlide
758 BEQ mt_VibratoPlusVolSlide
762 ; MOVE.W n_period(A6),6(A5)
763 move.w n_period(a6),pe_Period(a5)
764 addq.w #1,pe_NewPeriod(a5)
773 ; MOVE.W n_period(A6),6(A5)
774 move.w n_period(a6),pe_Period(a5)
775 addq.w #1,pe_NewPeriod(a5)
780 MOVE.B ptd_counter(a2),D0
788 MOVE.B n_cmdlo(A6),D0
794 MOVE.B n_cmdlo(A6),D0
799 MOVE.W n_period(A6),D2
805 MOVE.B n_finetune(A6),D1
807 LEA mt_PeriodTable(PC),A0
810 MOVE.W n_period(A6),D1
822 move.w d2,pe_Period(a5)
823 addq.w #1,pe_NewPeriod(a5)
827 TST.B ptd_counter(a2)
829 MOVE.B #$0F,ptd_LowMask(a2)
832 MOVE.B n_cmdlo(A6),D0
833 AND.B ptd_LowMask(a2),D0
834 MOVE.B #$FF,ptd_LowMask(a2)
835 SUB.W D0,n_period(A6)
836 MOVE.W n_period(A6),D0
840 AND.W #$F000,n_period(A6)
841 OR.W #113,n_period(A6)
843 MOVE.W n_period(A6),D0
846 move.w d0,pe_Period(a5)
847 addq.w #1,pe_NewPeriod(a5)
851 TST.B ptd_counter(a2)
853 MOVE.B #$0F,ptd_LowMask(a2)
856 MOVE.B n_cmdlo(A6),D0
857 AND.B ptd_LowMask(a2),D0
858 MOVE.B #$FF,ptd_LowMask(a2)
859 ADD.W D0,n_period(A6)
860 MOVE.W n_period(A6),D0
864 AND.W #$F000,n_period(A6)
865 OR.W #856,n_period(A6)
867 MOVE.W n_period(A6),D0
869 move.w d0,pe_Period(a5)
870 addq.w #1,pe_NewPeriod(a5)
879 MOVE.B n_finetune(A6),D0
881 LEA mt_PeriodTable(PC),A0
892 MOVE.B n_finetune(A6),D2
901 MOVE.W D2,n_wantedperiod(A6)
902 MOVE.W n_period(A6),D0
903 CLR.B n_toneportdirec(A6)
905 BEQ.S mt_ClearTonePorta
907 MOVE.B #1,n_toneportdirec(A6)
911 CLR.W n_wantedperiod(A6)
915 MOVE.B n_cmdlo(A6),D0
916 BEQ.S mt_TonePortNoChange
917 MOVE.B D0,n_toneportspeed(A6)
920 TST.W n_wantedperiod(A6)
923 MOVE.B n_toneportspeed(A6),D0
924 TST.B n_toneportdirec(A6)
927 ADD.W D0,n_period(A6)
928 MOVE.W n_wantedperiod(A6),D0
929 CMP.W n_period(A6),D0
930 BGT.S mt_TonePortaSetPer
931 MOVE.W n_wantedperiod(A6),n_period(A6)
932 CLR.W n_wantedperiod(A6)
933 BRA.S mt_TonePortaSetPer
936 SUB.W D0,n_period(A6)
937 MOVE.W n_wantedperiod(A6),D0
938 CMP.W n_period(A6),D0
939 BLT.S mt_TonePortaSetPer
940 MOVE.W n_wantedperiod(A6),n_period(A6)
941 CLR.W n_wantedperiod(A6)
944 MOVE.W n_period(A6),D2
945 MOVE.B n_glissfunk(A6),D0
949 MOVE.B n_finetune(A6),D0
951 LEA mt_PeriodTable(PC),A0
964 ; MOVE.W D2,6(A5) ; Set period
965 move.w d2,pe_Period(a5)
966 addq.w #1,pe_NewPeriod(a5)
970 MOVE.B n_cmdlo(A6),D0
972 MOVE.B n_vibratocmd(A6),D2
978 MOVE.B n_cmdlo(A6),D0
984 MOVE.B D2,n_vibratocmd(A6)
986 MOVE.B n_vibratopos(A6),D0
987 LEA mt_VibratoTable(PC),A4
991 MOVE.B n_wavecontrol(A6),D2
996 BEQ.S mt_vib_rampdown
1000 TST.B n_vibratopos(A6)
1001 BPL.S mt_vib_rampdown2
1011 MOVE.B n_vibratocmd(A6),D0
1015 MOVE.W n_period(A6),D0
1016 TST.B n_vibratopos(A6)
1024 move.w d0,pe_Period(a5)
1025 addq.w #1,pe_NewPeriod(a5)
1026 MOVE.B n_vibratocmd(A6),D0
1029 ADD.B D0,n_vibratopos(A6)
1033 BSR mt_TonePortNoChange
1036 mt_VibratoPlusVolSlide
1041 MOVE.B n_cmdlo(A6),D0
1043 MOVE.B n_tremolocmd(A6),D2
1049 MOVE.B n_cmdlo(A6),D0
1055 MOVE.B D2,n_tremolocmd(A6)
1057 MOVE.B n_tremolopos(A6),D0
1058 LEA mt_VibratoTable(PC),A4
1062 MOVE.B n_wavecontrol(A6),D2
1068 BEQ.S mt_tre_rampdown
1072 TST.B n_vibratopos(A6)
1073 BPL.S mt_tre_rampdown2
1083 MOVE.B n_tremolocmd(A6),D0
1088 MOVE.B n_volume(A6),D0
1089 TST.B n_tremolopos(A6)
1096 BPL.S mt_TremoloSkip
1104 move.w d0,pe_Volume(a5)
1105 addq.w #1,pe_NewVolume(a5)
1106 MOVE.B n_tremolocmd(A6),D0
1109 ADD.B D0,n_tremolopos(A6)
1114 MOVE.B n_cmdlo(A6),D0
1116 MOVE.B D0,n_sampleoffset(A6)
1118 MOVE.B n_sampleoffset(A6),D0
1120 CMP.W n_length(A6),D0
1122 SUB.W D0,n_length(A6)
1124 ADD.L D0,n_start(A6)
1127 MOVE.W #$0001,n_length(A6)
1132 MOVE.B n_cmdlo(A6),D0
1135 BEQ.S mt_VolSlideDown
1137 ADD.B D0,n_volume(A6)
1138 CMP.B #$40,n_volume(A6)
1140 MOVE.B #$40,n_volume(A6)
1142 MOVE.B n_volume(A6),D0
1144 move.w d0,pe_Volume(a5)
1145 addq.w #1,pe_NewVolume(a5)
1150 MOVE.B n_cmdlo(A6),D0
1153 SUB.B D0,n_volume(A6)
1157 MOVE.B n_volume(A6),D0
1159 move.w d0,pe_Volume(a5)
1160 addq.w #1,pe_NewVolume(a5)
1164 MOVE.B n_cmdlo(A6),D0
1166 MOVE.B D0,ptd_SongPos(a2)
1167 mt_pj2 CLR.B ptd_PBreakPos(a2)
1168 ST ptd_PosJumpFlag(a2)
1173 MOVE.B n_cmdlo(A6),D0
1178 MOVE.B D0,n_volume(A6)
1180 move.w d0,pe_Volume(a5)
1181 addq.w #1,pe_NewVolume(a5)
1186 MOVE.B n_cmdlo(A6),D0
1194 MOVE.B D0,ptd_PBreakPos(a2)
1195 ST ptd_PosJumpFlag(a2)
1204 CLR.B ptd_counter(a2)
1205 MOVE.B D0,ptd_speed(a2)
1217 BEQ.S mt_PatternBreak
1227 MOVE.B n_cmdlo(A6),D0
1230 BEQ.S mt_FilterOnOff
1234 BEQ mt_FinePortaDown
1236 BEQ.S mt_SetGlissControl
1238 BEQ mt_SetVibratoControl
1244 BEQ mt_SetTremoloControl
1250 BEQ mt_VolumeFineDown
1262 ; MOVE.B n_cmdlo(A6),D0
1265 ; AND.B #$FD,$BFE001
1270 MOVE.B n_cmdlo(A6),D0
1272 AND.B #$F0,n_glissfunk(A6)
1273 OR.B D0,n_glissfunk(A6)
1276 mt_SetVibratoControl
1277 MOVE.B n_cmdlo(A6),D0
1279 AND.B #$F0,n_wavecontrol(A6)
1280 OR.B D0,n_wavecontrol(A6)
1284 MOVE.B n_cmdlo(A6),D0
1286 MOVE.B D0,n_finetune(A6)
1290 TST.B ptd_counter(a2)
1292 MOVE.B n_cmdlo(A6),D0
1295 TST.B n_loopcount(A6)
1297 SUBQ.B #1,n_loopcount(A6)
1300 MOVE.B n_pattpos(A6),ptd_PBreakPos(a2)
1301 ST ptd_PBreakFlag(a2)
1305 MOVE.B D0,n_loopcount(A6)
1309 MOVE.W ptd_PatternPos(a2),D0
1311 MOVE.B D0,n_pattpos(A6)
1314 mt_SetTremoloControl
1315 MOVE.B n_cmdlo(A6),D0
1318 AND.B #$0F,n_wavecontrol(A6)
1319 OR.B D0,n_wavecontrol(A6)
1325 MOVE.B n_cmdlo(A6),D0
1329 MOVE.B ptd_counter(a2),D1
1335 MOVE.B ptd_counter(a2),D1
1342 ; MOVE.W n_dmabit(A6),$DFF096 ; Channel DMA off
1343 ; MOVE.L n_start(A6),(A5) ; Set sampledata pointer
1344 ; MOVE.W n_length(A6),4(A5) ; Set length
1345 move.l n_start(A6),pe_Offset(a5)
1346 move.w n_length(A6),pe_Length(a5)
1347 addq.w #1,pe_NewSample(a5)
1349 ; MOVE.W #DMAWait,D0
1351 ; DBRA D0,mt_rtnloop1
1352 ; MOVE.W n_dmabit(A6),D0
1355 ; MOVE.W #DMAWait,D0
1357 ; DBRA D0,mt_rtnloop2
1359 ; MOVE.L n_loopstart(A6),(A5)
1360 ; MOVE.L n_replen(A6),4(A5)
1361 move.l n_loopstart(A6),pe_LoopOffset(a5)
1362 move.w n_replen(A6),pe_LoopLength(a5)
1363 addq.w #1,pe_NewLoopSample(a5)
1369 TST.B ptd_counter(a2)
1372 MOVE.B n_cmdlo(A6),D0
1377 TST.B ptd_counter(a2)
1380 MOVE.B n_cmdlo(A6),D0
1382 BRA mt_VolSlideDown2
1386 MOVE.B n_cmdlo(A6),D0
1388 CMP.B ptd_counter(a2),D0
1393 addq.w #1,pe_NewVolume(a5)
1398 MOVE.B n_cmdlo(A6),D0
1400 CMP.B ptd_counter(a2),D0
1408 TST.B ptd_counter(a2)
1411 MOVE.B n_cmdlo(A6),D0
1413 TST.B ptd_PattDelTime2(a2)
1416 MOVE.B D0,ptd_PattDelTime(a2)
1422 ; MOVE.B n_cmdlo(A6),D0
1425 ; AND.B #$0F,n_glissfunk(A6)
1426 ; OR.B D0,n_glissfunk(A6)
1430 ; MOVEM.L A0/D1,-(SP)
1432 ; MOVE.B n_glissfunk(A6),D0
1435 ; LEA mt_FunkTable(PC),A0
1436 ; MOVE.B (A0,D0.W),D0
1437 ; ADD.B D0,n_funkoffset(A6)
1438 ; BTST #7,n_funkoffset(A6)
1440 ; CLR.B n_funkoffset(A6)
1442 ; MOVE.L n_loopstart(A6),D0
1444 ; MOVE.W n_replen(A6),D1
1447 ; MOVE.L n_wavestart(A6),A0
1451 ; MOVE.L n_loopstart(A6),A0
1453 ; MOVE.L A0,n_wavestart(A6)
1458 ; MOVEM.L (SP)+,A0/D1
1462 ;mt_FunkTable dc.b 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128
1465 dc.b 0, 24, 49, 74, 97,120,141,161
1466 dc.b 180,197,212,224,235,244,250,253
1467 dc.b 255,253,250,244,235,224,212,197
1468 dc.b 180,161,141,120, 97, 74, 49, 24
1472 dc.w 856,808,762,720,678,640,604,570,538,508,480,453
1473 dc.w 428,404,381,360,339,320,302,285,269,254,240,226
1474 dc.w 214,202,190,180,170,160,151,143,135,127,120,113
1476 dc.w 850,802,757,715,674,637,601,567,535,505,477,450
1477 dc.w 425,401,379,357,337,318,300,284,268,253,239,225
1478 dc.w 213,201,189,179,169,159,150,142,134,126,119,113
1480 dc.w 844,796,752,709,670,632,597,563,532,502,474,447
1481 dc.w 422,398,376,355,335,316,298,282,266,251,237,224
1482 dc.w 211,199,188,177,167,158,149,141,133,125,118,112
1484 dc.w 838,791,746,704,665,628,592,559,528,498,470,444
1485 dc.w 419,395,373,352,332,314,296,280,264,249,235,222
1486 dc.w 209,198,187,176,166,157,148,140,132,125,118,111
1488 dc.w 832,785,741,699,660,623,588,555,524,495,467,441
1489 dc.w 416,392,370,350,330,312,294,278,262,247,233,220
1490 dc.w 208,196,185,175,165,156,147,139,131,124,117,110
1492 dc.w 826,779,736,694,655,619,584,551,520,491,463,437
1493 dc.w 413,390,368,347,328,309,292,276,260,245,232,219
1494 dc.w 206,195,184,174,164,155,146,138,130,123,116,109
1496 dc.w 820,774,730,689,651,614,580,547,516,487,460,434
1497 dc.w 410,387,365,345,325,307,290,274,258,244,230,217
1498 dc.w 205,193,183,172,163,154,145,137,129,122,115,109
1500 dc.w 814,768,725,684,646,610,575,543,513,484,457,431
1501 dc.w 407,384,363,342,323,305,288,272,256,242,228,216
1502 dc.w 204,192,181,171,161,152,144,136,128,121,114,108
1504 dc.w 907,856,808,762,720,678,640,604,570,538,508,480
1505 dc.w 453,428,404,381,360,339,320,302,285,269,254,240
1506 dc.w 226,214,202,190,180,170,160,151,143,135,127,120
1508 dc.w 900,850,802,757,715,675,636,601,567,535,505,477
1509 dc.w 450,425,401,379,357,337,318,300,284,268,253,238
1510 dc.w 225,212,200,189,179,169,159,150,142,134,126,119
1512 dc.w 894,844,796,752,709,670,632,597,563,532,502,474
1513 dc.w 447,422,398,376,355,335,316,298,282,266,251,237
1514 dc.w 223,211,199,188,177,167,158,149,141,133,125,118
1516 dc.w 887,838,791,746,704,665,628,592,559,528,498,470
1517 dc.w 444,419,395,373,352,332,314,296,280,264,249,235
1518 dc.w 222,209,198,187,176,166,157,148,140,132,125,118
1520 dc.w 881,832,785,741,699,660,623,588,555,524,494,467
1521 dc.w 441,416,392,370,350,330,312,294,278,262,247,233
1522 dc.w 220,208,196,185,175,165,156,147,139,131,123,117
1524 dc.w 875,826,779,736,694,655,619,584,551,520,491,463
1525 dc.w 437,413,390,368,347,328,309,292,276,260,245,232
1526 dc.w 219,206,195,184,174,164,155,146,138,130,123,116
1528 dc.w 868,820,774,730,689,651,614,580,547,516,487,460
1529 dc.w 434,410,387,365,345,325,307,290,274,258,244,230
1530 dc.w 217,205,193,183,172,163,154,145,137,129,122,115
1532 dc.w 862,814,768,725,684,646,610,575,543,513,484,457
1533 dc.w 431,407,384,363,342,323,305,288,272,256,242,228
1534 dc.w 216,203,192,181,171,161,152,144,136,128,121,114