;-------------------T---------T--------------------------T
	INCDIR	"Code:Asm/Include/"
	INCLUDE	"misc/DeliPlayer.i"

	SECTION	"BubbleBobble",code

** --
** -- Player header
** --
	PLAYERHEADER PlayerTagArray

** --
** -- Version string
** --
	dc.b '$VER: Bubble Bobble music V1.0 (18.07.93)',0
	EVEN

** --
** -- Tag array
** --
PlayerTagArray:	dc.l	DTP_CustomPlayer,1	;It's a customplayer

	dc.l	DTP_InitPlayer,DW_InitPlayer
	dc.l	DTP_EndPlayer,DW_EndPlayer

	dc.l	DTP_InitSound,DW_InitSong
	dc.l	DTP_Interrupt,DW_PlaySong
	dc.l	DTP_EndSound,DW_EndSong

	dc.l	DTP_NextSong,DW_NextSong
	dc.l	DTP_PrevSong,DW_PrevSong

	dc.l	TAG_DONE

** --
** -- Init the player
** --
DW_InitPlayer:	move.w	#2,dtg_SndNum(a5)
	move.l	dtg_AudioAlloc(a5),a0
	jmp	(a0)

** --
** -- End the player
** --
DW_EndPlayer:	move.l	dtg_AudioFree(a5),a0
	jmp	(a0)

** --
** -- Init song
** --
DW_InitSong:	movem.l	d0-a6,-(sp)
	clr.b	DW_Module+$9A4
	moveq	#0,d0
	move.w	dtg_SndNum(a5),d0
	jsr	DW_Module+$442
	movem.l	(sp)+,d0-a6

	move.w	#$376C,dtg_Timer(a5)
	move.l	dtg_SetTimer(a5),a0
	jsr	(a0)
	rts

** --
** -- Play song
** --
DW_PlaySong:	movem.l	d0-a6,-(sp)
	jsr	DW_Module+$5B8
	movem.l	(sp)+,d0-a6
	rts

** --
** -- End song
** --
DW_EndSong:	movem.l	d0-a6,-(sp)
	jsr	DW_Module+$52E
	movem.l	(sp)+,d0-a6
	rts

** --
** -- Previous song
** --
DW_PrevSong:	tst.w	dtg_SndNum(a5)
	beq.b	.end
	move.l	dtg_StopInt(a5),a0
	jsr	(a0)
	subq.w	#1,dtg_SndNum(a5)
	bsr	DW_InitSong
	move.l	dtg_StartInt(a5),a0
	jsr	(a0)
.end	rts

** --
** -- Next song
** --
DW_NextSong:	cmp.w	#10,dtg_SndNum(a5)
	beq.b	.end
	move.l	dtg_StopInt(a5),a0
	jsr	(a0)
	addq.w	#1,dtg_SndNum(a5)
	bsr	DW_InitSong
	move.l	dtg_StartInt(a5),a0
	jsr	(a0)
.end	rts

** --
** -- Module
** --
	SECTION	Music,data_c
	INCDIR	"Code:Asm/Sources/Slammer/Experiments/"
DW_Module:	INCBIN	"DWOLD.BubbleBobble"
