;APS00000000000000000000000000000000000000000000000000000000000000000000000000000000 ;******************************** ;** playMod v1.5 by Lisiak/CDS ** ;******************************** SECTION musicRoutine, CODE_C ;establishing a code section moveq #0,d0 ;register for variables to 0 moveq #3,d2 ;4 music channel moveq #0,d3 ;for a jump of 4 bytes lea numberMod(pc),a0 ;pointer MODs to A0 move.l 0(a0,d0.w),a1 ;pointer playing Mod to A1 move.l a1,a2 ;pointer plaing MOD to A2 add #1084,a2 ;pointer 1.st pattern MOD to A2 move.b #31,d1 lea spmPointers(pc),a3 move.b 950(a1),d0 mulu.w #1024,d0 add.w #1084,d0 move.l d0,(a3)+ ; dbf d1, patternData ;play data from pattern move.l (a2)+,d4 ;channel 0-3, pattern data to D4 bne processCahnnel ;zero data in whole channel? dbf d2,patternData ;yes, process another channel processCahnnel move.w d4,d0 ;lower 4 bits SMP number in D0 rol.w #4,d0 ;lower 4 bits SMP to first 4 bits D0 move.w d4,d1 ;effect command bits in D1 and.w #$0fff,d1 ;only effect command bits in D1 ;in this version without efect command!!! swap d4 ;upper 4 bits SMP number & 12 bits period in- ;-lower 2 bytes D0 move.w d4,d1 ;upper 4 bits SMP number to D1 rol.w #8,d1 ;upper 4 bits SMP to upper 4 bits D1 and.b #$0f,d0 ;only lower 4 bits SMP in lower 4 bits D0 and.b #$f0,d1 ;only upper 4 bits SMP in upper 4 bits D1 or.b d1,d0 ;8 bits SMP number in D0 ; move.b d0,d0 ;zero flag in D0? = no playing SMP? beq processSmpEnd ;yes, skip sample setup = zero flag mulu #30,d0 ;for correct offset of sample number in MOD lea smpChannel(pc),a0 move.l 0(a0,d3.w),a0 jsr (a0) bra processSmpEnd smpCh0 ;channel 0 move.w 42(a1,d0.w),$dff0a4 ;sampleLenght to HW register move.b 45(a1,d0.w),$dff0a9 ;preset sampleVolume to HW register rts smpCh1 move.w 42(a1,d0.w),$dff0b4 ;same for channel 1 move.b 45(a1,d0.w),$dff0b9 rts smpCh2 move.w 42(a1,d0.w),$dff0c4 ;same for channel 2 move.b 45(a1,d0.w),$dff0c9 rts smpCh3 move.w 42(a1,d0.w),$dff0d4 ;same for channel 3 move.b 45(a1,d0.w),$dff0d9 rts processSmpEnd and.w #$0fff,d4 ;only 12 bit note period in D4 beq processPeriodEnd lea periodChannel(pc),a0 move.l 0(a0,d3.w),a0 jsr (a0) bra processPeriodEnd periodCh0 move.w d4,$dff0a6 ;note period to register - channel 0 rts periodCh1 move.w d4,$dff0b6 ;same for channel 1 rts periodCh2 move.w d4,$dff0c6 ;same for channel 2 rts periodCh3 move.w d4,$dff0d6 ;same for channel 3 rts processPeriodEnd addq #4,d3 dbf d2,patternData ;process next music channel move.b #$00,$bfde00 ;CIA primary timer, 2000=1/100 second move.b #$7f,$bfdd00 ; move.b #$00,$bfd400 ; move.b #$00,$bfd500 ; move.b #$09,$bfde00 ; primaryTimer ; btst.b #0,$bfdd00 ; beq primaryTimer ; spmPointers dc.l $00000000,$00000000,$00000000,$00000000,$00000000 ;smp 1-5 dc.l $00000000,$00000000,$00000000,$00000000,$00000000 ;smp 6-10 dc.l $00000000,$00000000,$00000000,$00000000,$00000000 ;smp 11-15 dc.l $00000000,$00000000,$00000000,$00000000,$00000000 ;smp 16-20 dc.l $00000000,$00000000,$00000000,$00000000,$00000000 ;smp 21-25 dc.l $00000000,$00000000,$00000000,$00000000,$00000000,$00000000 ;smp 26-31 smpChannel dc.l smpCh0, smpCh1, smpCh2, smpCh3 periodChannel dc.l periodCh0, periodCh1, periodCh2, periodCh3 numberMod dc.l $0, $3647c songs dc.l $00A05000, $00F02F91, $00A01F05, $00A03C10; 00 dc.l $00000000, $00000000, $00000000, $00000A10; 01 dc.l $00000000, $00000000, $00A01C20, $00000A10; 02 dc.l $00000000, $00000000, $00000000, $00000A10; 03 dc.l $00000000, $00000000, $00A01C08, $00000A10; 04 dc.l $00000000, $00000000, $00000000, $00000A10; 05 dc.l $00000000, $00000000, $00A01C14, $00000A10; 06 dc.l $00000000, $00000000, $00000000, $00000A10; 07 dc.l $00A06000, $00000000, $00A01000, $00000A10; 08 dc.l $00000000, $00000000, $00000000, $00000A10; 09 dc.l $00000000, $00000000, $00A01C10, $00000A10; 10 dc.l $00000000, $00000000, $00000000, $00000A10; 11 dc.l $00000000, $00000000, $00A01C08, $00000A10; 12 dc.l $00000000, $00000000, $00000000, $00000A10; 13 dc.l $00A07000, $00000000, $00A01000, $00000A10; 14 dc.l $00000000, $00000000, $00000000, $00000A10; 15 dc.l $00A05000, $00000000, $00A01C10, $00000A10; 16 dc.l $00000000, $00000000, $00000000, $00000A10; 17 dc.l $00A06000, $00000000, $00A01C08, $00000A10; 18 dc.l $00000000, $00000000, $00000000, $00000A10; 19 dc.l $00A05000, $00000000, $00A01000, $00000A10; 20 dc.l $00000000, $00000000, $00000000, $00000A10; 21 dc.l $00000000, $00000000, $00A01C10, $00000A10; 22 dc.l $00000000, $00000000, $00000000, $00000A10; 23 dc.l $00A06000, $00000000, $00A01C08, $00000A10; 24 dc.l $00000000, $00000000, $00000000, $00000A10; 25 dc.l $00000000, $00000000, $00A01000, $00000A10; 26 dc.l $00000000, $00000000, $00000000, $00000A10; 27 dc.l $00000000, $00000000, $00A01C08, $00000A10; 28 dc.l $00000000, $00000000, $00000000, $00000A10; 29 dc.l $00000000, $00000000, $00A01C18, $00000A10; 30 dc.l $00000000, $00000000, $00000000, $00000A10; 31 dc.l $00A05000, $00000000, $00A01000, $00000000; 32 dc.l $00000000, $00000000, $00000000, $00000000; 33 dc.l $00A05000, $00000000, $00A01C20, $00000000; 34 dc.l $00000000, $00000000, $00000000, $00000000; 35 dc.l $00000000, $00000000, $00A01C08, $00000000; 36 dc.l $00000000, $00000000, $00000000, $00000000; 37 dc.l $00A05000, $00000000, $00A01C14, $00000000; 38 dc.l $00000000, $00000000, $00000000, $00000000; 39 dc.l $00A06000, $00000000, $00A01000, $00000000; 40 dc.l $00000000, $00000000, $00000000, $00000000; 41 dc.l $00000000, $00000000, $00A01C10, $00000000; 42 dc.l $00000000, $00000000, $00000000, $00000000; 43 dc.l $00000000, $00000000, $00A01C08, $00000000; 44 dc.l $00000000, $00000000, $00000000, $00000000; 45 dc.l $00A07000, $00000000, $00A01000, $00000000; 46 dc.l $00000000, $00000000, $00000000, $00000000; 47 dc.l $00A05000, $00000000, $00A01C10, $00000000; 48 dc.l $00000000, $00000000, $00000000, $00000000; 49 dc.l $00A06000, $00000000, $00A01C08, $00000000; 50 dc.l $00000000, $00000000, $00000000, $00000000; 51 dc.l $00A05000, $00000000, $00A01000, $00000000; 52 dc.l $00000000, $00000000, $00000000, $00000000; 53 dc.l $00000000, $00000000, $00A01C10, $00000000; 54 dc.l $00000000, $00000000, $00000000, $00000000; 55 dc.l $00A06000, $00000000, $00A01C08, $00000000; 56 dc.l $00000000, $00000000, $00000000, $00000000; 57 dc.l $00000000, $00000000, $00A01000, $00000000; 58 dc.l $00000000, $00000000, $00000000, $00000000; 59 dc.l $00000000, $00000000, $00A01C08, $00000000; 60 dc.l $00000000, $00000000, $00000000, $00000000; 61 dc.l $00000000, $00000000, $00A01C18, $00000000; 62 dc.l $00000000, $00000000, $00000000, $00000000; 63 mods incbin "DH1:MOD T02X3/T02X3.MOD" incbin "DH1:MOD T02X3/T02X3.MOD"