musl = 900 ; Musik-Lange sndl = 900 ; Sound-Lange ; Hier beginnt die Musik-Abspielroutine V1.0 vom 12.08.1989 ; Copyright 1989 by Michael Winterberg ; Deusener StraBe 275 ; 4600 Dortmund 18 musirqan: bsr musinit move.l musspeed,musoldspeed or.b #2,$bfe001 lea musirq,a0 move.l a0,$6c rts musirqaus: or.b #2,$bfe001 eor.b #2,$bfe001 move.w #$f,$dff096 move.l oldirq,$6c rts musinit: move.l $6c,oldirq clr.l muscmd lea musperiod,a0 clr.l (a0)+ clr.l (a0)+ move.l startpos,muspos move.l startpos,musstart move.l endepos,musende clr.l musy clr.l muscount move.l #muscode,musmem move.l maxpos,musmaxpos lea soundstart,a0 lea mussoundstart,a1 lea sounddata,a2 musinitloop: move.b (a0)+,(a1)+ cmp.l a0,a2 bne.s musinitloop move.l geschwindigkeit,musspeed clr.l muscmd2 lea mussoundstart,a0 bsr musaddmem lea musiffstart,a0 bra musaddmem musaddmem: lea soundlist,a1 clr.l d0 musaddmemloop: move.l (a0),d1 add.l a1,d1 move.l d1,(a0)+ addq.l #1,d0 cmp.l #32,d0 bne.s musaddmemloop rts musmem: dc.l 0 musmaxpos: dc.l 0 mussoundstart: blk.l 32,0 mussoundlaenge: blk.l 32,0 musiffstart: blk.l 32,0 mussoundloop: blk.l 32,0 mussoundlooplaenge: blk.l 32,0 mus_period_daten: dc.w 0,3416,3232,3048,2872,2712,2360,2416,2280,2152,2032,1920 dc.w 1808,1712,0,0 dc.w 0,1708,1616,1524,1436,1356,1280,1208,1140,1076,1016,960 dc.w 904,856,0,0 dc.w 0,854,808,762,718,678,640,604,570,538,508,480,452,428,0,0 dc.w 0,427,404,381,359,339,320,302,285,269,254,240,226,214,0,0 dc.w 0,214,202,191,180,170,160,151,143,135,127,120,113,107,0,0 mus_wave_daten: dc.w 0,1,2,3,4,6,9,13,18,24,31,39,48,50,61,72 muscmd: dc.b 0,0,0,0 muscmd2: dc.b 0,0,0,0 musperiod: dc.w 0,0,0,0 musvol: dc.w 0,0,0,0 musvolcount: dc.w 0,0,0,0 musdata: dc.w 0,0,0,0 musdata2: dc.w 0,0,0,0 musdata3: dc.w 0,0,0,0 musdata4: dc.w 0,0,0,0 muscount: dc.l 0 musnr: dc.l 0,0,0,0 musspeed: dc.l 0 musstart: dc.l 0 musende: dc.l 0 musvoice: dc.l 0 muspos: dc.l 0 musy: dc.l 0 musoldspeed: dc.l 0 musirq: movem.l a0-a6/d0-d7,-(a7) bsr musplay movem.l (a7)+,a0-a6/d0-d7 move.l oldirq,-(a7) rts musplay: cmp.l #0,muscount beq musplay_func sub.l #1,muscount bsr musdo_func rts musplay_func: move.l musspeed,muscount move.l #0,musvoice musplay_func_loop: bsr musplaysounds add.l #1,musvoice cmp.l #4,musvoice bne musplay_func_loop cmp.w #0,musflags beq musdo_cont or.w #$8000,musflags move.w musflags,$dff096 move.w #0,musflags musdo_cont: bsr musdo_func add.l #1,musy cmp.l #16,musy beq musneuepos rts musneuepos: add.l #1,muspos move.l #0,musy move.l muspos,d0 cmp.l musende,d0 beq musrestart rts musrestart: move.l musoldspeed,musspeed move.l musstart,muspos move.l #0,muscmd2 rts musplayabbruch: move.l #-1,musy move.l #3,musvoice jmp musrestart musplaysounds: move.l muspos,d0 move.l musmem,a0 muls #8,d0 add.l d0,a0 move.l musvoice,d0 muls #2,d0 add.l d0,a0 cmp.w #$ffff,(a0) beq musplayabbruch move.w (a0),d0 muls #48,d0 move.l musmaxpos,d1 muls #8,d1 add.l musmem,d1 add.l d0,d1 move.l d1,a0 move.l musy,d0 muls #3,d0 add.l d0,a0 cmp.b #$ff,(a0) beq musplayabbruch move.b (a0),d0 and.l #$ff,d0 cmp.l #$e0,d0 bpl musok cmp.l #$50,d0 bpl musfunc lea mus_period_daten,a1 muls #2,d0 add.l d0,a1 move.w (a1),d7 cmp.l #0,d7 beq musok move.l musvoice,d0 move.l d0,d2 move.l d0,d3 move.l d0,d4 muls #$10,d2 muls #4,d3 muls #2,d4 move.b 1(a0),d6 and.l #$ff,d6 move.b 2(a0),d5 and.l #$ff,d5 cmp.l #32,d5 bpl musok muls #4,d5 lea mussoundstart,a0 cmp.l #0,(a0,d5) beq musok jsr musvoiceoff cmp.l #0,d6 beq mus_iff_only lea muscmd,a0 add.l musvoice,a0 move.b #$e3,(a0) lea musvol,a2 move.w #0,(a2,d4) cmp.l #$10,d6 bpl musatdc move.b #$e4,(a0) lea musvol,a0 move.w #64,(a2,d4) musatdc: lea mus_wave_daten,a0 lea musdata,a1 lea musdata2,a2 add.l d4,a1 add.l d4,a2 move.l d6,d1 and.l #$f,d1 muls #2,d1 move.w (a0,d1),(a2) lea musvolcount,a4 move.w (a0,d1),(a4,d4) move.l d6,d0 and.l #$f0,d0 asr.l #3,d0 move.w (a0,d0),(a1) lea muscmd,a1 move.l musvoice,d1 cmp.b #$E3,(a1,d1) bne muskeinvol move.w (a0,d0),(a4,d4) muskeinvol: lea musperiod,a1 move.w d7,(a1,d4) move.l #$dff000,a6 add.l d2,a6 lea musiffstart,a0 cmp.l #0,(a0,d5) bne musdo_iff lea mussoundstart,a0 move.l (a0,d5),$a0(a6) lea mussoundlaenge,a0 move.l (a0,d5),d0 asr.l #1,d0 move.w d0,$a4(a6) move.w d7,$a6(a6) bsr mussetvol bsr musvoiceon lea musnr,a0 move.l d5,(a0,d3) rts musdo_iff: move.l (a0,d5),$a0(a6) lea mussoundloop,a0 move.l (a0,d5),d0 lea mussoundlooplaenge,a0 add.l (a0,d5),d0 asr.l #1,d0 move.w d0,$a4(a6) move.w d7,$a6(a6) bsr musvoiceon lea musnr,a0 move.l d5,(a0,d3) rts mus_keiniff: lea mussoundstart,a0 move.l (a0,d5),$a0(a6) lea mussoundlaenge,a0 move.l (a0,d5),d0 asr.l #1,d0 move.w d0,$a4(a6) move.w d7,$a6(a6) bsr musvoiceon lea musnr,a0 move.l #-1,(a0,d3) lea musperiod,a0 move.w d7,(a0,d4) rts mus_iff_only: move.l #$dff000,a6 move.l musvoice,d2 muls #$10,d2 add.l d2,a6 lea muscmd,a0 add.l musvoice,a0 move.b #0,(a0) lea musvol,a0 move.l musvoice,d4 muls #2,d4 move.w #64,(a0,d4) lea musiffstart,a0 cmp.l #0,(a0,d5) beq mus_keiniff move.l (a0,d5),$a0(a6) lea mussoundlaenge,a0 move.l (a0,d5),d0 sub.l #104,d0 asr.l #1,d0 move.w d0,$a4(a6) move.w d7,$a6(a6) bsr musvoiceon lea musnr,a0 move.l #-1,(a0,d3) lea musperiod,a0 move.w d7,(a0,d4) rts musvoiceoff: move.l musvoice,d0 move.l #1,d1 asl.l d0,d1 move.w d1,$dff096 move.l musvoice,d0 muls #$10,d0 move.l #$dff000,a3 add.l d0,a3 move.l #musleer,$a0(a3) move.w #5,$a4(a3) move.w #0,$a8(a3) move.w #202,$a6(a3) rts musvoiceon: move.l musvoice,d0 move.l #1,d1 asl.l d0,d1 or.w d1,musflags rts musflags: dc.w 0 mussetvol: move.l #$dff000,a5 move.l musvoice,d0 muls #2,d0 lea musvol,a0 add.l d0,a0 muls #8,d0 add.l d0,a5 move.w (a0),$a8(a5) rts musok: rts muschangespeed: move.b 2(a0),d0 and.l #$ff,d0 cmp.l #32,d0 bpl musnochangespeed move.l d0,musspeed musnochangespeed: rts musfunc: cmp.b #$52,d0 beq muschangespeed move.l musvoice,d0 muls #2,d0 lea muscmd2,a1 add.l musvoice,a1 move.b (a0),(a1) move.b 1(a0),d1 and.l #$ff,d1 lea musdata3,a1 move.w d1,(a1,d0) move.b 2(a0),d1 and.l #$ff,d1 lea musdata4,a1 move.w d1,(a1,d0) rts musdo_func: move.l #0,musvoice musdo_func_loop: bsr musfunc_work bsr mussetvol add.l #1,musvoice cmp.l #4,musvoice bne musdo_func_loop rts musleer: dc.b 0,0,0,0,0,0,0,0,0,0,0,0 musfunc_work: move.l musvoice,d0 muls #4,d0 lea muscmd,a1 add.l musvoice,a1 cmp.b #0,(a1) bne mus_func_work_weiter mus_noloop: move.l #musleer,d2 move.l #10,d3 jmp mus_func_it mus_func_work_weiter: move.l d0,d1 lea musnr,a0 add.l d1,a0 cmp.l #-1,(a0) beq mus_noloop move.l (a0),d1 lea soundlooplaenge,a0 add.l d1,a0 cmp.l #0,(a0) beq mus_func_workok lea musiffstart,a0 add.l d1,a0 move.l (a0),d2 lea mussoundloop,a0 add.l (a0,d1),d2 lea mussoundlooplaenge,a0 move.l (a0,d1),d3 mus_func_it: move.l musvoice,d0 muls #$10,d0 move.l #$dff000,a0 add.l d0,a0 cmp.l #0,d3 beq mus_func_workok move.l d2,$a0(a0) asr.l #1,d3 move.w d3,$a4(a0) mus_func_workok: lea musvolcount,a3 move.l #$dff000,a6 lea musdata,a1 lea musdata2,a2 move.l musvoice,d0 move.l d0,d2 move.l d0,d3 move.l d0,d4 muls #2,d4 muls #4,d3 muls #$10,d2 add.l d2,a6 lea muscmd2,a0 add.l musvoice,a0 move.b (a0),d0 and.l #$ff,d0 cmp.b #$50,d0 beq mustonminus cmp.b #$51,d0 beq mustonplus muscommand2: lea muscmd,a0 add.l musvoice,a0 move.b (a0),d0 and.l #$ff,d0 cmp.b #$e3,d0 beq musattack cmp.b #$e4,d0 beq musdecay rts musattack: cmp.w #0,(a3,d4) beq musdo_attack sub.w #1,(a3,d4) rts musdo_attack: lea musvol,a0 cmp.w #64,(a0,d4) beq musattack_ok add.w #8,(a0,d4) move.w (a1,d4),(a3,d4) sub.w #1,(a3,d4) rts musattack_ok: lea muscmd,a0 move.l musvoice,d0 move.b #$e4,(a0,d0) move.w (a2,d4),(a3,d4) sub.w #1,(a3,d4) musdecay: cmp.w #0,(a3,d4) beq musdo_decay sub.w #1,(a3,d4) rts musdo_decay: lea musvol,a0 cmp.w #0,(a0,d4) beq musdecay_ok sub.w #8,(a0,d4) move.w (a2,d4),(a3,d4) sub.w #1,(a3,d4) rts musdecay_ok: lea muscmd,a0 move.l musvoice,d0 move.b #0,(a0,d0) rts mustonminus: move.l #$dff000,a6 move.l musvoice,d0 muls #$10,d0 add.l d0,a6 lea musdata3,a0 move.w (a0,d4),d0 muls #$100,d0 lea musdata4,a0 add.w (a0,d4),d0 lea musperiod,a0 add.w d0,(a0,d4) move.w (a0,d4),$a6(a6) jmp muscommand2 mustonplus: move.l #$dff000,a6 move.l musvoice,d0 muls #$10,d0 add.l d0,a6 lea musdata3,a0 move.w (a0,d4),d0 muls #$100,d0 lea musdata4,a0 add.w (a0,d4),d0 lea musperiod,a0 sub.w d0,(a0,d4) move.w (a0,d4),$a6(a6) jmp muscommand2 muslist: geschwindigkeit: dc.l 0 startpos: dc.l 0 endepos: dc.l 0 maxpos: dc.l 0 muscode: blk.b musl,0 soundlist: soundstart: blk.l 32,0 soundlaenge: blk.l 32,0 iffstart: blk.l 32,0 soundloop: blk.l 32,0 soundlooplaenge: blk.l 32,0 soundname: sounddata: blk.b sndl-640,0 oldirq: dc.l 0 musend:  .