*****************************************************************************
**                                                                         **
** Eagleripper: Jesper Olsen                                               **
**                                                                         **
** 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.
**
***************************************************************************** 


*-----------------------------------------------------------------------------*
*			      Eagleripper V1.0				      *
*				Jesper Olsen				      *
*-----------------------------------------------------------------------------*
Test	= 0
		incdir	include:
		include	misc/eagleplayerripper.i
		include	exec/exec_lib.i
			
	if	Test
	lea	data,a0
	*lea	JO_Tags,a0
	move.l	#datasize,d0
	move.l	a0,a5
	move.l	a0,a4
	move.l	d0,d4
	move.l	d0,d6
wait:	move.l	a5,a1
	move.l	a4,a0
	move.l	d4,d0
	move.l	(a1),d1
	bsr	JO_Ripp1
	tst.l	d0
	beq.s	.Ja
	addq.l	#2,a5
	subq.l	#2,d6
	blt.s	.Err
	btst	#6,$bfe001
	bne.s	wait
.err:	moveq	#-1,d0
.ret:	illegal

.ja:	move.l	d1,d0
	*bsr	GetModuleName
	bra.s	.Ret
	endc
		RIPPERHEADER	JO_Tags

	dc.b	"Jesper Olsen EagleRipper V1.0",10
	dc.b	"done by Eagleeye/DFT 28.08.97",0
	even

JO_Tags:	dc.l	RPT_Formatname,.Formatname
		dc.l	RPT_Ripp1,JO_Ripp1
		dc.l	RPT_RequestRipper,1
		dc.l	RPT_Version,1<<16!0
		dc.l	RPT_Creator,.Creator
		dc.l	RPT_Prefix,.Prefix
		dc.l	RPT_Playername,.Playername
		dc.l	0

.Creator:	dc.b	"Jesper Olsen, adapted by DEFECT",0
.Playername:
.Formatname:	dc.b	"Jesper Olsen",0
.Prefix:	dc.b	"JO.",0
		even

*-----------------------------------------------------------------------------*
* Input: a0=Adr (start of memory)
*	 d0=Size (size of memory)
*	 a1=current adr
*	 d1=(a1.l)
* Output:d0=Error oder NULL
*	 d1=Size
*	 a0=Startadr (data)
*-----------------------------------------------------------------------------*
JO_Ripp1:	lsr.l	#8,d1
		lsr.l	#8,d1
		cmp.w	#$6000,d1
		beq.s	.Ja
		rts

		*--- Jetzt testen, ob es ein korrektes Module sein kann ---*
.Ja:		cmp.w	#$6000,(a1)
		bne.w	.Return
		cmp.w	#$6000,4(a1)
		bne.s	.Return
		cmp.w	#$6000,8(a1)
		bne.s	.Return
		cmp.w	#$6000,12(a1)
		bne.s	.Return

		move.l	a1,d2
		sub.l	a0,d2
		sub.l	d2,d0				*max RestSize
		
		moveq	#0,d2

		*--- ersten Jump testen ---*
		move.w	2(a1),d2			;Offset negativ ?
		blt.s	.Return
		cmp.l	d0,d2
		bhi.s	.Return
		lea	2(a1,d2.w),a0
		cmp.l	#$2f0841fa,(a0)
		bne.s	.Return
		cmp.w	#$41fa,2(a0)
		bne.s	.Return

		*--- zweiten Jump testen ---*
		move.w	6(a1),d2			;Offset negativ ?
		blt.s	.Return
		cmp.l	d0,d2
		bhi.s	.Return
		lea	6(a1,d2.w),a0
		cmp.l	#$48e7fffe,(a0)
		bne.s	.Return

		*--- zweiten Jump testen ---*
		move.w	10(a1),d2			;Offset negativ ?
		blt.s	.Return
		cmp.l	d0,d2
		bhi.s	.Return
		lea	10(a1,d2.w),a0
		cmp.l	#$48e7fffe,(a0)
		bne.s	.Return
		cmp.w	#$4dfa,4(a0)
		beq.s	.Ja2
		cmp.w	#$41fa,4(a0)
		bne.s	.Return
.Ja2:		move.l	a1,a0
		moveq	#0,d0
		moveq	#-1,d1
.Return:	rts




	if	test
data:		incdir	"Modules:Verschiedenes/"
	*	ds.b	200

		*incbin	"JO.Guldkorn_Ingame"
		incbin	"JO.Guldkorn_Intro"

datasize	= *-data
	endc


*$2f08
