; T incdir asm: include bincs.i incdir include: include misc/deliplayer.i include LVO3.0/exec_lib.i SECTION Player,code PLAYERHEADER PlayerTagArray dc.b '$VER: Warhead Intro Custom Player V1.2 (2006-01-27)',0 even PlayerTagArray dc.l DTP_CustomPlayer,1 dc.l DTP_Creator,playercreator dc.l DTP_Interrupt,interrupt dc.l DTP_InitPlayer,initplayer dc.l DTP_EndPlayer,endplayer dc.l DTP_InitSound,initsound dc.l DTP_EndSound,endsound dc.l DTP_DeliBase,delibase dc.l $80004474,2 dc.l 0 delibase dc.l 0 playercreator dc.b 'Glynn Williams 1989.',10 dc.b 'Adapted for Eagleplayer and UADE by shd',0 even initplayer move.l dtg_AudioAlloc(a5),a0 jsr (a0) jsr set_int_handlers rts endplayer jsr remove_int_handlers move.l dtg_AudioFree(a5),a0 jsr (a0) rts first_time dc.l 0 interrupt push all move audio_handler_counter,d0 subq #1,d0 move d0,audio_handler_counter tst d0 bne.b no_callback jsr player_handler no_callback tst.l first_time bne.b not_first_time st first_time jsr player_start not_first_time pull all rts initsound push all bclr #1,$bfe001 clr.l first_time jsr audoff pull all rts endsound push all jsr audoff move.l #0,audio_handler_next pull all rts songend push all move.l delibase(pc),a5 move.l dtg_SongEnd(a5),a0 jsr (a0) pull all rts waitsampledma push d0-d1 moveq #15-1,d0 wsdl1 move.b $dff006,d1 wsdl2 cmp.b $dff006,d1 beq.b wsdl2 dbf d0,wsdl1 pull d0-d1 rts set_int_handlers MOVEM.L D0-D7/A0-A6,-(SP) MOVE.L (4).W,A6 LEA (chan1_int),A1 MOVE.L #chan1_int_handler,($12,A1) CLR.L (14,A1) MOVE.L #chan1_int_name,(10,A1) MOVE.L #7,D0 JSR (_LVOSetIntVector,A6) MOVE.L D0,(chan1_old_int) LEA (chan2_int),A1 MOVE.L #chan2_int_handler,($12,A1) CLR.L (14,A1) MOVE.L #chan2_int_name,(10,A1) MOVE.L #8,D0 JSR (_LVOSetIntVector,A6) MOVE.L D0,(chan2_old_int) LEA (chan3_int),A1 MOVE.L #chan3_int_handler,($12,A1) CLR.L (14,A1) MOVE.L #chan3_int_name,(10,A1) MOVE.L #9,D0 JSR (_LVOSetIntVector,A6) MOVE.L D0,(chan3_old_int) LEA (chan4_int),A1 MOVE.L #chan4_int_handler,($12,A1) CLR.L (14,A1) MOVE.L #chan4_int_name,(10,A1) MOVE.L #10,D0 JSR (_LVOSetIntVector,A6) MOVE.L D0,(chan4_old_int) MOVEM.L (SP)+,D0-D7/A0-A6 RTS remove_int_handlers MOVEM.L D0-D7/A0-A2,-(SP) MOVE.L (4).W,A6 MOVE.L (chan1_old_int),A1 MOVE.L #7,D0 JSR (_LVOSetIntVector,A6) MOVE.L (chan2_old_int),A1 MOVE.L #8,D0 JSR (_LVOSetIntVector,A6) MOVE.L (chan3_old_int),A1 MOVE.L #9,D0 JSR (_LVOSetIntVector,A6) MOVE.L (chan4_old_int),A1 MOVE.L #10,D0 JSR (_LVOSetIntVector,A6) MOVEM.L (SP)+,D0-D7/A0-A2 RTS chan1_int_handler MOVEM.L D0-D3/A0-A2,-(SP) moveq #0,d0 bsr audio_int MOVEM.L (SP)+,D0-D3/A0-A2 RTS chan2_int_handler MOVEM.L D0-D3/A0-A2,-(SP) moveq #1,d0 bsr audio_int MOVEM.L (SP)+,D0-D3/A0-A2 RTS chan3_int_handler MOVEM.L D0-D3/A0-A2,-(SP) moveq #2,d0 bsr audio_int MOVEM.L (SP)+,D0-D3/A0-A2 RTS chan4_int_handler MOVEM.L D0-D3/A0-A2,-(SP) moveq #3,d0 bsr audio_int MOVEM.L (SP)+,D0-D3/A0-A2 RTS chan1_int_name dc.b 'chan 1 int name',0 chan2_int_name dc.b 'chan 2 int name',0 chan3_int_name dc.b 'chan 3 int name',0 chan4_int_name dc.b 'chan 4 int name',0 chan1_int ds.l 5 ds.w 1 chan2_int ds.l 5 ds.w 1 chan3_int ds.l 5 ds.w 1 chan4_int ds.l 5 ds.w 1 chan1_old_int ds.l 1 chan2_old_int ds.l 1 chan3_old_int ds.l 1 chan4_old_int ds.l 1 rts_function rts audio_handler_counter dc 0 audio_handler_next dc.l rts_function audio_int lea chan1_state(pc),a0 add d0,a0 add d0,a0 lea $dff0a0,a2 move d0,d1 lsl #4,d1 add d1,a2 move #$0080,d3 lsl d0,d3 move (a0),d1 CMP.W #$FFFC,D1 BEQ.W state_fffc moveq #1,d2 lsl d0,d2 MOVE.W d2,($DFF096) MOVE.W #0,8(a2) MOVE.W d3,($DFF09C) MOVE.W #0,(a0) RTS state_fffc MOVE.W d3,($DFF09C) MOVE.W #$FFFF,(a0) MOVE.L #sample_buf,(a2) MOVE.W #$2A,4(a2) RTS chan1_state dc.w 0 chan2_state dc.w 0 chan3_state dc.w 0 chan4_state dc.w 0 chan1_per dc.w 0 chan2_per dc.w 0 chan3_per dc.w 0 chan4_per dc.w 0 chan1_vol dc.w 0 chan2_vol dc.w 0 chan3_vol dc.w 0 chan4_vol dcb.w 3,0 play_sample movem.l d1-d3/a1-a2,-(a7) lea $dff0a0,a2 move d1,d2 lsl #4,d2 add d2,a2 move #$0080,d3 lsl d1,d3 move d3,$dff09a moveq #1,d2 lsl d1,d2 move d2,$dff096 move #$7c,6(a2) bsr waitsampledma move d3,$dff09c or #$8000,d3 move d3,$dff09a lea chan1_state(pc),a1 add d1,a1 add d1,a1 move #$fffc,(a1) move.l (a0),(a2) move 4(a0),4(a2) move d0,6(a2) lea chan1_vol(pc),a1 add d1,a1 add d1,a1 move (a1),8(a2) or #$8000,d2 move d2,$dff096 movem.l (a7)+,d1-d3/a1-a2 rts audoff MOVE.W #0,($DFF0A8) MOVE.W #0,($DFF0B8) MOVE.W #0,($DFF0C8) MOVE.W #0,($DFF0D8) MOVE.W #15,($DFF096) MOVE.W #$780,($DFF09A) MOVE.W #$780,($DFF09C) MOVE.W #0,chan1_state MOVE.W #0,chan2_state MOVE.W #0,chan3_state MOVE.W #0,chan4_state MOVE.W #0,($DFF0AA) MOVE.W #0,($DFF0BA) MOVE.W #0,($DFF0CA) MOVE.W #0,($DFF0DA) MOVE.L #rts_function,audio_handler_next MOVE.W #$FF,($DFF09E) ;adkcon MOVE.W #$7C,($DFF0A6) ;per MOVE.W #$7C,($DFF0B6) MOVE.W #$7C,($DFF0C6) MOVE.W #$7C,($DFF0D6) BSR.W waitsampledma RTS player_start MOVEM.L D0-D7/A0-A6,-(SP) move.l #notes,noteptr bsr player_handler MOVEM.L (SP)+,D0-D7/A0-A6 RTS player_handler MOVEM.L D0-D7/A0-A6,-(SP) move.l noteptr,a6 next_com move.l (a6)+,d0 beq.b end_player_handler cmp.l #COM_SET_VOL,d0 bne.b not_set_vol lea chan1_vol(pc),a1 move.l (a6)+,d0 add d0,a1 add d0,a1 move.l (a6)+,d0 move d0,(a1) bra.b next_com not_set_vol cmp.l #COM_PLAY,d0 bne.b not_play move.l (a6)+,d1 move.l (a6)+,a0 move.l (a6)+,d0 bsr play_sample bra.b next_com not_play cmp.l #COM_DELAY,d0 bne.b not_delay move.l (a6)+,d0 move d0,audio_handler_counter bra.b next_com not_delay cmp.l #COM_SONG_END,d0 bne.b not_song_end bsr songend not_song_end move.l #notes,a6 end_player_handler move.l a6,noteptr movem.l (sp)+,d0-d7/a0-a6 rts COM_SET_VOL equ 1 COM_PLAY equ 2 COM_DELAY equ 3 COM_SONG_END equ 4 * command syntax * CMD_SET_VOL: dc.l COM_SET_VOL,channel (0-3), volume (0-$40) * CMD_PLAY: dc.l COM_PLAY,channel (0-3), sampleptr, period * CMD_SET_COUNTER: dc.l COM_DELAY,value (1-65535) * CMD_SONG_END: dc.l COM_SONG_END * next command set dc.l 0 noteptr dc.l 0 notes dc.l COM_SET_VOL,0,$28 dc.l COM_SET_VOL,1,$28 dc.l COM_SET_VOL,2,$40 dc.l COM_SET_VOL,3,$40 dc.l COM_PLAY,0,sample_13D60,$1bc dc.l COM_DELAY,$6b dc.l 0 dc.l COM_PLAY,1,sample_2236C,$1bc dc.l COM_DELAY,$141 dc.l 0 dc.l COM_SET_VOL,0,$32 dc.l COM_SET_VOL,1,$32 dc.l COM_PLAY,0,sample_13D60,$1bc dc.l COM_DELAY,$6b dc.l 0 dc.l COM_PLAY,1,sample_2236C,$1bc dc.l COM_DELAY,$d6 dc.l 0 dc.l COM_SET_VOL,2,$40 dc.l COM_PLAY,2,sample_1DA66,$1bc dc.l COM_DELAY,$1a dc.l 0 dc.l COM_SET_VOL,3,$40 dc.l COM_PLAY,3,sample_1DA66,$1bc dc.l COM_DELAY,$50 dc.l 0 dc.l COM_SET_VOL,0,$40 dc.l COM_SET_VOL,1,$40 dc.l COM_PLAY,0,sample_13D60,$1bc dc.l COM_DELAY,$6b dc.l 0 dc.l COM_PLAY,1,sample_2236C,$1bc dc.l COM_DELAY,$d6 dc.l 0 dc.l COM_PLAY,2,sample_1DA66,$1bc dc.l COM_DELAY,$1a dc.l 0 dc.l COM_PLAY,3,sample_1DA66,$1bc dc.l COM_DELAY,$50 dc.l 0 dc.l COM_SET_VOL,0,$18 dc.l COM_SET_VOL,1,$18 dc.l COM_PLAY,0,sample_528A2,$164 dc.l COM_PLAY,1,sample_528A2,$2c8 dc.l COM_DELAY,$6b dc.l 0 lbC00257E dc.l COM_DELAY,$6B dc.l 0 lbC002592 dc.l COM_SET_VOL,0,$20 dc.l COM_SET_VOL,1,$20 dc.l COM_PLAY,0,sample_528A2,$164 dc.l COM_PLAY,1,sample_528A2,$2C8 dc.l COM_DELAY,$6B dc.l 0 lbC0025D2 dc.l COM_DELAY,$6B dc.l 0 lbC0025E6 dc.l COM_SET_VOL,0,$28 dc.l COM_SET_VOL,1,$28 dc.l COM_SET_VOL,2,$28 dc.l COM_SET_VOL,3,$28 dc.l COM_PLAY,0,sample_528A2,$164 dc.l COM_PLAY,1,sample_528A2,$2C8 dc.l COM_DELAY,$15 dc.l 0 lbC002636 dc.l COM_PLAY,2,sample_528A2,$164 dc.l COM_PLAY,3,sample_528A2,$2C8 dc.l COM_DELAY,$55 dc.l 0 lbC002666 dc.l COM_DELAY,$6B dc.l 0 lbC00267A dc.l COM_SET_VOL,0,$30 dc.l COM_SET_VOL,1,$30 dc.l COM_SET_VOL,2,$30 dc.l COM_SET_VOL,3,$30 dc.l COM_PLAY,0,sample_528A2,$164 dc.l COM_PLAY,1,sample_528A2,$2C8 dc.l COM_DELAY,$15 dc.l 0 lbC0026CA dc.l COM_PLAY,2,sample_528A2,$164 dc.l COM_PLAY,3,sample_528A2,$2C8 dc.l COM_DELAY,$55 dc.l 0 lbC0026FA dc.l COM_DELAY,$6B dc.l 0 lbC00270E dc.l COM_SET_VOL,0,$38 dc.l COM_SET_VOL,1,$38 dc.l COM_SET_VOL,2,$38 dc.l COM_SET_VOL,3,$38 dc.l COM_PLAY,0,sample_528A2,$164 dc.l COM_PLAY,1,sample_528A2,$2C8 dc.l COM_DELAY,$15 dc.l 0 lbC00275E dc.l COM_PLAY,2,sample_528A2,$164 dc.l COM_PLAY,3,sample_528A2,$2C8 dc.l COM_DELAY,$15 dc.l 0 lbC00278E dc.l COM_PLAY,0,sample_528A2,$164 dc.l COM_PLAY,1,sample_528A2,$2C8 dc.l COM_DELAY,$40 dc.l 0 lbC0027BE dc.l COM_DELAY,$6B dc.l 0 lbC0027D2 dc.l COM_SET_VOL,0,$40 dc.l COM_SET_VOL,1,$40 dc.l COM_SET_VOL,2,$40 dc.l COM_SET_VOL,3,$40 dc.l COM_PLAY,0,sample_528A2,$164 dc.l COM_PLAY,1,sample_528A2,$2C8 dc.l COM_DELAY,$15 dc.l 0 lbC002822 dc.l COM_PLAY,2,sample_528A2,$164 dc.l COM_PLAY,3,sample_528A2,$2C8 dc.l COM_DELAY,$15 dc.l 0 lbC002852 dc.l COM_PLAY,0,sample_528A2,$164 dc.l COM_PLAY,1,sample_528A2,$2C8 dc.l COM_DELAY,$40 dc.l 0 lbC002882 dc.l COM_DELAY,$6B dc.l 0 lbC002896 dc.l COM_SET_VOL,0,8 dc.l COM_SET_VOL,1,8 dc.l COM_PLAY,0,sample_2A672,$164 dc.l COM_PLAY,1,sample_2A672,$164 dc.l COM_DELAY,$6B dc.l 0 lbC0028D6 dc.l COM_SET_VOL,0,$10 dc.l COM_SET_VOL,1,$10 dc.l COM_PLAY,0,sample_2A672,$164 dc.l COM_PLAY,1,sample_2A672,$164 dc.l COM_DELAY,$6B dc.l 0 lbC002916 dc.l COM_SET_VOL,0,$18 dc.l COM_SET_VOL,1,$18 dc.l COM_PLAY,0,sample_2FB78,$164 dc.l COM_PLAY,1,sample_2FB78,$164 dc.l COM_DELAY,$6B dc.l 0 lbC002956 dc.l COM_SET_VOL,0,$20 dc.l COM_SET_VOL,1,$20 dc.l COM_PLAY,0,sample_2FB78,$164 dc.l COM_PLAY,1,sample_2FB78,$164 dc.l COM_DELAY,$6B dc.l 0 lbC002996 dc.l COM_SET_VOL,0,$28 dc.l COM_SET_VOL,1,$28 dc.l COM_PLAY,0,sample_3507E,$164 dc.l COM_PLAY,1,sample_3507E,$164 dc.l COM_DELAY,$6B dc.l 0 lbC0029D6 dc.l COM_SET_VOL,0,$30 dc.l COM_SET_VOL,1,$30 dc.l COM_PLAY,0,sample_3507E,$164 dc.l COM_PLAY,1,sample_3507E,$164 dc.l COM_DELAY,$6B dc.l 0 lbC002A16 dc.l COM_SET_VOL,0,$38 dc.l COM_SET_VOL,1,$38 dc.l COM_PLAY,0,sample_2A672,$164 dc.l COM_PLAY,1,sample_2A672,$164 dc.l COM_DELAY,$6B dc.l 0 lbC002A56 dc.l COM_SET_VOL,0,$40 dc.l COM_SET_VOL,1,$40 dc.l COM_PLAY,0,sample_2A672,$164 dc.l COM_PLAY,1,sample_2A672,$164 dc.l COM_DELAY,$6B dc.l 0 lbC002A96 dc.l COM_SET_VOL,0,$40 dc.l COM_SET_VOL,1,$2D dc.l COM_SET_VOL,2,$40 dc.l COM_SET_VOL,3,$40 dc.l COM_PLAY,0,sample_2A672,$164 dc.l COM_PLAY,2,sample_2A672,$164 dc.l COM_PLAY,1,sample_3FA8A,$254 dc.l COM_DELAY,$6B dc.l 0 lbC002B0C dc.l COM_PLAY,0,sample_2A672,$164 dc.l COM_PLAY,2,sample_2A672,$164 dc.l COM_DELAY,$6B dc.l 0 lbC002B3C dc.l COM_PLAY,0,sample_2FB78,$164 dc.l COM_PLAY,2,sample_2FB78,$164 dc.l COM_PLAY,1,sample_44390,$254 dc.l COM_DELAY,$6B dc.l 0 lbC002B7A dc.l COM_PLAY,0,sample_2FB78,$164 dc.l COM_PLAY,2,sample_2FB78,$164 dc.l COM_DELAY,$6B dc.l 0 lbC002BAA dc.l COM_PLAY,0,sample_3507E,$164 dc.l COM_PLAY,2,sample_3507E,$164 dc.l COM_PLAY,1,sample_48A96,$254 dc.l COM_DELAY,$6B dc.l 0 lbC002BE8 dc.l COM_PLAY,0,sample_3507E,$164 dc.l COM_PLAY,2,sample_3507E,$164 dc.l COM_DELAY,$6B dc.l 0 lbC002C18 dc.l COM_PLAY,0,sample_2A672,$164 dc.l COM_PLAY,2,sample_2A672,$164 dc.l COM_PLAY,1,sample_4E39C,$254 dc.l COM_DELAY,$6B dc.l 0 lbC002C56 dc.l COM_PLAY,0,sample_2A672,$164 dc.l COM_PLAY,2,sample_2A672,$164 dc.l COM_DELAY,$6B dc.l 0 lbC002C86 dc.l COM_SET_VOL,3,$28 dc.l COM_PLAY,3,sample_3A584,$164 dc.l COM_PLAY,0,sample_2A672,$164 dc.l COM_PLAY,2,sample_2A672,$164 dc.l COM_PLAY,1,sample_3FA8A,$254 dc.l COM_DELAY,$6B dc.l 0 lbC002CDA dc.l COM_PLAY,3,sample_3A584,$164 dc.l COM_PLAY,0,sample_2A672,$164 dc.l COM_PLAY,2,sample_2A672,$164 dc.l COM_DELAY,$6B dc.l 0 lbC002D18 dc.l COM_PLAY,3,sample_3A584,$164 dc.l COM_PLAY,0,sample_2FB78,$164 dc.l COM_PLAY,2,sample_2FB78,$164 dc.l COM_PLAY,1,sample_44390,$254 dc.l COM_DELAY,$6B dc.l 0 lbC002D64 dc.l COM_PLAY,3,sample_3A584,$164 dc.l COM_PLAY,0,sample_2FB78,$164 dc.l COM_PLAY,2,sample_2FB78,$164 dc.l COM_DELAY,$6B dc.l 0 lbC002DA2 dc.l COM_PLAY,3,sample_3A584,$164 dc.l COM_PLAY,0,sample_3507E,$164 dc.l COM_PLAY,2,sample_3507E,$164 dc.l COM_PLAY,1,sample_48A96,$254 dc.l COM_DELAY,$6B dc.l 0 lbC002DEE dc.l COM_PLAY,3,sample_3A584,$164 dc.l COM_PLAY,0,sample_3507E,$164 dc.l COM_PLAY,2,sample_3507E,$164 dc.l COM_DELAY,$6B dc.l 0 lbC002E2C dc.l COM_PLAY,3,sample_3A584,$164 dc.l COM_PLAY,0,sample_2A672,$164 dc.l COM_PLAY,2,sample_2A672,$164 dc.l COM_PLAY,1,sample_4E39C,$254 dc.l COM_DELAY,$6B dc.l 0 lbC002E78 dc.l COM_PLAY,3,sample_3A584,$164 dc.l COM_PLAY,0,sample_2A672,$164 dc.l COM_PLAY,2,sample_2A672,$164 dc.l COM_DELAY,$6B dc.l 0 lbC002EB6 dc.l COM_PLAY,0,sample_528A2,$164 dc.l COM_PLAY,1,sample_528A2,$164 dc.l COM_SET_VOL,3,$3C dc.l COM_SET_VOL,2,$3C dc.l COM_PLAY,3,sample_3A584,$164 dc.l COM_PLAY,2,sample_3A584,$164 dc.l COM_DELAY,$6B dc.l 0 lbC002F12 dc.l COM_SET_VOL,3,$32 dc.l COM_SET_VOL,2,$32 dc.l COM_PLAY,3,sample_3A584,$164 dc.l COM_PLAY,2,sample_3A584,$164 dc.l COM_DELAY,$6B dc.l 0 lbC002F52 dc.l COM_SET_VOL,3,$28 dc.l COM_SET_VOL,2,$28 dc.l COM_PLAY,3,sample_3A584,$164 dc.l COM_PLAY,2,sample_3A584,$164 dc.l COM_DELAY,$6B dc.l 0 lbC002F92 dc.l COM_SET_VOL,3,$1E dc.l COM_SET_VOL,2,$1E dc.l COM_PLAY,3,sample_3A584,$164 dc.l COM_PLAY,2,sample_3A584,$164 dc.l COM_DELAY,$6B dc.l 0 lbC002FD2 dc.l COM_SET_VOL,3,$14 dc.l COM_SET_VOL,2,$14 dc.l COM_PLAY,3,sample_3A584,$164 dc.l COM_PLAY,2,sample_3A584,$164 dc.l COM_DELAY,$6B dc.l 0 lbC003012 dc.l COM_SET_VOL,3,12 dc.l COM_SET_VOL,2,12 dc.l COM_PLAY,3,sample_3A584,$164 dc.l COM_PLAY,2,sample_3A584,$164 dc.l COM_DELAY,$6B dc.l 0 lbC003052 dc.l COM_SET_VOL,3,6 dc.l COM_SET_VOL,2,6 dc.l COM_PLAY,3,sample_3A584,$164 dc.l COM_PLAY,2,sample_3A584,$164 dc.l COM_DELAY,$6B dc.l 0 lbC003092 dc.l COM_SET_VOL,3,3 dc.l COM_SET_VOL,2,3 dc.l COM_PLAY,3,sample_3A584,$164 dc.l COM_PLAY,2,sample_3A584,$164 dc.l COM_DELAY,$6B dc.l 0 lbC0030D2 dc.l COM_SET_VOL,3,2 dc.l COM_SET_VOL,2,2 dc.l COM_PLAY,3,sample_3A584,$164 dc.l COM_PLAY,2,sample_3A584,$164 dc.l COM_SET_VOL,1,10 dc.l COM_PLAY,1,sample_13D60,$1BC dc.l COM_DELAY,$42E dc.l 0 dc.l COM_SONG_END section data,data_c sample_buf dcb.w $2A,0 dc 0 include samples.s end