***
*** NAME:	Powertracker Custom Module v1.51
***
*** AUTHOR:	Original replay + music by Laxity of Kefrens.
***		(His current handle is Merge of Polka Brothers)
*** 		Resourced and Deli-adapted by [·M·n·O·] (Lasse Jari Hansen).
***
*** E-MAIL:	ljh@sigma.ou.dk
***
*** VERSION:	19-Nov-96 : 1. Aminet release
***		17-Nov-96 : Added CacheClearU()
***		17-Oct-96 : Deli-adaption
***		       9? : Resourcing and Stinger-adaption
***
*** INFO:	Originally used in the two Kefrens intros
***		"Inspiration is Gone" and "Graphics is Gone".
***
***		Actually it contains 2 different modules, accessible
***		as subsongs. Modules were composed in Powertracker.
***
***		Deli-release handles volume.
***
***		Source released for educational purposes.
***		Feel free to contact me for bug reports or help.
***
***		This is freely distributable: you can do with it
***		what you want - as long as you e-mail me the changes!
***

		incdir	"Include:"
		include	"misc/DeliPlayer.i"
		include "exec/exec_lib.i"

		incdir	"WORK:Aminet/Powertracker/Source/"


		SECTION Player,Code

		PLAYERHEADER PlayerTagArray

		dc.b '$VER: Powertracker modules by Laxity/Kefrens - '
		dc.b 'used in "Inspiration is Gone" and '
		dc.b '"Graphics is Gone". '
		dc.b 'Ripped and adapted by [·M·n·O·]. '
		dc.b 'Version 1.51 '
		dc.b 'Saturday 16-Nov-96 21:16:18.',0
		even

PlayerTagArray	dc.l	DTP_CustomPlayer,1
		dc.l	DTP_Interrupt,play_music
		dc.l	DTP_InitPlayer,InitPlayer
		dc.l	DTP_EndPlayer,EndPlayer
		dc.l	DTP_InitSound,init_music
		dc.l	DTP_EndSound,end_music
		dc.l	DTP_DeliBase,DELI_base

		dc.l	DTP_Volume,po_SetVol
		dc.l	DTP_SubSongRange,po_SubSong
		dc.l	DTP_NextSong,po_NextSong
		dc.l	DTP_PrevSong,po_PrevSong
		dc.l	TAG_DONE

*-----------------------------------------------------------------------*

InitPlayer	move.l	dtg_AudioAlloc(a5),a0
		jsr	(a0)
		rts

EndPlayer	move.l	dtg_AudioFree(a5),a0
		jsr	(a0)
		rts

*-----------------------------------------------------------------------*

init_music	movem.l	d0-a6,-(sp)
		clr	song
		lea	po_data(pc),a0
		move.l	#MOD_1,(a0)
		bsr	po_init
		move.l	$4,a6
		jsr	_LVOCacheClearU(a6)
		movem.l	(sp)+,d0-a6
		rts

play_music	movem.l	d0-a6,-(sp)
		move.l	$4,a6
		jsr	_LVOCacheClearU(a6)
		bsr	po_music
		movem.l	(sp)+,d0-a6
		rts

end_music	movem.l	d0-a6,-(sp)
		moveq	#0,d0
		lea	$dff000,a0
		move	d0,$a8(a0)
		move	d0,$b8(a0)
		move	d0,$c8(a0)
		move	d0,$d8(a0)
		move	#$f,$96(a0)
		movem.l	(sp)+,d0-a6
		rts

po_waitdma	movem.l	d0-a6,-(sp)
		move.l	DELI_Base(pc),a0
		move.l	dtg_WaitAudioDMA(a0),a0
		jsr	(a0)
		movem.l	(sp)+,d0-a6
		rts

po_SetVol	lea	po_myvol(pc),a0
		move	dtg_SndVol(a5),(a0)
		rts

po_SubSong	moveq	#0,d0			; min.
		moveq	#1,d1			; max.
		rts

po_NextSong	movem.l	d0-a6,-(sp)
		tst	song
		bne.s	.nope
		st	song
		lea	po_data(pc),a0
		move.l	#MOD_2,(a0)
		bsr	po_init
.nope		movem.l	(sp)+,d0-a6
		rts

po_PrevSong	movem.l	d0-a6,-(sp)
		tst	song
		beq.s	.nope
		sf	song
		lea	po_data(pc),a0
		move.l	#MOD_1,(a0)
		bsr	po_init
.nope		movem.l	(sp)+,d0-a6
		rts

*-----------------------------------------------------------------------*

DELI_base	dc.l	0
song		dc	0

		include powt.rep.asm


		section	MODDY,data_c

mod_1		incbin	powt.Kefrens
		dcb.l	8,0
mod_2		incbin	powt.Kefrens.2
		dcb.l	8,0

		even
