*** playroutine *** songlen: equ 0 smp1len: equ 0 smp2len: equ 0 smp3len: equ 0 smp4len: equ 0 smp5len: equ 0 smp6len: equ 0 smp7len: equ 0 smp8len: equ 0 smp9len: equ 0 smpAlen: equ 0 smpBlen: equ 0 smpClen: equ 0 smpDlen: equ 0 smpElen: equ 0 smpFlen: equ 0 tempo: equ 0 bsr.s mt_init mt_wait: btst #$a,$dff016 bne.s mt_wait1 not.b mt_onoff-v(a5) bne.s mt_wait1 move.w #$f,$dff096 mt_wait1: btst #$a,$dff016 beq.s mt_wait1 btst #6,$bfe001 bne.s mt_wait mt_end: move.b #$1,$bfdd00 move.w #$f,$dff096 move.w #$4000,$dff09a move.l mt_oldirq(pc),$78.w move.w #$c000,$dff09a moveq #0,d0 rts mt_init: lea v(pc),a5 lea smp1data-v(a5),a0 lea mt_samples-v(a5),a1 lea mt_smplentab-v(a5),a2 moveq #14,d0 mt_initloop: move.l a0,(a1)+ clr.l (a0) adda.w (a2)+,a0 dbf d0,mt_initloop move.w #$f,$dff096 clr.w $dff0a8 clr.w $dff0b8 clr.w $dff0c8 clr.w $dff0d8 clr.w mt_partnrplay-v(a5) clr.w mt_partnote-v(a5) move.b songdata+$1d6-v(a5),mt_maxpart+1-v(a5) tst.w mt_speed-v(a5) bne.s mt_init1 move.b songdata+$1d7-v(a5),mt_speed+1-v(a5) mt_init1: cmp.w #30,mt_speed-v(a5) bcs.s mt_init2 cmp.w #210,mt_speed-v(a5) bls.s mt_init_end mt_init2: move.w #122,mt_speed-v(a5) mt_init_end: st mt_onoff-v(a5) move.w #$4000,$dff09a move.l $78.w,mt_oldirq-v(a5) lea mt_newirq-v(a5),a0 move.l a0,$78.w move.w #$c000,$dff09a bsr mt_speedset1 move.b #$11,$bfde00 move.b #$81,$bfdd00 rts mt_newirq: movem.l d0-d7/a0-a6,-(a7) lea $dff000,a0 move.w $1c(a0),d0 btst #$e,d0 beq.s mt_newirq_end lea v(pc),a5 tst.w mt_onoff-v(a5) beq.s mt_newirq_end move.w $1e(a0),d0 btst #13,d0 beq.s mt_newirq_end move.b $bfdd00,d0 bclr #7,d0 move.l 4.w,a6 move.l 240(a6),a6 or.b d0,41(a6) btst #0,d0 beq.s mt_newirq_end bsr.s mt_music mt_newirq_end: movem.l (a7)+,d0-d7/a0-a6 dc.w $4ef9 mt_oldirq: dc.l 0 mt_music: addq.w #1,mt_counter-v(a5) cmp.w #6,mt_counter-v(a5) bne.s mt_notsix clr.w mt_counter-v(a5) bra mt_rout2 mt_notsix: lea mt_aud1temp-v(a5),a6 tst.b 3(a6) beq.s mt_arp1 lea $dff0a0,a4 bsr.s mt_arprout mt_arp1: lea mt_aud2temp-v(a5),a6 tst.b 3(a6) beq.s mt_arp2 lea $dff0b0,a4 bsr.s mt_arprout mt_arp2: lea mt_aud3temp-v(a5),a6 tst.b 3(a6) beq.s mt_arp3 lea $dff0c0,a4 bsr.s mt_arprout mt_arp3: lea mt_aud4temp-v(a5),a6 tst.b 3(a6) beq mt_stop lea $dff0d0,a4 mt_arprout: tst.w 24(a6) beq.s mt_noslide clr.w d0 move.b 25(a6),d0 lsr.b #4,d0 tst.b d0 beq.s mt_voldwn2 bsr mt_pushvol1 bra.s mt_noslide mt_voldwn2: clr.w d0 move.b 25(a6),d0 bsr mt_pushvol2 mt_noslide: move.b 2(a6),d0 and.b #$f,d0 tst.b d0 beq mt_arpegrt cmp.b #1,d0 beq.s mt_portup cmp.b #2,d0 beq.s mt_portdwn cmp.b #5,d0 bls mt_arpegrt cmp.b #8,d0 bls.s mt_portup cmp.b #11,d0 bls.s mt_portdwn cmp.b #13,d0 beq.s mt_volup rts mt_portup: clr.w d0 move.b 3(a6),d0 sub.w d0,22(a6) cmp.w #$71,22(a6) bcc.s mt_ok1 move.w #$71,22(a6) mt_ok1: move.w 22(a6),6(a4) rts mt_portdwn: clr.w d0 move.b 3(a6),d0 add.w d0,22(a6) cmp.w #$358,22(a6) bls.s mt_ok2 move.w #$358,22(a6) mt_ok2: move.w 22(a6),6(a4) rts mt_volup: clr.w d0 move.b 3(a6),d0 lsr.b #4,d0 tst.b d0 beq.s mt_voldwn mt_pushvol1: add.w d0,$12(a6) cmp.w #$40,$12(a6) bls.s mt_ok3 move.w #$40,$12(a6) mt_ok3: move.w $12(a6),8(a4) rts mt_voldwn: clr.w d0 move.b 3(a6),d0 mt_pushvol2: and.b #$f,d0 sub.w d0,$12(a6) bcc.s mt_ok4 clr.w $12(a6) mt_ok4: move.w $12(a6),8(a4) rts mt_arpegrt: cmp.w #1,mt_counter-v(a5) beq.s mt_loop2 cmp.w #2,mt_counter-v(a5) beq.s mt_loop3 cmp.w #3,mt_counter-v(a5) beq.s mt_loop4 cmp.w #4,mt_counter-v(a5) beq.s mt_loop2 cmp.w #5,mt_counter-v(a5) beq.s mt_loop3 rts mt_loop2: moveq #0,d0 move.b 3(a6),d0 lsr.b #4,d0 bra.s mt_cont mt_loop3: moveq #0,d0 move.b 3(a6),d0 and.b #$f,d0 bra.s mt_cont mt_loop4: move.w 16(a6),d2 bra.s mt_endpart mt_cont: lsl.w #1,d0 moveq #0,d1 move.w 16(a6),d1 lea mt_arpeggio-v(a5),a0 mt_loop5: move.w (a0,d0.w),d2 cmp.w (a0),d1 beq.s mt_endpart addq.l #2,a0 bra.s mt_loop5 mt_endpart: move.w d2,6(a4) rts mt_rout2: lea songdata-v(a5),a0 lea 12(a0),a3 lea $1d8(a0),a2 add.w #$258,a0 move.w mt_partnrplay-v(a5),d0 move.b (a2,d0.w),d1 lsl.w #8,d1 lsl.w #2,d1 add.w mt_partnote-v(a5),d1 clr.w mt_dmacon-v(a5) lea $dff0a0,a4 lea mt_aud1temp-v(a5),a6 bsr mt_playit lea $dff0b0,a4 lea mt_aud2temp-v(a5),a6 bsr mt_playit lea $dff0c0,a4 lea mt_aud3temp-v(a5),a6 bsr mt_playit lea $dff0d0,a4 lea mt_aud4temp-v(a5),a6 bsr mt_playit move.w #$1f4,d0 mt_rls: dbf d0,mt_rls move.w #$8000,d0 add.w mt_dmacon-v(a5),d0 move.w d0,$dff096 lea mt_aud4temp-v(a5),a6 cmp.w #1,14(a6) bne.s mt_voice3 move.l 10(a6),$dff0d0 move.w 14(a6),$dff0d4 mt_voice3: lea mt_aud3temp-v(a5),a6 cmp.w #1,14(a6) bne.s mt_voice2 move.l 10(a6),$dff0c0 move.w 14(a6),$dff0c4 mt_voice2: lea mt_aud2temp-v(a5),a6 cmp.w #1,14(a6) bne.s mt_voice1 move.l 10(a6),$dff0b0 move.w 14(a6),$dff0b4 mt_voice1: lea mt_aud1temp-v(a5),a6 cmp.w #1,14(a6) bne.s mt_voice0 move.l 10(a6),$dff0a0 move.w 14(a6),$dff0a4 mt_voice0: add.w #$10,mt_partnote-v(a5) cmp.w #$400,mt_partnote-v(a5) bne.s mt_stop clr.w mt_partnote-v(a5) addq.w #1,mt_partnrplay-v(a5) and.w #$7f,mt_partnrplay-v(a5) move.w mt_maxpart-v(a5),d0 sub.w mt_partnrplay-v(a5),d0 bne.s mt_stop clr.w mt_partnrplay-v(a5) mt_stop: rts mt_playit: move.l (a0,d1.w),(a6) addq.w #4,d1 moveq #0,d2 move.b 2(a6),d2 and.b #$f0,d2 lsr.b #4,d2 tst.b d2 beq.s mt_nosamplechange moveq #0,d3 lea mt_samples-4(pc),a1 move.l d2,d4 lsl.l #2,d2 mulu #$1e,d4 move.l (a1,d2),4(a6) move.w (a3,d4),8(a6) move.w 2(a3,d4),18(a6) move.w 18(a6),8(a4) move.w 4(a3,d4),d3 add.l 4(a6),d3 move.l d3,10(a6) move.w 6(a3,d4),14(a6) cmp.w #1,14(a6) beq.s mt_nosamplechange move.l 10(a6),4(a6) move.w 14(a6),8(a6) mt_nosamplechange: tst.w (a6) beq.s mt_retrout move.w (a6),16(a6) move.w 20(a6),$dff096 move.l 4(a6),(a4) move.w 8(a6),4(a4) move.w (a6),6(a4) move.w 20(a6),d0 or.w d0,mt_dmacon-v(a5) mt_retrout: move.w 20(a6),d0 lsl.w #4,d0 add.w 20(a6),d0 move.w d0,$dff09e tst.w (a6) beq.s mt_nonewper move.w (a6),22(a6) mt_nonewper: move.b 2(a6),d0 and.b #$f,d0 cmp.b #$e,d0 bne.s mt_noset move.w 2(a6),24(a6) rts mt_noset: tst.b 3(a6) bne.s mt_noclr clr.w 24(a6) mt_noclr: cmp.b #3,d0 beq mt_modvol cmp.b #6,d0 beq mt_modvol cmp.b #9,d0 beq mt_modvol cmp.b #4,d0 beq mt_modper cmp.b #7,d0 beq mt_modper cmp.b #10,d0 beq mt_modper cmp.b #5,d0 beq mt_modvolper cmp.b #8,d0 beq mt_modvolper cmp.b #11,d0 beq mt_modvolper cmp.b #15,d0 beq.s mt_speedset cmp.b #12,d0 bne.s mt_nochnge move.b 3(a6),8(a4) mt_nochnge: rts mt_speedset: cmp.b #30,$3(a6) bcs.s mt_speedslide cmp.b #227,$3(a6) bcc.s mt_speedslide cmp.b #210,$3(a6) bhi.s mt_speedsetend move.b 3(a6),mt_speed+1-v(a5) mt_speedset1: move.l #$1b1200,d0 divu mt_speed-v(a5),d0 move.b d0,$bfd400 lsr.w #8,d0 move.b d0,$bfd500 mt_speedsetend: rts mt_speedslide: move.w mt_speed-v(a5),d0 add.b 3(a6),d0 cmp.b #30,d0 bcc.s mt_speedset2 move.w #30,mt_speed-v(a5) bra.s mt_speedset1 mt_speedset2: cmp.b #210,d0 bls.s mt_speedset3 move.w #210,mt_speed-v(a5) bra.s mt_speedset1 mt_speedset3: move.b d0,mt_speed+1-v(a5) bra.s mt_speedset1 mt_modvol: move.w 20(a6),d0 bra.s mt_push mt_modper: move.w 20(a6),d0 lsl.w #4,d0 bra.s mt_push mt_modvolper: move.w 20(a6),d0 lsl.w #4,d0 add.w 20(a6),d0 mt_push: add.w #$8000,d0 move.w d0,$dff09e rts v: mt_aud1temp: dc.w 0,0,0,0,0,0,0,0,0,0,1,0,0 mt_aud2temp: dc.w 0,0,0,0,0,0,0,0,0,0,2,0,0 mt_aud3temp: dc.w 0,0,0,0,0,0,0,0,0,0,4,0,0 mt_aud4temp: dc.w 0,0,0,0,0,0,0,0,0,0,8,0,0 mt_partnote: dc.w 0 mt_partnrplay: dc.w 0 mt_counter: dc.w 0 mt_samples: blk.l 15,0 mt_maxpart: dc.w 0 mt_dmacon: dc.w 0 mt_onoff: dc.w 0 mt_speed: dc.w tempo mt_smplentab: dc.w smp1len,smp2len,smp3len,smp4len dc.w smp5len,smp6len,smp7len,smp8len dc.w smp9len,smpAlen,smpBlen,smpClen dc.w smpDlen,smpElen,smpFlen mt_arpeggio: dc.w $0358,$0328,$02fa,$02d0,$02a6,$0280,$025c dc.w $023a,$021a,$01fc,$01e0,$01c5,$01ac,$0194,$017d dc.w $0168,$0153,$0140,$012e,$011d,$010d,$00fe,$00f0 dc.w $00e2,$00d6,$00ca,$00be,$00b4,$00aa,$00a0,$0097 dc.w $008f,$0087,$007f,$0078,$0071 songdata: blk.b songlen smp1data: blk.b smp1len smp2data: blk.b smp2len smp3data: blk.b smp3len smp4data: blk.b smp4len smp5data: blk.b smp5len smp6data: blk.b smp6len smp7data: blk.b smp7len smp8data: blk.b smp8len smp9data: blk.b smp9len smpAdata: blk.b smpAlen smpBdata: blk.b smpBlen smpCdata: blk.b smpClen smpDdata: blk.b smpDlen smpEdata: blk.b smpElen smpFdata: blk.b smpFlen dc.l 0  .