*****************************************************************************
**                                                                         **
** Eagleripper: Future Composer V1.0                                       **
**                                                                         **
** Project: Eagleplayer 2.04                                               **
** Authors: Promax                                                         **
** Start  : 1993/01/09                                                     **
** $Header$                                                                **
**                                                                         **
*****************************************************************************
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program (See the included file COPYING);
** if not, write to the Free Software Foundation, Inc.,
** 675 Mass Ave, Cambridge, MA 02139, USA.
**
***************************************************************************** 


 ***************************************************************************
 *                                                                         *
 * EaglePlayer Future Composer Ripper Engine V1.0 by Promax (c) 1998       *
 *                                                                         *
 ***************************************************************************

*		opt	p-
		
*	output	dh1:musik_tools/eagleplayer/engines/eaglerippers/FutureComposer

	
		incdir	include:
		include	misc/eagleplayerripper.i
		include	exec/exec_lib.i

		Section	FC_Ripper,Code

		RIPPERHEADER	Fc13_Tags

		dc.b	"Eagleripper-Future Composer Ripper V1.0",$a
		dc.b	"done by Promax 05.02.98",0
		even

FC13_Tags:	dc.l	RPT_Formatname,.Formatname
		dc.l	RPT_Ripp1,FC13_Ripp
		dc.l	RPT_RequestRipper,1
		dc.l	RPT_Version,1<<16!0
		dc.l	RPT_Creator,.Creator
		dc.l	RPT_GetModuleName,GetModuleName
		dc.l	RPT_Playername,.Playername
		dc.l	RPT_Prefix,.Prefix
		dc.l	RPT_Next,.FC14_Tags	
		dc.l	0

.Creator:	dc.b	"SuperSero of Superions, adapted by Defect Softworks & Promax",0
.Formatname:	dc.b	"Future Composer 1.3",0
.Playername:	dc.b	"Future Composer 1.3",0
.Prefix:	dc.b	"FC13.",0
		even

.FC14_Tags:	dc.l	RPT_Formatname,.FC14Format
		dc.l	RPT_Ripp1,FC14_Ripp
		dc.l	RPT_RequestRipper,1
		dc.l	RPT_Version,1<<16!0
		dc.l	RPT_Creator,.Creator
		dc.l	RPT_GetModuleName,GetModuleName
		dc.l	RPT_Playername,.FC14Player
		dc.l	RPT_Prefix,.FC14Prefix
		dc.l	0

.Fc14Format:	dc.b	"Future Composer 1.4",0
.FC14Player:	dc.b	"Future Composer 1.4",0
.FC14Prefix:	dc.b	"FC14.",0
		even

FC13_SongLen	equ	32
Fc13_SampleLen	equ	36

FC13_Ripp:	cmp.l	#$534d4f44,d1			;SMOD
		beq.s	.ok
		rts

.OK:		bsr.s	FC13RipStart
		rts

FC14_Ripp:	cmp.l	#$46433134,d1			;FC1.4
		beq.s	.ok
		rts

.OK:		bsr.s	FC14RipStart
		rts

FC13RipStart:	movem.l	d2-d7/a2-a6,-(sp)
		move.l  a1,a0
		moveq   #0,d0
		lea	Data(pc),a4
		move.l	a0,FC_Module-Data(a4)
		cmp.l	#$534d4f44,(a0)
		bne.w	.error

		move.l	FC_Module-Data(a4),d0
		beq.w	.error

		move.l	d0,a0
		move.l	FC13_SongLen(a0),d1
		move.l	FC13_SampleLen(a0),d3

		; Module Size

		add.l	d3,d1
		move.l	d1,FC_RipSize-Data(a4)	

		; fertig

		move.l	FC_RipSize-Data(a4),d1	
		move.l  FC_Module-Data(a4),a0
		moveq	#0,d0
.out		movem.l	(sp)+,d2-d7/a2-a6
		rts
.error		moveq	#-1,d0
		movem.l	(sp)+,d2-d7/a2-a6
		rts

FC14RipStart:	movem.l	d2-d7/a2-a6,-(sp)
		move.l  a1,a0
		moveq   #0,d0
		lea	Data(pc),a4
		move.l	a0,FC_Module-Data(a4)
		cmp.l	#$46433134,(a0)
		bne.w	.error

		move.l	FC_Module-Data(a4),d0
		beq.w	.error
	
		move.l	d0,a0		
		
		move.l	$24(a0),FC_RipSize-Data(a4)	;SongSize

		moveq	#0,d3
		moveq	#0,d2
		moveq	#80-1,d1			;max. 80 Synth's
		moveq	#100,d0				;max. 100 Samples
.ScanLoop
		move.b	(a0,d0.l),d2
		add.l	d2,d3
		addq.l	#1,d0
		dbra	d1,.ScanLoop
	
		add.l	d3,d3				;SampleSize
		add.l	d3,FC_RipSize-Data(a4)
	
		; fertig

		move.l	FC_RipSize-Data(a4),d1
		move.l  FC_Module-Data(a4),a0
		moveq	#0,d0
.out		movem.l	(sp)+,d2-d7/a2-a6
		rts
.error		moveq	#-1,d0
		movem.l	(sp)+,d2-d7/a2-a6
		rts

GetModuleName:	lea	Data,a2
		moveq	#0,d0
		move.l	FC_ModuleName-Data(a2),d0
		rts

Data:
FC_Module	dc.l	0
FC_ModuleName	dc.l	0
FC_RipSize	dc.l	0
		even

