	include 'Killer.incl'


	moveq	#0,d2
	subq.w	#1,d0
args	move.b	(a0)+,d1		; Argument-Auswertung
	cmp.b	#$40,d1
	bls.s	narg
	and.w	#$1f,d1
	bset	d1,d2
narg	dbf	d0,args
	lea	Options(pc),a0
	move.l	d2,(a0)

	move.l	4,a6			; ExecBase
	lea	trddev(pc),a1		; 'trackdisk.device'
	lea	350(a6),a0		; Device-List
	call	FindName
	lea	TDBase(pc),a0
	move.l	d0,(a0)
	lea	DosName(pc),a1		; dos.library
	call	OldOpenLibrary
	lea	DosBase(pc),a0
	move.l	d0,(a0)
	move.l	d0,a6			; DosBase
	call	Output
	lea	stdout(pc),a0
	move.l	d0,(a0)
	lea	vers(pc),a0		; Titel
	bsr	output
	lea	Autor(pc),a0
	bsr	output
	move.l	Std(pc),d7
	lea	550(a6),a5
	move.l	(a5),a3			; KickTagPtr
	move.l	42(a6),d5		; ColdCapture
	move.l	46(a6),d6		; CoolCapture
	bne.s	memtest
	tst.l	d5
	bne.s	memtest
	tst.l	(a5)
	beq	ok			; kein resetfestes Programm im Speicher
memtest 				; testet, welcher Virus im Speicher ist
	cmp.l	#$7ec3e,d6		; SCA-Virus
	bne.s	nsca
	move.l	$7efde,d0		; ist DoIO verändert ?
	beq.s	sca1			; nein	->
	move.l	d0,-454(a6)		; normale DoIO-Funktion einsetzen
sca1	vircool SCA_Clones
nsca	move.w	148(a6),d0		; VBlank-Interrupt.iv_code
	and.w	#$00f0,d0		; zeigt ins ROM ?
	cmp.w	#$00f0,d0
	beq.s	nbb			; sonst ByteBandit-Virus
	move.l	148(a6),a0
	suba.w	#$2ca,a0
	cmp.l	(a0),d7			; ist es wirklich ByteBandit ?
	bne.s	nbb			; sonst verzweige
	move.l	$3da(a0),148(a6)	; VBlank-Interrupt rücksetzen
	move.l	TDBase(pc),a1
	move.l	$3d6(a0),-28(a1)	; BeginIO-Funktion rücksetzen
	virres	ByteBandit
nbb	cmp.l	#$7f94c,a3		; ByteWarrior
	bne.s	nbw
	move.l	#$fc06dc,-454(a6)	; DoIO-Funktion rücksetzen
	virres	ByteWarrior
nbw	cmp.l	#$7ec0e,d6		; NorthStar-Antivirus
	bne.s	nns
	cmp.l	#$52495050,$7ec16	; Ripper-Virus
	beq.s	1$
	vircool NorthStar
1$	vircool	Ripper
nns	lea	-$420(a3),a0
	move.w	#$107,d0
1$	cmp.l	(a0)+,d7
	dbeq	d0,1$
	bne.s	nsz
	move.l	(a0),d1
	bclr.l	#21,d1			; 2. Buchst. toupper
	cmp.l	#$50564c2e,d1
	bne.s	1$
	clr.l	(a0)
	virres	System_Z
nsz	cmp.l	#$7fb4c,d6		; Pentagon Circle Virusslayer
	bne.s	npc
	vircool Pentagon
npc	cmp.l	#$7e656,d6		; Warhawk
	bne.s	nwh
	vircool	Warhawk
nwh	cmp.l	#$7e060,d6		; Revenge-Virus
	bne.s	nrev
	move.l	$7e068,-454(a6)		; DoIO rücksetzen
	move.l	$7e06e,148(a6)		; VBlank-IRQ rücksetzen
	vircool Revenge
nrev	cmp.l	#$7fc24,a3		; Gadaffi-Virus
	bne.s	ngad
	move.l	#$fc06dc,-454(a6)	; DoIO rücksetzen
	bsr	KillRes
	vircool Gadaffi
ngad	move.l	d5,a0			; Disk-Doktors-Virus
	cmp.l	-$25c(a0),d7		; 'DOS'
	bne.s	ncrr
	lea	clpdev(pc),a1		; clipboard.device
	call	FindTask
	tst.l	d0
	beq.s	ncrr
	move.l	d0,-(a7)
	call	Disable
	move.l	(a7),a1			; Task
	call	RemTask
	move.l	#$fc06dc,-454(a6)	; DoIO rücksetzen
	move.w	148(a6),d0		; VBlank-Interrupt
	cmp.w	#$fc,d0 		; verändert ?
	bge.s	crrvb			; nein	->
	move.l	#$fc12fc,148(a6)
crrvb	move.l	(a7)+,a1
	suba.w	#$40a,a1
	move.l	#$7d0,d0
	call	FreeMem
	call	Enable
	moveq	#0,d5
	move.l	d5,42(a6)		; ColdCapture löschen
	vircool DiskDoktors
ncrr	cmp.l	#$7f300,a3		; ASS-Virus
	bne.s	nass
	virres	ASS
nass	cmp.l	#$7ec74,d6		; Phantasmumble
	bne.s	nphm
* Der folgende Programmteil ist von VirusX gestohlen.
* Er sollte noch verbessert werden!
; ha, ha, here's nothing!!
* Ende des gestohlenen Teils
	vircool Phantasmumble
nphm	cmp.l	#$7ec64,d6		; HCS
	bne.s	nhcs
* Der folgende Programmteil ist von VirusX gestohlen.
* Er sollte noch verbessert werden!
	move.l	$7ef9c,-454(a6)
* Ende des gestohlenen Teils
	vircool HCS
nhcs	cmp.l	#$7ed36,d6		; UltraFox
	bne.s	nuf
* Der folgende Programmteil ist von VirusX gestohlen.
* Er sollte noch verbessert werden!
	cmp.w	#7,-454(a6)
	bne.s	uf1
	move.l	$7eb38,-454(a6)
uf1
* Ende des gestohlenen Teils
	vircool UltraFox
nuf	move.l	d6,d0			; VKill 1.0
	sub.l	58(a6),d0
	cmp.l	#$82,d0
	bne.s	nvk1
	move.l	58(a6),a0
	move.l	286(a0),-364(a6)	; PutMsg rücksetzen
	vircool VKill_1_0
nvk1	moveq	#$6c,d1
	cmp.l	d1,d0			; Obelisk ?
	bne.s	nob
	move.l	58(a6),a0
	lea	$b0(a0),a0
	tst.l	(a0)			; DoIO verändert ?
	beq.s	ob1
	move.l	(a0),-454(a6)		; DoIO rücksetzen
ob1	vircool Obelisk
nob	cmp.l	-$40e(a3),d7		; Obelisk2 ?
	bne.s	nob2
	move.l	-4(a3),148(a6)
	move.l	TDBase(pc),a1
	move.l	-8(a3),-28(a1)
	move.l	-12(a3),a1
	move.l	#$400,d0
	call	FreeMem
	virres	Obelisk2
nob2	cmp.l	#$7faa8,d6		; Suntronic
	bne.s	nst
	move.l	#$fc06dc,-454(a6)	; DoIO rücksetzen (Kick 1.2)
	vircool Suntronic
nst	lea	-$3f4(a3),a1		; Joshua
	cmp.l	(a1),d7			; 'DOS'
	bne.s	njo
	move.l	TDBase(pc),a0
	move.l	$3e8(a1),-28(a0)	; BeginIO rücksetzen
	move.l	$3ec(a1),148(a6)	; VB-IRQ rücksetzen
	clr.l	546(a6)			; KickMemPtr
	move.l	#$4f2,d0
	call	FreeMem
	virres	Joshua
njo	cmp.l	#$6100fd24,-$24(a3)	; IRQ ?
	bne.s	nirq
	move.l	-406(a6),a0
	move.l	18(a0),-406(a6)		; OldOpenLibrary rücksetzen
	lea	-$3c6(a0),a1
	move.l	#$42c,d0
	call	FreeMem
	virres	IRQ
nirq	move.l	(a3),a1			; Jeff
	move.l	22(a1),a1
	cmp.l	#$4e714e71,(a1)
	bne.s	njeff
	move.l	$b1e-$068(a1),-454(a6)
	virres	Jeff
njeff	cmp.l	#$7ec42,d6		; SuperBoy
	bne.s	nsb
	move.l	$7edd0,d0
	beq.s	1$
	move.l	d0,-454(a6)		; DoIO rücksetzen
1$	vircool	SuperBoy
nsb	cmp.l	#$7fe00,a3		; Smily Cancer-Virus
	bne.s	nsc
	move.l	$7fdf0,-610(a6)		; KickSumData rücksetzen
	move.l	TDBase(pc),a1
	move.l	$7fdf4,-28(a1)		; BeginIO rücksetzen
	move.l	$7fdf8,a1
	move.l	#$200,d0
	call	FreeMem
	virres	Smily_Cancer
nsc




	move.l	(a3),a1
	move.l	14(a1),a1		; Resident->Name
	lea	LamerEX(pc),a0
	bsr	strcmp
	cmp.w	#22,d0
	bls.s	nlm
	lea	-18(a3),a0
	cmpi.w	#$abcd,(a0)+
	bne.s	lm1
	moveq	#Lamer2,d0
	bra.s	lm2
lm1	cmpi.w	#$abcd,(a0)+
	bne.s	lm3
	moveq	#Lamer1,d0
lm2	move.l	d0,-(a7)
	move.l	(a0)+,-610(a6)		; KickSumData-Funktion  rücksetzen
	move.l	TDBase(pc),a1
	move.l	(a0)+,-28(a1)		; BeginIO-Funktion rücksetzen
	move.l	(a0),a1
	bsr.s	FreeLamerMem
	move.l	(a7)+,d0
	bra	vim
lm3	cmp.l	#$b3beb2bb,-$46(a3)
	bne.s	lmunk
	move.l	-18(a3),-610(a6)	; KickSumData-Funktion  rücksetzen
	move.l	TDBase(pc),a1
	move.l	-14(a3),-28(a1)		; BeginIO-Funktion rücksetzen
	move.l	-6(a3),a1
	bsr.s	FreeLamerMem
	virus	Lamer3
lmunk	virus	Unknown
FreeLamerMem
	move.l	#1024,d0
	call	FreeMem
	bra	KillRes
nlm	lea	clist(pc),a0		; Revenge of the LAMER Exterminator
	bsr	strcmp
	bne	nrlm
	cmp.l	-$410(a3),d7		; CList-Virus
	bne.s	rlm
	lea	timedev(pc),a1		; 'timer.device'
	lea	350(a6),a0		; Device-List
	call	FindName
	move.l	d0,a1
	move.l	-4(a3),-28(a1)		; BeginIO (timer) rücksetzen
	move.l	TDBase(pc),a1
	move.l	-12(a3),-28(a1)		; BeginIO rücksetzen
	move.l	-16(a3),a1
	move.l	#$400,d0
	call	FreeMem
	lea	-$410(a3),a1
	move.l	#$448,d0
	call	FreeMem
	virres	CList
rlm	lea	-98(a3),a4
	move.l	(a4)+,-610(a6)		; KickSumData rücksetzten
	move.l	(a4)+,-214(a6)		; AvailMem rücksetzen
	move.l	144(a6),a1
	move.l	(a1),a1
	move.l	(a4)+,18(a1)		; VB-IRQ rücksetzen
	adda.w	#12,a4			; OpenWindow, DoIO, CloseDevice
	move.l	TDBase(pc),a1
	move.l	(a4)+,-28(a1)		; BeginIO rücksetzen
	addq.l	#8,a4
	move.l	(a4)+,a1
	move.l	#$12c0,d0
	call	FreeMem
	addq.l	#6,a4
	move.l	(a4)+,a1
	move.l	#1024,d0
	call	FreeMem
	virres	RevengeLAMER
nrlm	lea	ttv1(pc),a0		; Terrorists, BGS9
	bsr	strcmp
	bne.s	nbgs
	move.l	(a3),a0
	move.b	11(a0),d0
	move.w	d0,-(a7)
	clr.l	546(a6)			; KickMemPtr
	bsr	KillRes
	move.w	(a7)+,d0
	subq.b	#1,d0
	beq.s	terr
	subq.b	#1,d0
	beq.s	bgs
	virus	Unknown
terr	virus	Terrorists
bgs	virus	BGS9
nbgs	lea	MCAnam(pc),a0		; MCA-Virus
	bsr	strcmp
	bne.s	nMCA
	move.l	$11c-$2d8(a3),$68	; Level-2-IRQ rücksetzen
	move.l	TDBase(pc),a1
	lea	$19c-$2d8(a3),a0
	cmp.l	-28(a1),a0
	bne.s	mca1
	move.l	$28c-$2d8(a3),-28(a1)
mca1	bsr	KillRes
	moveq	#0,d5
	move.l	d5,42(a6)		; ColdCapture löschen
	vircool MCA
nMCA	lea	vers(pc),a0		; ACT-Viruskiller
	bsr	strcmp
	cmp.w	#13,d0
	bhi	ACTf			; schon im Speicher ->
	lea	asdgdev(pc),a0		; asdg.vdisk.device
	bsr	strcmp
	beq.s	rrd
	lea	raddev(pc),a0		; ramdrive.device
	bsr	strcmp
	bne.s	unkm
rrd	bsr	NextRes
	lea	rad(pc),a0
	bsr	output
	bra	ok2
unkm	lea	unkmem(pc),a0		; unbekanntes resetfestes Programm
	bsr	output
	tst.l	d5
	beq.s	uncld
	lea	unkcold(pc),a0
	bsr	output
	moveq	#0,d5
	move.l	Options(pc),d4
	btst	#3,d4			; Option C
	bne.s	uncld
	move.l	d5,42(a6)		; ColdCapture löschen
uncld	tst.l	d6
	beq.s	uncol
	lea	unkcool(pc),a0
	bsr	output
	moveq	#0,d6
	btst	#3,d4			; Option C
	bne.s	uncol
	move.l	d6,46(a6)
uncol	bsr	ChkSum
	tst.l	(a5)
	beq.s	ok3
	move.l	(a3),a0
	tst.l	14(a0)
	beq.s	unnon
	move.l	a0,-(a7)
	lea	unkname(pc),a0
	bsr	output
	move.l	(a7)+,a0
	move.l	14(a0),a0
	bsr	output
	lea	unkname2(pc),a0
	bsr	output
	bra.s	unkr
unnon	lea	unknoname(pc),a0
	bsr	output
unkr	btst	#5,Options+1(pc)	; -> 21 = U
	bne.s	unkr2
	bsr	KillRes
	bra.s	ok2
unkr2	bsr	NextRes
	bra.s	ok2
ok	lea	nomem(pc),a0
	bsr	output
ok2					; noch	ein Virus ?
	tst.l	d5			; ColdCapture
	bne	memtest
	tst.l	d6			; CoolCapture
	bne	memtest
	tst.l	(a5)			; KickTagPtr
	bne	memtest
ok3


* Test auf Traveling Jack-Virus
	move.l	DosBase(pc),a0
	move.l	46(a0),a1		; A5
	cmp.l	#$48e7fffe,(a1)
	bne.s	ntj
	move.l	$7a8-$152(a1),46(a0)	; Dos-Entry rücksetzen
	virus	Jack
ntj
	moveq	#0,d1
	move.l	#ende-resident,d0
	call	AllocMem
	move.l	d0,a3
	beq	error
	move.l	TDBase(pc),a2
	lea	io(pc),a0
	move.l	-28(a2),(a0)		; Adresse der echten BeginIO speichern
	lea	ksd(pc),a0
	move.l	-610(a6),(a0)		; KickSumData speichern
	lea	WT(pc),a0
	move.l	-316(a6),(a0)		; Wait speichern
	move.l	DosBase(pc),a2
	move.l	38(a2),a2		; GlobalVektor
	lea	oLS(pc),a0
	move.l	324(a2),(a0)		; LoadSeg speichern
	move.l	a3,a1
	lea	resident(pc),a0
	move.l	#ende-resident,d0
	call	CopyMem
	move.l	a3,d0
	add.l	d0,(a3)			; Resident-Tabelle
	add.l	d0,10(a3)		; MatchWord
	add.l	d0,14(a3)		; EndSkip
	add.l	d0,22(a3)		; Name
	add.l	d0,26(a3)		; IdString
	add.l	d0,30(a3)		; Init
	move.l	550(a6),d0		; KickTagPtr
	beq.s	1$
	bset	#31,d0
1$	move.l	d0,4(a3)		; als Fortsetzung der Resident-Tabelle
	move.l	a3,550(a6)		; KickTagPtr
	call	KickSumData
	move.l	d0,554(a6)		; Prüfsumme speichern
	lea	SetFunctions-resident(a3),a0
	jsr	(a0)
error	btst	#0,Options(pc)		; -> 24 = X (eXit)
	beq.s	notX
	move.l	550(a6),d0
	beq.s	notX
	move.l	d0,a3
	jsr	34(a3)			; eject
notX	move.l	DosBase(pc),a1
	call	CloseLibrary
	moveq	#0,d0
	rts

ACTf	move.l	26(a3),a4		; IdString
	tst.l	(a4)
	beq	ok3
	lea	actmem(pc),a0
	move.l	Options(pc),d0
	btst	#24,d0			; X (eXit)
	beq.s	1$
	lea	actmem2(pc),a0
1$	bsr	output
	move.l	idstring(pc),d0
	cmp.l	(a4)+,d0
	ble.s	ACTneu			; neue Version im Speicher ->
	jsr	34(a3)			; eject
	bra	ok3
ACTneu	move.l	Options(pc),(a4)
	bra	error

output: move.l	a0,d2			; Zeiger auf Text
	moveq	#0,d3			; Textlänge
2$	tst.b	(a0)+			; Zeichen zählen
	beq.s	1$
	addq.w	#1,d3
	bra.s	2$
1$	move.l	stdout(pc),d1		; FileHandle
	move.l	DosBase(pc),a6
	call	Write
	move.l	4,a6			; ExecBase
	rts

KillRes:
	move.l	(a3)+,d0
	beq.s	1$
	bpl.s	KillRes
1$	bclr	#31,d0
	move.l	d0,(a5)
	move.l	d0,a3
	rts

NextRes:
	move.l	(a3)+,d0
	beq.s	1$
	bpl.s	NextRes
1$	bclr	#31,d0
	lea	-4(a3),a5
	move.l	d0,a3
	rts

vimcool move.l	d0,-(a7)
	bsr.s	ClrCool
	bra.s	vim2
vimres	move.l	d0,-(a7)
	bsr.s	KillRes
vim2	move.l	(a7)+,d0
vim	clr.l	-(sp)			; Virus in Memory
	bsr	GetName
	tst.l	(sp)+
	bsr.s	output
	lea	memtext(pc),a0
	bsr.s	output
	bra	ok2

ClrCool:
	moveq	#0,d6			; CoolCapture löschen
	move.l	d6,46(a6)
	bra	ChkSum


clpdev		dc.b	'clipboard.device',0
timedev		dc.b	'timer.device',0
raddev		dc.b	'ramdrive.device',0
asdgdev 	dc.b	'asdg.vdisk.device',0
LamerEX 	dc.b	'The LAMER Exterminator !!!',0
MCAnam		dc.b	'>>> Claas Abraham Virus !!! <<<',0
Autor		dc.b	10,'written in 1989/90 by Christian Kläger',10,10,0
actmem		dc.b	'ACT-Viruskiller schon im Speicher',10,0
actmem2 	dc.b	'ACT-Viruskiller aus dem Speicher entfernt',10,0
memtext 	dc.b	'-Virus im Speicher gekillt',10,0
rad		dc.b	'Resetfeste RAM-Disk im Speicher',10,0
unkmem		dc.b	'Unbekanntes resetfestes Programm!',10,0
unkcold 	dc.b	'(Cold-Capture gesetzt)',10,0
unkcool 	dc.b	'(Cool-Capture gesetzt)',10,0
unkname 	dc.b	'Name :  ',0
unknoname	dc.b	'Kein Name angegeben'
unkname2	dc.b	10,0
nomem		dc.b	'Kein Virus im Speicher',10,0

	even
TDBase	dc.l	0
stdout	dc.l	0

resident:
	dc.l	8,0			; Resident-Tabelle
	dc.w	$4afc			; MatchWord
	dc.l	8			; MatchTag (+Anfang)
	dc.l	ende-resident		; EndSkip (+Anfang)
	dc.b	1			; Flags
	dc.b	33			; Version
	dc.b	0			; Type
	dc.b    -5			; Priorität
	dc.l	vers-resident		; Name	(+Anfang)
	dc.l	idstring-resident	; IdString (+Anfang)
	dc.l	init-resident		; Init	(+Anfang)

eject:	move.l	4,a6			; ExecBase
	lea	trddev(pc),a1		; 'trackdisk.device'
	lea	350(a6),a0		; Device-List
	call	FindName
	move.l	d0,a0
	move.l	io(pc),-28(a0)		; BeginIO rücksetzen
	move.l	ksd(pc),-610(a6)	; KickSumData rücksetzen
	move.l	WT(pc),-316(a6)		; Wait rücksetzen
	move.l	DosBase(pc),a0
	move.l	38(a0),a0		; GlobalVektor
	move.l	oLS(pc),324(a0)		; LoadSeg rücksetzen
	bsr	ObtainSemaphore
	move.l	resident+4(pc),d0
	bclr	#31,d0
	move.l	d0,550(a6)		; KickTagPtr
	call	KickSumData
	move.l	d0,554(a6)
	move.l	boot(pc),a1
	move.l	#$c60,d0
	call	FreeMem
	lea	resident(pc),a1
	move.l	#ende-resident,d0
	callrts	FreeMem

init:
	movem.l d0-d1/a0-a1/a6,-(a7)
	lea	DosBase(pc),a0
	clr.l	(a0)
	move.l	Options(pc),d0
	btst	#18,d0			; R (not Resident)
	bne	remove
	lea	$dff000,a0
	moveq	#4,d1
	move.w	#$0100,$96(a0)
1$	move.w	6(a0),$180(a0)
	dbf	d0,1$
	dbf	d1,1$
	move.w	#$fff,$180(a0)
	move.l	4,a6
	move.l	#ende-resident,d0
	lea	resident(pc),a1
	call	AllocAbs
	bsr.s	SetFunctions
endinit movem.l (a7)+,d0-d1/a0-a1/a6
	rts

SetFunctions:
	move.l	4,a6			; ExecBase
	call	Disable
	move.l	#$10002,d1		; Chip-Memory, Clear
	move.l	#$c60,d0		; 3KByte
	call	AllocMem
	lea	boot(pc),a0
	move.l	d0,(a0)+
	clr.l	(a0)			; LVtext löschen
	GetSemaphore	a0
	call	InitSemaphore
	lea	trddev(pc),a1		; 'trackdisk.device'
	lea	350(a6),a0		; Device-List
	call	FindName
	move.l	d0,a0
	lea	begin(pc),a1
	move.l	a1,-28(a0)		; BeginIO setzen
	lea	kicksumdata(pc),a1
	move.l	a1,-610(a6)
	lea	newWait(pc),a1
	move.l	a1,-316(a6)
	move.l	DosBase(pc),d0
	beq.s	1$
	move.l	d0,a0
	move.l	38(a0),a0		; GlobalVektor
	lea	LoadSeg(pc),a1
	move.l	a1,324(a0)		; LoadSeg setzen
1$	lea	offsettab(pc),a0
	move.l	a6,(a0)+
	move.w	#314,d0
	move.w	d0,(a0)+
	moveq	#0,d1
	move.l	a6,a1
ol11	add.w	-(a1),d1
	dbf	d0,ol11
	move.w	d1,(a0)
	callrts	Enable

* Diese Funktion wird von der Init-Funktion aufgerufen, falls das Programm
* nicht resetfest sein soll.
remove:
	move.l	4,a6
	move.l	resident+4(pc),d0
	bclr	#31,d0
	move.l	d0,550(a6)
	call	KickSumData
	move.l	d0,554(a6)
	lea	vers(pc),a1		; Namen löschen
	clr.l	(a1)
	bra	endinit

newWait:
	movem.l	d0-d1/a0-a1/a6,-(a7)
	move.l	DosBase(pc),d0
	bne.s	3$
	lea	DosName(pc),a1
	move.l	4,a6
	call	OldOpenLibrary
	lea	DosBase(pc),a0
	move.l	d0,(a0)
	beq.s	2$
3$	move.l	d0,a0
	move.l	38(a0),a0		; GlobalVektor
	lea	LoadSeg(pc),a1
	move.l	a1,324(a0)
2$	movem.l	(a7)+,d0-d1/a0-a1/a6

	move.l	Options(pc),d1
	btst	#12,d1			; L (Libraryoffsets)
	beq.s	WT-2
	movem.l d0/a0/a3/a5/a6,-(sp)
	lea	offsettab(pc),a3
	move.l	(a3)+,a1
	move.w	(a3)+,d0
	moveq	#0,d1
1$	add.w	-(a1),d1
	dbf	d0,1$
	cmp.w	(a3)+,d1
	beq.s	wtok
	bsr	AttemptSemaphore
	beq.s	wtok
	move.w	d1,-2(a3)		; neue Prüfsumme
	move.l	4,a6
	bsr	SetStack
	bsr	BeginGuruTX
	lea	libch(pc),a3
	moveq	#36,d0
	bsr	CenterLine
	moveq	#50,d1
	bsr	DisplayAlert
	move.l	(a7),a7
	bsr	ReleaseSemaphore
wtok	movem.l (sp)+,d0/a0/a3/a5/a6
	dc.w	JMP
WT	dc.l	0

kicksumdata:
	bsr	ObtainSemaphore
	movem.l a0/a1,-(a7)
	lea	resident(pc),a0
	move.l	a0,550(a6)
	move.l	ksd(pc),a0
	jsr	(a0)
	movem.l (a7)+,a0/a1
	bra	ResetGuru


LoadSeg:
	move.l	a0,-(a7)
	lea	LSname(pc),a0
	move.l	d1,(a0)
	move.l	(a7)+,a0
	move.l	oLS(pc),a4
	moveq	#12,d0
	jsr	(a5)
	movem.l	d0-d7/a0-a6,-(a7)
	asl.l	#2,d1
	beq	noLV
	lea	LVTab(pc),a3
	move.l	d1,a4
	move.l	-(a4),d2
	addq.l	#8,a4
	subq.l	#8,d2
	asr.l	#2,d2
1$	move.l	a3,a0
	lea	18(a0),a3
	move.w	(a0)+,d0
	beq	noLV
	cmp.w	d0,d2
	bne.s	1$
	move.w	(a0)+,d0
	move.l	0(a4,d0.w),d0
	cmp.l	(a0)+,d0
	bne.s	1$
	move.w	(a0)+,d0
	move.l	0(a4,d0.w),d0
	cmp.l	(a0)+,d0
	bne.s	1$
	move.w	(a0)+,d5
	move.w	(a0)+,d7
	move.l	4,a6
	move.l	#$c00,d0
	moveq	#0,d1
	call	AllocMem
	lea	LVtext(pc),a0
2$	tst.l	(a0)
	bne.s	2$
	move.l	d0,(a0)
	bsr	ObtainSemaphore
	bsr	SwapLVtext
	bsr	SetStack
	bsr	BeginGuruTX
	bsr	SwapLVtext
	move.w	d5,d0
	bsr	GetName
	move.l	a0,a3
	moveq	#36,d0
	bsr	BeginLine
	lea	infile(pc),a3
	copytx	a3,a5
	bsr	EndLine
	bsr	ReleaseSemaphore
	move.b	#1,(a5)+
	bsr	GetFileName
	bsr	ObtainSemaphore
	bsr	SwapLVtext
	moveq	#60,d1
	bsr	DisplayAlert
	bsr	SwapLVtext
	bsr	ReleaseSemaphore
	move.w	#$4eb9,(a4)+			; jsr
	lea	KillLinkVirus(pc),a0
	move.l	a0,(a4)+
	move.l	LVtext(pc),a0
	movem.l	d2-d7/a1-a4,(a0)		; Register für KillLinkVirus
	move.l	(a7),a7
noLV	movem.l	(a7)+,d0-d7/a0-a6
	jmp	(a6)


KillLinkVirus:
	movem.l	d0-d7/a0-a6,-(a7)
	move.l	LVtext(pc),a0
	movem.l	(a0),d2-d7/a1-a4		; Register holen
	lea	LVSprungtab(pc),a5
3$	move.l	a5,a0
	add.w	(a5)+,a0
	add.w	d7,d7
	bcc.s	4$
	jsr	(a0)
4$	tst.w	d7
	bne.s	3$
	move.l	4,a6
	lea	LVtext(pc),a0
	move.l	(a0),a1
	clr.l	(a0)
	move.l	#$c00,d0
	call	FreeMem
	movem.l	(a7)+,d0-d7/a0-a6
	rts


 
LV_REM1HUNK	equ	$8000
LV_RENAME	equ	$4000
LV_CLRSTARTUP	equ	$2000

LVSprungtab:
	dc.w	RemFirstHunk-*
	dc.w	RenameVirus-*
	dc.w	ClrStartup-*

RemFirstHunk:
	move.w	#JMP,(a4)+
	move.l	-12(a4),d0
	addq.l	#1,d0
	asl.l	#2,d0			; 2. Segment
	move.l	d0,(a4)
	move.l	d3,d0			; Filelänge
	moveq	#0,d1
	move.l	4,a6
	call	AllocMem
	tst.l	d0
	beq	LVerror
	move.l	d0,a2			; Puffer
	move.l	d6,d1
	move.l	#1005,d2		; MODE_OLDFILE
	move.l	DosBase(pc),a6
	call	Open
	move.l	d0,d1
	beq	1$
	move.l	d0,d4
	move.l	a2,d2
	call	Read
	move.l	d4,d1
	call	Close
	move.l	a2,a0
	move.l	8(a0),d0
	lsl.l	#2,d0
	subq.l	#1,8(a0)
	subq.l	#1,16(a0)
	lea	20(a0),a1
	lea	24(a0),a0
	move.l	4,a6
	subq.l	#4,d0
	call	CopyMemQuick
	move.l	4(a0),d0
	addq.l	#1,d0
	asl.l	#2,d0
	add.l	d0,a0
87$	cmp.l	#$3e9,(a0)+
	bne.s	87$
	subq.l	#4,a0
	move.l	a2,d0
	add.l	d3,d0
	sub.l	a0,d0
	move.l	a1,-(a7)
	call	CopyMemQuick
	move.l	(a7)+,a0
2$	move.l	(a0)+,d1
	cmp.w	#$3eb,d1		; hunk_bss
	bne.s	4$
	move.l	(a0)+,d1
	bra.s	3$
4$	cmp.w	#$3ec,d1		; hunk_reloc32
	bne.s	6$
5$	move.l	(a0)+,d1
	beq.s	3$
	subq.l	#1,(a0)+
	lsl.l	#2,d1
	add.l	d1,a0
	bra.s	5$
6$	cmp.w	#$3f1,d1		; hunk_debug
	beq.s	7$
	cmp.w	#$3e7,d1		; hunk_unit
	blt.s	3$
	cmp.w	#$3ea,d1		; hunk_data
	bgt.s	3$
7$	move.l	(a0)+,d1
	lsl.l	#2,d1
	add.l	d1,a0
3$	cmp.l	a0,a1
	bne.s	2$
9$	move.l	a1,a3
	move.l	DosBase(pc),a6
	move.l	d6,d1
	moveq	#0,d2
	call	SetProtection		; RWED
	move.l	d6,d1
	move.l	#1006,d2		; MODE_NEWFILE
	call	Open
	move.l	d0,d1
	beq.s	1$
	move.l	d0,d4
	move.l	a2,d2
	move.l	d3,-(a7)
	move.l	a3,d3
	sub.l	d2,d3
	call	Write
	move.l	(a7)+,d3
	move.l	d4,d1
	call	Close
	moveq	#-1,d0			; Z-Flag löschen
1$	seq	d4
	move.l	4,a6
	move.l	a2,a1
	move.l	d3,d0
	call	FreeMem
	tst.b	d4
	bne	LVerror
	rts

RenameVirus:
	cmp.b	#Terrorists,d5
	beq.s	1$
	lea	bgsname(pc),a3
	bra.s	2$
1$	lea	terrname(pc),a3
2$	move.w	#$4e75,(a4)		; Ausgang bei Fehler
	move.l	DosBase(pc),a6
	move.l	d6,d1
	call	DeleteFile
	move.l	d6,a0
3$	tst.b	(a0)+
	bne.s	3$
	move.l	a0,a2
	move.l	d6,a1
	copytx	a1,a0
bgs2	move.l	a2,a0
4$	cmp.b	#':',(a0)+
	bne.s	4$
	move.l	a3,a1
	copytx	a1,a0
	move.l	a2,d1
	move.l	d6,d2
	call	Rename
	tst.l	d0
	bne	5$
	lea	bgsname(pc),a0
	cmp.l	a0,a3
	bne	LVerror
	lea	5(a0),a3
	bra.s	bgs2
5$	move.l	d6,d1
	call	LoadSeg
	move.l	d0,-10(a4)		; 2. Segment
	beq	LVerror
	move.w	#JMP,(a4)+
	addq.l	#1,d0
	asl.l	#2,d0
	move.l	d0,(a4)
	rts


ClrStartup:
	move.w	#$4e75,(a4)
	move.l	DosBase(pc),a6
	move.l	d6,d1
	call	DeleteFile
	move.l	d6,a0
1$	tst.b	(a0)+
	bne.s	1$
	move.l	a0,a2
	move.l	d6,a1
	copytx	a1,a0
	move.l	a2,a0
2$	cmp.b	#':',(a0)+
	bne.s	2$
	lea	startup(pc),a1
	copytx	a1,a0
	move.l	a2,d1
	move.l	#1005,d2		; MODE_OLDFILE
	call	Open
	move.l	d0,d1
	beq	5$
	move.l	d0,d4
	subq.l	#8,a7
	move.l	a7,d2
	moveq	#8,d3
	call	Read
	move.l	a7,a0
3$	cmp.b	#$0a,(a0)
	beq.s	4$
	move.b	#$20,(a0)+
	bra.s	3$
4$	move.l	d4,d1
	moveq	#0,d2
	moveq	#-1,d3
	call	Seek
	move.l	d4,d1
	move.l	a7,d2
	moveq	#8,d3
	call	Write
	move.l	d4,d1
	call	Close
	addq.l	#8,a7
5$	rts

LVerror bsr	ObtainSemaphore
	bsr	BeginGuruTX
	lea	LVerr(pc),a3
	moveq	#36,d0
	bsr	CenterLine
	moveq	#50,d1
	bsr	DisplayAlert
	bra	ReleaseSemaphore

GetFileName:
	move.l	DosBase(pc),a6
	move.l	LSname(pc),a0
	add.l	a0,a0
	add.l	a0,a0
	moveq	#0,d0
	move.b	(a0)+,d0
	clr.b	0(a0,d0.w)
	move.l	a0,d1
	call	Lock
	move.l	d0,a2
	move.l	a5,d6
	addq.l	#3,d6
	move.l	a2,d1
	bsr	PathName
	move.l	a2,d1
	call	UnLock
	clr.b	-(a5)
	bra	EndLine

PathName:
	move.l	d1,-(a7)
	call	ParentDir
	move.l	d0,d1
	beq.s	2$
	bsr.s	PathName
	moveq	#'/',d3
1$	move.l	(a7)+,d1
	move.l	LVtext(pc),d2
	add.l	#$400,d2
	call	Examine
	move.l	LVtext(pc),a0
	lea	$408(a0),a0
	tst.b	d3
	bpl.s	3$
	move.l	a0,a3
	moveq	#46,d0
	bsr	BeginLine
	move.b	#':',(a5)+
	rts
2$	moveq	#-1,d3
	bra.s	1$
3$	move.l	a0,-(a7)
	copytx	a0,a5
	move.b	d3,(a5)+
	move.l	(a7)+,a0
	move.l	$74(a0),d3
	rts

SwapLVtext:
	movem.l d0/a0,-(a7)
	lea	boot(pc),a0
	move.l	(a0),d0
	move.l	4(a0),(a0)+
	move.l	d0,(a0)
	movem.l (a7)+,d0/a0
	rts

install:
	bsr	BootCheckSum		; Prüfsumme prüfen
	bne	endio			; nicht bootfähig
	move.l	40(a1),a0
	adda.w	#12,a0
	lea	Std2(pc),a3
	moveq	#18,d0
1$	cmpm.w	(a0)+,(a3)+
	dbne	d0,1$
	beq	endio			; keinen Text ausgeben
nstd2	move.l	Options(pc),d0
	btst	#23,d0			; W (Write)
	bne	endio
	move.w	#2,28(a1)		; CMD_READ
	bsr	DoIO
	bra	endio
begin:
	bsr	ObtainSemaphore
	movem.l d0-d2/a0/a2/a3/a5,-(a7)
	move.l	a6,a5
	move.l	Options(pc),d0
	btst	#3,d0			; C (Cold/Cool)
	bne.s	nores
	move.l	4,a6
	tst.l	42(a6)			; CoolCapture prüfen
	bne.s	coolst
	tst.l	46(a6)			; ColdCapture prüfen
	beq.s	nores
coolst	bsr	ResetGuru
nores	move.l	a5,a6
	moveq	#11,d0
	Getmemo a0
	move.l	a1,a3
1$	move.l	(a3)+,(a0)+		; IO-Struktur retten
	dbf	d0,1$
	tst.l	44(a1)			; io_Offset = Bootblock ?
	bne	endio
	cmp.w	#3,28(a1)		; CMD_WRITE
	beq	install
	cmp.w	#2,28(a1)		; CMD_READ
	bne	endio
	move.l	boot(pc),a0
	lea	$800(a0),a0
	move.l	a0,40(a1)		; io_Data
	move.l	#$400,36(a1)		; io_Length
	bsr	DoIO
	bne	endio			; Lesefehler
	move.l	40(a1),a0
	adda.w	#12,a0
	lea	Std2(pc),a3
	moveq	#18,d0
scm1	move.w	(a0)+,d1
	cmp.w	(a3)+,d1
	bne.s	nstd
	dbf	d0,scm1
	beq	endio			; keinen Text ausgeben
nstd	move.l	40(a1),a0
	bsr	BeginGuruTX

	lea	viren(pc),a3		; allg. Virentest-Schleife
	lea	endviren(pc),a2
test	moveq	#0,d0
	move.b	1(a3),d0
	add.w	d0,d0
	move.l	0(a0,d0.w),d0
	cmp.l	2(a3),d0
	beq	virusfound
	addq.l	#8,a3
	cmp.l	a3,a2
	bne.s	test


	bsr	BootCheckSum		; Prüfsumme prüfen
	bne	endio			; nicht bootfähig
	move.l	40(a1),a0

	move.l	a0,a2
	lea	$400(a2),a3
12$	cmp.w	#$337c,(a2)+		; move.w #3,28(a1)
	beq.s	11$
	cmp.l	a2,a3
	bne.s	12$
	move.l	a0,a2
22$	cmp.w	#$137c,(a2)+		; move.b #3,29(a1)
	beq.s	21$
	cmp.l	a2,a3
	bne.s	22$
	bra.s	30$
11$	cmp.l	#$0003001c,(a2)
	bne.s	12$
	bra.s	25$
21$	cmp.l	#$0003001d,(a2)
	bne.s	22$
25$	lea	endviren(pc),a3
	beq	virusfound

30$	lea	unk(pc),a3		; Unknown Bootblock
	moveq	#36,d0
	bsr	CenterLine
	bsr	drivenr
boottx	moveq	#12,d0			; 13 Zeilen
tx1	moveq	#76,d1			; zu 77 Zeichen
	move.b	#1,(a5)+		; Text  noch nicht fertig
	clr.b	(a5)+
	move.b	#12,(a5)+		; horiz. Koordinate
	move.w	d0,d2
	asl.w	#3,d2
	neg.w	d2
	add.w	#148,d2 		; vert. Koordinate berechnen
	move.b	d2,(a5)+		; und einfügen
tx2	bsr	zeich			; Zeichen umwandeln
	dbf	d1,tx2			; nächstes Zeichen
	clr.b	(a5)+			; Ende  der Zeile
	dbf	d0,tx1			; nächste Zeile
	move.b	#1,(a5)+		; Text  noch nicht fertig
	clr.b	(a5)+
	move.b	#$c,(a5)+		; horiz. Koordinate
	move.b	#156,(a5)+		; vert. Koordinate
	moveq	#22,d1			; 23 Zeichen
tx3	bsr	zeich			; umwandeln
	dbf	d1,tx3			; und nächstes
	clr.b	(a5)+			; Ende  der Zeile
	move.l	#175,d1 		; Höhe	des Gurus

guru	movem.l a1/a6,-(a7)
	move.b	#1,(a5)+
	clr.b	(a5)+
	move.b	#64,(a5)+
	move.b	d1,(a5)+
	add.w	#12,d1
	move.l	d1,-(a7)
	lea	wprot(pc),a3
	lea	write(pc),a0
	tst.w	(a0)
	bne.s	gu1
	lea	wena(pc),a3
gu1	copytx	a3,a5
	move.l	(a7)+,d1		; Höhe  des Gurus
	bsr	DisplayAlert
	movem.l (a7)+,a1/a6
	moveq	#-1,d1
	lea	write(pc),a0
	tst.w	(a0)
	bne.s	gu2
	tst.w	d0
	bne.s	gu2
kill2	bsr	kill
	bne.s	vererr			; Schreibfehler
	move.w	#2,28(a1)		; CMD_READ
	bsr	DoIO			; Verify !!!
	moveq	#0,d1
	lea	Std(pc),a3
	move.l	40(a1),a0
	moveq	#24,d0
v1	cmpm.w	(a3)+,(a0)+
	dbne	d0,v1
	beq.s	gu2
vererr	bsr	BeginGuruTX
	lea	verr(pc),a3
	moveq	#36,d0
	bsr	CenterLine
	moveq	#50,d1
	bsr	DisplayAlert
	moveq	#-1,d1
gu2	move.w	d1,-(a7)
	move.l	#$400,d0
	move.l	d0,44(a1)		; ab Block 2
	move.l	d0,36(a1)		; 2 Blocks
	move.w	#2,28(a1)		; CMD_READ
	bsr	DoIO
	move.l	40(a1),a0
	cmp.l	#$889ea600,(a0)
	bne.s	nolm3
	move.w	#511,d0 		; Anz. Worte -1
lm3dec	ror.w	(a0)+
	dbf	d0,lm3dec
	clr.l	44(a1)
	move.w	#3,28(a1)		; CMD_WRITE
	bsr	DoIO
nolm3	move.w	(a7)+,d1
	GetMemo a0
	cmp.l	#$400,36(a0)		; io_Length = 1KByte
	bne	endio
	cmp.l	40(a0),a4		; booten wir ?
	bne	endio			; nein	->
	tst.w	d1
	beq.s	dont
	move.l	a0,-(a7)
	bsr	BeginGuruTX
	lea	doit(pc),a3
doit2	move.b	(a3)+,(a5)+		; Text ausgeben
	bne.s	doit2
	move.b	(a3)+,(a5)+		; Textende ?
	bne.s	doit2
	moveq	#70,d1
	bsr	DisplayAlert
	move.l	(a7)+,a0
	tst.w	d0
	bne	endio
dont	move.l	a4,a3
	move.l	a3,a0
	move.w	#255,d0
dont1	clr.l	(a3)+
	dbf	d0,dont1
	lea	Std(pc),a3
	moveq	#24,d0
dont2	move.w	(a3)+,(a0)+
	dbf	d0,dont2
	bset	#0,30(a1)		; Quick-Bit setzen
	movem.l (a7)+,d0-d2/a0/a2/a3/a5
	bra	ReleaseSemaphore

endio	moveq	#11,d0
	GetMemo a0
	move.l	a1,a3
c2	move.l	(a0)+,(a3)+		; original Rückmeldung holen
	dbf	d0,c2
	movem.l (a7)+,d0-d2/a0/a2/a3/a5
	bsr	ReleaseSemaphore
	dc.w	JMP
io	dc.l	0			; Original-Funktion

copys:	move.b	#1,(a5)+
	lea	anz(pc),a3
	moveq	#52,d0
	bsr	BeginLine
	moveq	#0,d1
	move.l	40(a1),a0
	move.w	0(a0,d2.w),d1
	bsr.s	itoa
	moveq	#70,d1
	bra	guru

itoa:	move.l	#10000,d0
nziff	divu	d0,d1
	bne.s	cout
	cmp.b	#$20,-1(a5)
	beq.s	ncout
cout	add.b	#$30,d1
	move.b	d1,(a5)+
ncout	swap	d1
	ext.l	d1
	divu	#10,d0
	cmp.w	#1,d0
	bne.s	nziff
	add.b	#$30,d1
	move.b	d1,(a5)+
	bra	EndLine

zeich:	move.b	(a0)+,d2
	cmp.b	#$1f,d2
	bhi.s	1$
	move.b	#$2e,d2
1$	cmp.b	#$7d,d2
	bls.s	2$
	move.b	#$2e,d2
2$	move.b	d2,(a5)+
	rts

GetName:
	lea	names(pc),a0
	bra.s	1$
2$	tst.b	(a0)+
	bne.s	2$
1$	dbf	d0,2$
	tst.b	(a0)			; SCA-Clone ?
	bpl.s	3$			; nein ->
	move.l	a5,-(a7)
	move.l	a0,a5
	move.l	8(a7),d0
	bne.s	4$
	move.l	#$7ec00,a0
4$	move.l	d0,a0
	movem.l a2/a3,-(a7)
	lea	SCAviren(pc),a3
	lea	endSCA(pc),a2
6$	move.w	2(a3),d0
	move.l	0(a0,d0.w),d0
	cmp.l	4(a3),d0
	beq	7$
	addq.l	#8,a3
	cmp.l	a3,a2
	bne.s	6$
	lea	1(a5),a0
	bra.s	8$
7$	move.w	(a3),d0
	bsr.s	GetName
8$	movem.l (a7)+,a2/a3
	move.l	(a7)+,a5
3$	rts

virusfound:
	move.l	a3,-(a7)
	moveq	#0,d0
	move.b	(a3),d0
	move.l	a0,-(a7)
	bsr.s	GetName
	move.l	a0,a3
	move.l	(a7)+,a0
	moveq	#36,d0
	bsr	BeginLine
	lea	indrive(pc),a3
	copytx	a3,a5
	bsr	EndLine
	bsr.s	drivenr
	move.l	(a7)+,a3
	move.l	Options(pc),d0
	btst	#20,d0			; T (Text)
	bne	boottx
	move.b	(a3),d0
	beq	boottx			; Unknown Virus
	move.w	6(a3),d2
	bne	copys
	moveq	#50,d1
	bra	guru

drivenr:				; Drive-Nummer korrigieren
	movem.l d0/a0,-(a7)
	move.l	24(a1),a0 		; -> io_Unit
	move.b	67(a0),d0		; Drivenummer
	add.b	d0,-3(a5)		; bei DF0: addieren
	move.b	64(a0),d0
	lea	write(pc),a0
	and.w	#$10,d0
	move.w	d0,(a0)
	movem.l (a7)+,d0/a0
	rts

DoIO:	movem.l a1/a6,-(a7)
	bsr	io-2			; BeginIO
	movem.l (a7),a1/a6
	move.l	4,a6
	call	WaitIO
	movem.l (a7)+,a1/a6
	rts

kill:	move.l	40(a1),a0
	move.l	a0,a3
	move.w	#3,28(a1)		; CMD_WRITE
	move.w	#255,d0
1$	clr.l	(a3)+
	dbf	d0,1$
	lea	Std(pc),a3
	moveq	#24,d0
2$	move.w	(a3)+,(a0)+
	dbf	d0,2$
	bra	DoIO

BootCheckSum:
	move.w	#$ff,d1
	moveq	#0,d0
	move.l	40(a1),a0
bcloop	add.l	(a0)+,d0
	bcc.s	bcnext
	addq.l	#1,d0
bcnext	dbf	d1,bcloop
	not.l	d0
	rts

SetStack:
	lea	4(a7),a0
	GetMemo a7
	move.l	a0,-(a7)
	move.l	-(a0),-(a7)
	rts

ResetGuru:
	movem.l d0-d3/a0-a5,-(sp)
	bsr.s	SetStack
	move.l	Options(pc),d0
	btst	#3,d0			; C (Cold/Cool)
	bne.s	1$
	clr.l	42(a6)			; CoolCapture löschen
	clr.l	46(a6)			; ColdCapture löschen
	bsr	ChkSum
1$	bsr	BeginGuruTX
	lea	res(pc),a3
	moveq	#36,d0
	bsr	CenterLine
	moveq	#50,d1
	bsr.s	DisplayAlert
	move.l	(a7),a7
	movem.l (sp)+,d0-d3/a0-a5
	bra	ReleaseSemaphore

BeginGuruTX:
	move.l	boot(pc),a5
	lea	vers(pc),a3
	moveq	#20,d0
	bsr	CenterLine
	move.b	#1,(a5)+
	rts

DisplayAlert:
	movem.l d4-d5/a0-a1/a6,-(a7)
	clr.b	(a5)+
	clr.b	(a5)+
	move.l	d1,d5
	move.l	4,a6			; ExecBase
	call	Forbid
	lea	378(a6),a0		; LibList
	lea	intuition(pc),a1	; intuition.library
	call	FindName
	move.l	d0,a6
	move.w	d0,-(a7)		; 2 Bytes auf Stack reservieren
	move.l	a7,a0
	moveq	#2,d0
	call	GetPrefs
	move.w	(a7),d4
	move.b	#8,(a7)			; topaz.80
	move.l	a7,a0
	moveq	#2,d0
	moveq	#0,d1
	call	SetPrefs
	move.l	d5,d1
	moveq	#0,d0
	move.l	boot(pc),a0
	call	DisplayAlert
	move.w	d0,-(a7)
	move.w	d4,2(a7)
	lea	2(a7),a0
	moveq	#2,d0
	moveq	#0,d1
	call	SetPrefs
	move.l	4,a6
	call	Permit
	movem.w (a7)+,d0/d4
	movem.l (a7)+,d4-d5/a0-a1/a6
	rts

ChkSum: lea	34(A6),A0		; Prüfsumme berechnen
	moveq	#0,D0
	moveq	#$17,D1
1$	add.w	(A0)+,D0
	dbf	D1,1$
	not.w	D0
	move.w	D0,(A0)			; Prüfsumme speichern
	rts

strcmp: movem.l a0-a1,-(a7)
	moveq	#0,d0
2$	cmpm.b	(a0)+,(a1)+
	bne.s	1$
	addq.w	#1,d0
	tst.b	-1(a0)
	bne.s	2$
1$	movem.l (a7)+,a0-a1
	rts

CenterLine:
	bsr.s	BeginLine
EndLine: clr.b	(a5)+
lineanf lea	(0).l,a3
	move.l	a5,d0
	sub.l	a3,d0
	bmi.s	1$
	lsl.w	#2,d0
	sub.w	#336,d0
	bpl.s	1$
	neg.w	d0
	move.b	d0,1(a3)
	asr.w	#8,d0
	move.b	d0,(a3)
	rts
1$	clr.b	(a3)+
	clr.b	(a3)+
	rts

BeginLine:
	move.l	a0,-(a7)
	lea	lineanf+2(pc),a0
	move.l	a5,(a0)
	move.l	(a7)+,a0
	addq.l	#2,a5
	move.b	d0,(a5)+
	copytx	a3,a5
	rts

ObtainSemaphore:
	movem.l d0-d1/a0-a1/a6,-(a7)
	GetSemaphore	a0
	move.l	4,a6
	call	ObtainSemaphore
	movem.l (a7)+,d0-d1/a0-a1/a6
	rts

ReleaseSemaphore:
	movem.l d0-d1/a0-a1/a6,-(a7)
	GetSemaphore	a0
	move.l	4,a6
	call	ReleaseSemaphore
	movem.l (a7)+,d0-d1/a0-a1/a6
	rts

AttemptSemaphore:
	movem.l d0-d1/a0-a1/a6,-(a7)
	GetSemaphore	a0
	move.l	4,a6
	call	AttemptSemaphore
	movem.l (a7)+,d0-d1/a0-a1/a6
	rts


viren		; Name	      ,Adr/2,Langwort	   ,CopyCnt
	dc.b		    ACID,$56,$06,$dc,$fe,$3a,$00,$00
	dc.b		     ASS,$18,$20,$41,$4d,$49,$00,$00
	dc.b		   Bit16,$a8,$3f,$ff,$2c,$78,$00,$00
	dc.b		 Butonic,$13,$ff,$fc,$61,$3c,$00,$00
	dc.b	  ByteBanditPlus,$0a,$0c,$39,$00,$02,$00,$00
	dc.b	      ByteBandit,$a0,$01,$8a,$2d,$48,$00,$4a	; + Clone
	dc.b	     ByteWarrior,$23,$43,$fa,$ff,$b8,$00,$00
	dc.b		   CList,$19,$61,$00,$03,$38,$03,$66
	dc.b	     DiskDoktors,$a9,$00,$fc,$06,$dc,$03,$aa
	dc.b		 Gadaffi,$20,$47,$41,$44,$41,$00,$00
	dc.b	       Graffitti,$a8,$00,$01,$00,$bf,$00,$00
	dc.b		   Gyros,$42,$4e,$75,$2c,$79,$00,$00
	dc.b		  Joshua,$15,$ff,$88,$30,$2e,$00,$12
	dc.b		  Lamer1,$1e,$ff,$88,$41,$fa,$00,$00	; 1.0 - 1.2
	dc.b		  Lamer2,$23,$d3,$10,$b1,$18,$03,$a4	; 2.0
	dc.b		  Lamer2,$19,$b3,$be,$b2,$bb,$03,$c6	; 2.1
	dc.b		  Lamer3,$11,$d3,$10,$b1,$18,$03,$f2	; 3.0
	dc.b		  Lamer3,$18,$10,$39,$00,$df,$00,$00	; lt. Vir.Kat.
	dc.b		     MCA,$12,$66,$02,$61,$12,$00,$00
	dc.b	       NorthStar,$08,$4e,$6f,$72,$74,$00,$1c	; 1
	dc.b	       NorthStar,$09,$4e,$6f,$72,$74,$00,$1e	; 2
	dc.b		 Obelisk,$0a,$fe,$3a,$65,$18,$00,$00
	dc.b		Obelisk2,$0e,$00,$95,$65,$2e,$00,$08
	dc.b	       Paramount,$60,$50,$53,$57,$43,$00,$00
	dc.b		Pentagon,$09,$00,$07,$fd,$84,$00,$00
	dc.b	   Phantasmumble,$20,$42,$40,$32,$3c,$00,$00
	dc.b		 Revenge,$07,$49,$44,$39,$32,$03,$f6
	dc.b		  Ripper,$0b,$52,$49,$50,$50,$00,$1e
	dc.b	      SCA_Clones,$39,$ec,$a4,$b1,$ee,$02,$f8	; AEK,BS1,LSD
	dc.b		Starfire,$0a,$08,$9c,$66,$38,$00,$00
	dc.b	       Suntronic,$2f,$2d,$40,$02,$2a,$00,$00
	dc.b		SuperBoy,$48,$ec,$42,$00,$2e,$00,$00
	dc.b		System_Z,$02,$50,$56,$4c,$2e,$00,$00
	dc.b		System_Z,$02,$50,$76,$4c,$2e,$00,$00
	dc.b		     HCS,$20,$51,$c8,$ff,$fc,$00,$00
	dc.b		Timebomb,$d8,$53,$55,$43,$4b,$00,$00
	dc.b		UltraFox,$e8,$83,$35,$3e,$f0,$00,$00
	dc.b	       VKill_1_0,$1f,$00,$3a,$26,$49,$02,$de
	dc.b		    WAFT,$35,$ff,$3a,$28,$40,$00,$00
	dc.b		 Warhawk,$43,$e6,$3a,$4c,$df,$00,$00
endviren dc.l	0,0		; dummy-Eintrag für unbekannte Viren

SCAviren     ; Name, Adr, Langwort
	dc.w	AEK,$3d0,$2041,$454b
	dc.w	BS1,$3b8,$2043,$3634
	dc.w	LSD,$3f0,$4c53,$4421
endSCA


LVTab:	;Size,Offs1, Daten1    ,Offs2, Daten2    ,Name,Flags
 dc.w	$0109,$00b6,$03f2,$4cdf,$00de,$fe6a,$6a02,IRQ,LV_REM1HUNK
 dc.w	$03cf,$0030,$e419,$10c1,$00bc,$2d48,$fd9e,Smily_Cancer,LV_REM1HUNK
 dc.w	$0250,$0018,$303c,$0909,$0020,$b302,$e319,Jack,LV_REM1HUNK
 dc.w	$024f,$0017,$303c,$0909,$001f,$b302,$e319,Jack,LV_REM1HUNK
 dc.w	$0283,$0012,$0226,$674c,$005a,$1234,$5678,BGS9,LV_RENAME
 dc.w	$018a,$0038,$5454,$5631,$01d6,$6176,$673c,Terrorists,LV_RENAME
 dc.w	$02cf,$0058,$013a,$3298,$01b6,$758e,$4745,Jeff,LV_CLRSTARTUP
 dc.w	$046b,$0016,$42c0,$6002,$001a,$40c0,$7e00,RevengeLAMER,LV_CLRSTARTUP
 dc.w	0


names:
virusnum	set	0
 virusname	Unknown,<'Unknown'>
 virusname	ACID,<'ACID'>
 virusname	AEK,<'AEK'>
 virusname	ASS,<'ASS'>
 virusname	BS1,<'Bamiga Sector One'>
 virusname	Bit16,<'16 Bit Crew'>			; fehlt in Sammlung
 virusname	BGS9,<'BGS 9'>
 virusname	Butonic,<'Butonic'>			; fehlt in Sammlung
 virusname	ByteBandit,<'ByteBandit'>
 virusname	ByteBanditPlus,<'ByteBanditPlus'>
 virusname	ByteWarrior,<'ByteWarrior'>
 virusname	CList,<'CList'>
 virusname	DiskDoktors,<'DiskDoktors'>
 virusname	Gadaffi,<'Gadaffi'>
 virusname	Graffitti,<'Graffitti'>			; fehlt in Sammlung
 virusname	Gyros,<'Gyros'>				; fehlt in Sammlung
 virusname	HCS,<'HCS'>				; fehlt in Sammlung
 virusname	IRQ,<'IRQ'>
 virusname	Jeff,<'Jeff'>
 virusname	Joshua,<'Joshua'>
 virusname	Lamer1,<'LAMER Exterminator I'>
 virusname	Lamer2,<'LAMER Exterminator II'>
 virusname	Lamer3,<'LAMER Exterminator III'>
 virusname	LSD,<'LSD'>
 virusname	MCA,<'MCA'>
 virusname	NorthStar,<'NorthStar'>			; Versionen 1 und 2
 virusname	Obelisk,<'Obelisk'>
 virusname	Obelisk2,<'Obelisk2'>
 virusname	Paramount,<'Paramount'>			; fehlt in Sammlung
 virusname	Pentagon,<'Pentagon Circle'>
 virusname	Phantasmumble,<'Phantasmumble'>		; fehlt in Sammlung
 virusname	Revenge,<'Revenge'>
 virusname	RevengeLAMER,<'Revenge Of The LAMER Exterminator'>
 virusname	Ripper,<'Ripper'>
 virusname	SCA_Clones,<-1,'SCA'>			; AEK, BS1, LSD, SCA
 virusname	Smily_Cancer,<'Smily Cancer'>
 virusname	Starfire,<'Starfire'>
 virusname	Suntronic,<'Suntronic'>
 virusname	SuperBoy,<'SuperBoy'>
 virusname	System_Z,<'System Z'>
 virusname	Terrorists,<'Terrorists'>
 virusname	Timebomb,<'Timebomb'>
 virusname	Jack,<'Traveling Jack'>
 virusname	UltraFox,<'UltraFox'>			; fehlt in Sammlung
 virusname	VKill_1_0,<'VKill'>
 virusname	WAFT,<'WAFT'>				; fehlt in Sammlung
 virusname	Warhawk,<'Warhawk'>

res	dc.b	'WARNUNG: Ein Programm wollte sich resetfest machen !!!',0
libch	dc.b	'WARNUNG: Eine Library-Funktion wurde verändert!!!',0
verr	dc.b	'Verify-Error!!!   Bootblock nicht installiert!',0
doit	dc.b	0,172,36,'Soll der Bootblock ausgeführt werden?',0,1
	dc.b	0,100,48,'Links: ja',0,1,1,188,48,'Rechts: nein',0,0
wprot	dc.b	'Linker Mausknopf: weiter         '
	dc.b	'        Disk ist schreibgeschützt',0
wena	dc.b	'Linker Mausknopf: weiter         '
	dc.b	'       Rechter Mausknopf: install',0
indrive 	dc.b	'-Virus in Drive DF0:',0
infile		dc.b	'-Virus im File:',0
anz		dc.b	'Anzahl Kopien: ',0
unk		dc.b	'Unknown Bootblock in Drive DF0:',0
LVerr		dc.b	'Fehler beim Linkvirus killen!!!',0
bgsname 	dc.b	'devs/',$a0,$a0,$a0,$20,$20,$20,$a0,$20,$20,$20,$a0,0
terrname	dc.b	$a0,$20,$20,$20,$a0,$20,$20,$a0,$20,$a0,$a0,0
startup 	dc.b	's/startup-sequence',0
Cdir		dc.b	'C:',0
clist		dc.b	'clist.library',0
trddev		dc.b	'trackdisk.device',0
intuition	dc.b	'intuition.library',0
ttv1		dc.b	'TTV1',0
		even
idstring	dc.l	$31323000		; 1.2
Options 	dc.l	0
vers		dc.b	'ACT-Viruskiller Version 1.2',0
	even
Std	dc.w	$444f,$5300,$c020,$0f19,$0000,$0370
Std2	dc.w	$43fa,$0018,$4eae,$ffa0,$4a80,$670a,$2040,$2068
	dc.w	$0016,$7000,$4e75,$70ff,$60fa
DosName dc.b	'dos.library',0		; muss hier sein, da zu Std gehört!!

DosBase dc.l	0
ksd	dc.l	0
oLS	dc.l	0

boot		set	*
LVtext		set	boot+4
write		set	LVtext+4
offsettab	set	write+2
LSname		set	offsettab+8
ende		set	LSname+4

	end

