***************************************** ***************************************** ** ** ** SoundTrackerV4.1 Copper Playroutine ** ** ** ** Coding : The Invisible Power ** ** ** ** C The New Masters ** ** ** ** Based on the V4.0 of DOC ** ** ** ***************************************** ***************************************** ********************************** * Input: a0: your own CopperList * ********************************** mt_init: move.w #$80,$dff096 move.l #mt_CopperList,$dff080 move.l a0,$dff084 clr.w $dff088 move.w #$8080,$dff096 lea mt_sample1(pc),a0 move.l #snd1,(a0)+ move.l #snd2,(a0)+ move.l #snd3,(a0)+ move.l #snd4,(a0)+ move.l #snd5,(a0)+ move.l #snd6,(a0)+ move.l #snd7,(a0)+ move.l #snd8,(a0)+ move.l #snd9,(a0)+ move.l #snda,(a0)+ move.l #sndb,(a0)+ move.l #sndc,(a0)+ move.l #sndd,(a0)+ move.l #snde,(a0)+ move.l #sndf,(a0)+ lea mt_sample1(pc),a0 clr.w d0 mt_clear: move.l (a0,d0.w),a1 clr.l (a1) addq.w #4,d0 cmp.w #$3c,d0 bne.s mt_clear eor.w #$c000,mt_voice0+12 move.b sampleinfo+$1d6,mt_maxpart+1 move.b sampleinfo+$1d7,mt_kn1+1 rts ********************** * Stop Playing Sound * ********************** mt_end: lea $dff000,a5 lea GraphicsName(pc),a1 move.l 4.w,a6 jsr -408(a6) move.l d0,a1 move.w #$8f,$96(a5) move.l 38(a1),$80(a5) move.l 42(a1),$84(a5) clr.w $88(a5) move.w #$8080,$96(a5) jsr -414(a6) rts GraphicsName: dc.b 'graphics.library',0 even ******************************************* * REPLAY SONG ROUTINE (EVERY SCREEN CYCLE * ******************************************* REPLAY_SONG: bsr.L mt_ClearCopListTop ;SoundTeil der Copperliste addq.l #1,mt_counter move.l mt_tempo,d0 cmp.l mt_counter,d0 bne.s mt_notsix clr.l mt_counter move.w #$100,mt_EffAction ;kein Abbruch bsr.l mt_rout2 bsr.L mt_WB rts ********************** * Auf Effekte testen * ********************** mt_notsix: move.w #$8a,mt_EffAction ;CopperListe frueher abbrechen lea mt_aud1temp(pc),a6 tst.b 3(a6) beq.s mt_arp1 lea mt_CoPT0(pc),a4 lea mt_LC0(pc),a5 bsr.s mt_arprout mt_arp1: lea mt_aud2temp(pc),a6 tst.b 3(a6) beq.s mt_arp2 lea mt_CoPT1(pc),a4 lea mt_LC1(pc),a5 bsr.s mt_arprout mt_arp2: lea mt_aud3temp(pc),a6 tst.b 3(a6) beq.s mt_arp3 lea mt_CoPT2(pc),a4 lea mt_LC2(pc),a5 bsr.s mt_arprout mt_arp3: lea mt_aud4temp(pc),a6 tst.b 3(a6) beq.s mt_arp4 lea mt_CoPT3(pc),a4 lea mt_LC3(pc),a5 bsr.s mt_arprout mt_arp4: bra.L mt_stop 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.L mt_pushvol1 bra.s mt_noslide mt_voldwn2: clr.w d0 move.b 25(a6),d0 bsr.L mt_pushvol2 mt_noslide: move.b 2(a6),d0 and.b #$0f,d0 tst.b d0 beq.L mt_arpegrt cmp.b #3,d0 beq.L mt_arpegrt cmp.b #4,d0 beq.L mt_arpegrt cmp.b #5,d0 beq.L mt_arpegrt cmp.b #1,d0 beq.s mt_portup cmp.b #6,d0 beq.s mt_portup cmp.b #7,d0 beq.s mt_portup cmp.b #8,d0 beq.s mt_portup cmp.b #2,d0 beq.s mt_portdwn cmp.b #9,d0 beq.s mt_portdwn cmp.b #10,d0 beq.s mt_portdwn cmp.b #11,d0 beq.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) bpl.s mt_ok1 move.w #$71,22(a6) mt_ok1: move.w 6(a4),12(a5) move.w 22(a6),14(a5) rts mt_portdwn: clr.w d0 move.b 3(a6),d0 add.w d0,22(a6) cmp.w #$358,22(a6) bmi.s mt_ok2 move.w #$358,22(a6) mt_ok2: move.w 6(a4),12(a5) move.w 22(a6),14(a5) 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) bmi.s mt_ok3 move.w #$40,$12(a6) mt_ok3: move.w 8(a4),16(a5) move.w $12(a6),18(a5) rts mt_voldwn: clr.w d0 move.b 3(a6),d0 mt_pushvol2: and.b #$0f,d0 sub.w d0,$12(a6) bpl.s mt_ok4 clr.w $12(a6) mt_ok4: move.w 8(a4),16(a5) move.w $12(a6),18(a5) rts mt_arpegrt: cmp.w #1,mt_counter+2 beq.s mt_loop2 cmp.w #2,mt_counter+2 beq.s mt_loop3 cmp.w #3,mt_counter+2 beq.s mt_loop4 cmp.w #4,mt_counter+2 beq.s mt_loop2 cmp.w #5,mt_counter+2 beq.s mt_loop3 rts mt_loop2: clr.l d0 move.b 3(a6),d0 lsr.b #4,d0 bra.s mt_cont mt_loop3: clr.l d0 move.b 3(a6),d0 and.b #$0f,d0 bra.s mt_cont mt_loop4: move.w 16(a6),d2 bra.s mt_endpart mt_cont: lsl.w #1,d0 clr.l d1 move.w 16(a6),d1 lea mt_arpeggio,a0 mt_loop5: move.w (a0,d0),d2 cmp.w (a0),d1 beq.s mt_endpart addq.l #2,a0 bra.s mt_loop5 mt_endpart: move.w 6(a4),12(a5) move.w d2,14(a5) rts ********************************* * All mt_tempo Times ausfuehren * ********************************* mt_rout2: lea sampleinfo(pc),a0 move.l a0,a3 moveq #$c,d0 add.l d0,a3 move.l a0,a2 add.l #$1d8,a2 add.l #$258,a0 move.l mt_partnrplay(pc),d0 clr.l d1 move.b (a2,d0),d1 lsl.l #8,d1 lsl.l #2,d1 add.l mt_partnote(pc),d1 move.l d1,mt_partpoint clr.w mt_dmacon lea mt_CoPT0(pc),a4 lea mt_LC0(pc),a5 lea mt_aud1temp(pc),a6 bsr.L mt_playit lea mt_CoPT1(pc),a4 lea mt_LC1(pc),a5 lea mt_aud2temp(pc),a6 bsr.L mt_playit lea mt_CoPT2(pc),a4 lea mt_LC2(pc),a5 lea mt_aud3temp(pc),a6 bsr.L mt_playit lea mt_CoPT3(pc),a4 lea mt_LC3(pc),a5 lea mt_aud4temp(pc),a6 bsr.L mt_playit move.w mt_dmacon(pc),d0 or.w #$8000,d0 move.w d0,mt_DMACONCOP lea mt_aud4temp(pc),a6 cmp.w #1,14(a6) bne.s mt_voice3 move.l 10(a6),d0 lea mt_LC3b(pc),a0 move.w #$d2,4(a0) move.w d0,6(a0) swap d0 move.w #$d0,(a0) move.w d0,2(a0) move.l #$d40001,8(a0) mt_voice3: lea mt_aud3temp(pc),a6 cmp.w #1,14(a6) bne.s mt_voice2 move.l 10(a6),d0 lea mt_LC2b(pc),a0 move.w #$c2,4(a0) move.w d0,6(a0) swap d0 move.w #$c0,(a0) move.w d0,2(a0) move.l #$c40001,8(a0) mt_voice2: lea mt_aud2temp(pc),a6 cmp.w #1,14(a6) bne.s mt_voice1 move.l 10(a6),d0 lea mt_LC1b(pc),a0 move.w #$b2,4(a0) move.w d0,6(a0) swap d0 move.w #$b0,(a0) move.w d0,2(a0) move.l #$b40001,8(a0) mt_voice1: lea mt_aud1temp(pc),a6 cmp.w #1,14(a6) bne.s mt_voice0 move.l 10(a6),d0 lea mt_LC0b(pc),a0 move.w #$a2,4(a0) move.w d0,6(a0) swap d0 move.w #$a0,(a0) move.w d0,2(a0) move.l #$a40001,8(a0) mt_voice0: lea mt_modulate,a0 move.l mt_partnote,d0 lsl.b #7,d0 add.l #$10,d0 move.l d0,mt_partnote cmp.l #$400,d0 bne.s mt_stop clr.l mt_partnote addq.l #1,mt_partnrplay clr.l d0 move.w mt_maxpart,d0 move.l mt_partnrplay,d1 cmp.l d0,d1 bne.s mt_stop clr.l mt_partnrplay mt_stop: rts mt_playit: move.l (a0,d1),(a6) addq.l #4,d1 clr.l d2 move.b 2(a6),d2 and.b #$f0,d2 lsr.b #4,d2 tst.b d2 beq.s mt_nosamplechange clr.l d3 lea mt_samples,a1 move.l d2,d4 lsl.l #2,d2 ;Welcher Depp multipliziert noch mit 4 ? move.l d4,d3 lsl.l #5,d4 ;mulu #$1e,d4 lsl.l #1,d3 sub.l d3,d4 move.l (a1,d2),4(a6) move.w (a3,d4),8(a6) move.w 2(a3,d4),18(a6) move.w 4(a3,d4),d3 tst.w d3 beq.s mt_displace move.l 4(a6),d2 add.l d3,d2 move.l d2,4(a6) move.l d2,10(a6) move.w 6(a3,d4),8(a6) move.w 6(a3,d4),14(a6) move.w 8(a4),16(a5) move.w 18(a6),18(a5) bra.s mt_nosamplechange mt_displace: move.l 4(a6),d2 add.l d3,d2 move.l d2,10(a6) move.w 6(a3,d4),14(a6) move.w 8(a4),16(a5) move.w 18(a6),18(a5) mt_nosamplechange: tst.w (a6) beq.s mt_retrout move.w (a6),16(a6) move.w #$96,20(a5) move.w 20(a6),22(a5) move.l 4(a6),d0 move.w 2(a4),4(a5) move.w d0,6(a5) swap d0 move.w (a4),(a5) move.w d0,2(a5) move.w 4(a4),8(a5) move.w 8(a6),10(a5) move.w 6(a4),12(a5) move.w (a6),14(a5) move.w 20(a6),d0 or.w d0,mt_dmacon mt_retrout: move.w 20(a6),d0 lsl.w #4,d0 add.w 20(a6),d0 move.w d0,mt_ADKCONCLEAR tst.w (a6) beq.s mt_nonewper move.w (a6),22(a6) mt_nonewper: move.b 2(a6),d0 and.b #$0f,d0 tst.b d0 beq.s mt_nochnge cmp.b #14,d0 beq.s mt_zx1 cmp.b #15,d0 bne.s mt_noset move.w 2(a6),d0 ;Tempo veraendern and.l #$f,d0 move.l d0,mt_tempo rts mt_zx1: 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.s mt_modvol cmp.b #6,d0 beq.s mt_modvol cmp.b #9,d0 beq.s mt_modvol cmp.b #4,d0 beq.s mt_modper cmp.b #7,d0 beq.s mt_modper cmp.b #10,d0 beq.s mt_modper cmp.b #5,d0 beq.s mt_modvolper cmp.b #8,d0 beq.s mt_modvolper cmp.b #11,d0 beq.s mt_modvolper cmp.b #12,d0 bne.s mt_nochnge move.w 8(a4),16(a5) move.b 3(a6),19(a5) mt_nochnge: rts 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,mt_ADKCON rts mt_aud1temp: blk.w 10,0 dc.w 1 blk.w 2,0 mt_aud2temp: blk.w 10,0 dc.w 2 blk.w 2,0 mt_aud3temp: blk.w 10,0 dc.w 4 blk.w 2,0 mt_aud4temp: blk.w 10,0 dc.w 8 blk.w 2,0 mt_partnote: dc.l 0 mt_partnrplay: dc.l 0 mt_counter: dc.l 0 mt_tempo: dc.l 6 mt_partpoint: dc.l 0 mt_samples: dc.w 0,0 mt_sample1: blk.l 15,0 mt_maxpart: dc.w 0 mt_kn1: dc.w 0 mt_dmacon: dc.w 0 mt_modulate: dc.w $0c39,$0039,$00bf,$ec01,$6630,$0839,$0007,$00bf dc.w $e001,$6626,$2c79,$0000,$0004,$43fa,$0020,$4eae dc.w $fe68,$2c40,$4280,$41fa,$0026,$223c,$0000,$0032 dc.w $4eae,$ffa6,$60ee,$0000,$0000,$4e75,$696e,$7475 dc.w $6974,$696f,$6e2e,$6c69,$6272,$6172,$7900,$0104 dc.w $1753,$6f75,$6e64,$5472,$6163,$6b65,$7220,$5632 dc.w $0063,$00f0,$20a9,$2054,$6865,$204a,$756e,$676c dc.w $6520,$436f,$6d6d,$616e,$6400,$0000 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,$0000,$0000,$0000 mt_ClearCopListTop: bsr.s mt_WB move.l #-1,$dff044 move.l #$0df00000,$dff040 clr.l $dff064 move.l #mt_ClearData,$dff050 move.l #mt_LC0b,$dff054 move.w #%0000011000000001,$dff058 bsr.s mt_WB move.l #mt_ClearData,$dff050 move.l #mt_LC0,$dff054 move.w #%0000110000000001,$dff058 rts mt_WB: btst #6,$dff002 bne.s mt_WB rts mt_ClearData: blk.l 24,$1000000 mt_CopperList: dc.l $1000000 mt_LC0: blk.l 6,$1000000 mt_LC1: blk.l 6,$1000000 mt_LC2: blk.l 6,$1000000 mt_LC3: blk.l 6,$1000000 mt_EffAction: dc.l $0 ;Abbruch bei Effect dc.w $9e mt_ADKCONCLEAR: dc.w 0 dc.w $9e mt_ADKCON: dc.w 0 mt_Wait: dc.l $0801fffe dc.w $96 mt_DMACONCOP: dc.w 0 mt_LC0b: blk.l 3,$1000000 mt_LC1b: blk.l 3,$1000000 mt_LC2b: blk.l 3,$1000000 mt_LC3b: blk.l 3,$1000000 dc.l $008a0000 mt_CoPT0: dc.w $a0,$a2,$a4,$a6,$a8 mt_CoPT1: dc.w $b0,$b2,$b4,$b6,$b8 mt_CoPT2: dc.w $c0,$c2,$c4,$c6,$c8 mt_CoPT3: dc.w $d0,$d2,$d4,$d6,$d8 sampleinfo: blk.b 0000,0 snd1: blk.b 0000,0 snd2: blk.b 0000,0 snd3: blk.b 0000,0 snd4: blk.b 0000,0 snd5: blk.b 0000,0 snd6: blk.b 0000,0 snd7: blk.b 0000,0 snd8: blk.b 0000,0 snd9: blk.b 0000,0 snda: blk.b 0000,0 sndb: blk.b 0000,0 sndc: blk.b 0000,0 sndd: blk.b 0000,0 snde: blk.b 0000,0 sndf: blk.b 0000,0 *************************************** * End of Copper ST-Replay Module ****** ***************************************  .