;----------------------------------------------------------
;	Test of my removelink.library (ver 32.020)
;	Shows the viruses the current version of
;	removelink.library can handle...
;	ps.
;
;	This field (VirusList struct) is changed to,
;	APTR	VL_VirusName1
;	APTR	VL_VirusName2
;	APTR	VL_VirusName3
;	etc.
;	ULONG	NULL	<= End of struct
;
;				/Johan
;----------------------------------------------------------

	
	incdir	df0:include/
	include	exec/exec_lib.i		;Normal includes
	include	exec/libraries.i	;Normal includes
	include	exec/memory.i		;Normal includes
	include	libraries/dos_lib.i	;Normal includes
	include	libraries/dos.i		;Normal includes

	incdir	df0:include/
	include	RLL/removelink.i
	include	RLL/removelink_lib.i

CALL	Macro
	jsr	_LVO\1(a6)
	endm

s:	move.l	4.w,a6
	moveq.l	#32,d0
	lea.l	RLLib(pc),a1
	CALL	OpenLibrary
	move.l	d0,RLBase
	beq.b	.RLError

	lea.l	DosLib(pc),a1
	CALL	OldOpenLibrary
	move.l	d0,DosBase
	beq.b	.DosError

	move.l	RLBase(pc),a6
	CALL	AllocRLMem
				;Now we want to have the initiaized
				;buffer memory (with the virus-namelist)
	tst.l	d0
	beq.b	.RLError
	move.l	d0,MemTable

	move.l	MemTable(pc),a0
	move.w	RL_VirusesCovered(a0),-(sp)
	move.l	RLBase(pc),a6
	move.w	LIB_ReVision(a6),-(sp)
	move.w	LIB_Version(a6),-(sp)
	pea.l	Start(pc)
	bsr.b	printf
	lea.l	10(Sp),Sp

	move.l	RLBase(pc),a6
	move.l	MemTable(pc),a0
	beq.b	.RLError
	move.l	RL_VirusList(a0),a0

.Again:	move.l	VL_VirusName(a0),-(sp)
	pea.l	VirusName(pc)
	bsr.b	PrintF
	addq.l	#8,Sp
	lea.l	VL_NextVirusName(a0),a0
	tst.l	(a0)
	bne.b	.Again

.Free:	move.l	MemTable(pc),a0
	CALL	FreeRLMem

	;Close RemoveLink library

.RLError:
	move.l	RLBase(pc),a1
	beq.b	.NotLoaded
	move.l	4.w,a6
	CALL	CloseLibrary
.NotLoaded:
.DosError:
	move.l	DosBase(pc),a1
	beq.b	.Rts
	move.l	4.w,a6
	CALL	CloseLibrary
.Rts:	rts

	;Quit
	

printF:
	movem.l	d0-a6,-(Sp)
	move.l	4.w,a6
	move.l	15*4+4*1(Sp),a0
	lea.l	15*4+4*2(Sp),a1	
	lea.l	.SubPrintF(pc),a2
	link	a5,#-512
	move.l	a5,a3
	lea.l	-512(a3),a3
	CALL	RawDoFMT
	movem.l	d0-a6,-(sp)
	lea.l	-512(a5),a5
	move.l	DosBase(pc),a6
	jsr	-60(a6)
	move.l	d0,d1
	move.l	a5,d2
.1:	tst.b	(a5)+
	bne.b	.1
	move.l	a5,d3
	sub.l	d2,d3
	jsr	-48(a6)
	movem.l	(Sp)+,d0-a6

	unlk	a5
	movem.l	(Sp)+,d0-a6
	rts

.SubPrintF:
	move.b	d0,(a3)+
	rts

RLLib:		dc.b	'removelink.library',0
DosLib:		dc.b	'dos.library',0
Start:		dc.b	'Viruses the ''removelink.library'' version '
		dc.b	'%d.%d can remove:',10
		dc.b	'(Totally a number of %d viruses)',10,0
VirusName:	dc.b	'%30s ',10,0
		even

RLBase:		dc.l	0
MemTable:	dc.l	0
DosBase:	dc.l	0
