*****************************************************************************
**                                                                         **
** Noiseconverter: ProRunner 2.0, IFT Protected                            **
**                                                                         **
** Project: Eagleplayer 2.04                                               **
** Authors: Jan Blumenthal & Henryk Richter                                **
** 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.
**
***************************************************************************** 

	opt	p-

	output	dh1:musik_tools/eagleplayer/engines/noiseconverters/Infect

*-----------------------------------------------------------------------------*
*			Noiseconverter V1.0				      *
*-----------------------------------------------------------------------------*

			include	EP/eagleplayerconverter.i
			include	exec/exec_lib.i
			
	CONVERTERHEADER	TAGS

	dc.b	"Noiseconverter-IFT V1.0",10
	dc.b	"done by Promax 14.03.98",0
	even

Tags:		dc.l	CV_Convertername,Convertername
		dc.l	CV_Convert,Convert
		dc.l	CV_RequestConverter,1
		dc.l	CV_Version,1<<16!0
		dc.l	CV_Creator,Creator
		dc.l	0


Creator:	dc.b	"Infect, adapted by Promax",0
Convertername:	dc.b	"Infect",0
Formatname:	dc.b	"ProRunner 2.0 IFT Protected",0
		even

*-----------------------------------------------------------------------------*
* Input: a0=Adr der Datei
*	 d0=Size der Datei
* Output:d0=ConvertSize oder NULL
*	 d1=Flags
*	 d2=Memsize
*	 a0=ConvertAdr
*	 a1=Formatname
*	 a2=SamplePtr (für Protrackerclones) oder NULL
Convert:	move.l	a0,a3
		cmp.l	#"IFT!",(a3)
		bne.s	.Error
		move.l	d0,d4
		move.l	#$10001,d1
		add.l	#SecurityMem,d0			;Memdrauf muss sein!!!
		move.l	4,a6
		jsr	_LVOAllocMem(a6)
		tst.l	d0
		beq.s	.Error
		move.l	d0,a4
		move.l	d0,a1
		move.l	d4,d1
.CopyIt:	move.b	(a3)+,(a1)+
		subq.l	#1,d1
		bne.s	.CopyIt
		move.l	a4,a0
		move.l	#"SNT!",(a4)
		move.l	d4,d0
		move.l	d4,d2
		add.l	#SecurityMem,d2
		moveq	#0,d1
		sub.l	a2,a2
		lea	Formatname(pc),a1
		tst.l	d0
		rts

.Error:		moveq	#0,d0
		rts

