start	move.l	4,a6
	lea	DosName,a1
	move.l	378(a6),a0	;Library list
	jsr	-276(a6)	;FindName 

	move.l	d0,a1		;DosBase

	add.l	#$4e,d0

	jsr	-132(a6)	;Forbid
	move.l	d0,OldLoadSeg+2

	move.w	#$4ef9,-150(a1)
	move.l	#NewLoadSeg,-148(a1)
	jsr	-138(a6)	;Permit

	clr.l	start-4		;Remove Next hunk so NewLoadSeg stays 
				;in memory after unload this program.
	move.l	a1,a6
	jsr	-60(a6)
	move.l	d0,d1
	move.l	#TextBegin,d2
	move.l	#TextEnd-TextBegin,d3
	jsr	-48(a6)		
	clr.l	d0
	rts

DosName
	dc.b	'dos.library',0
TextBegin:
	dc.b	"PatchLoadSeg installed.",10
	dc.b	"V1.20 Made by:",10
	dc.b	"Pieter van Leuven",10
	dc.b	"Markt 19A",10
	dc.b	"5688 AJ  Oirschot",10
	dc.b	"Holland",10
TextEnd:

	section	"RES",code
	dc.l	'Pvl.'
	dc.l	'V1.2'
NewLoadSeg
	moveq.l	#$ed,d0
OldLoadSeg
	jsr	$0		;Original LoadSeg

	movem.l	d0-d7/a0-a6,-(sp)
	move.l	d0,d7
loop
	lsl.l	#2,d0		;*4
	move.l	d0,a1
	lea	tablelink,a0	;Table with information about viruses
tableloop
	move.w	(a0)+,d2	;Get offset
	beq.s	next_hunk	;End of table. Goto next_hunk
	move.l	(a0)+,d3	;d3 = Value to check
	cmp.l	0(a1,d2.w),d3	
	beq.s	Kill		;Virus detected and disable
	bra.s	tableloop	;Next Entry of table
next_hunk
	move.l	(a1),d0		;d0 is pointer to next hunk
	bne.s	loop		;Check this new hunk


quit	movem.l	(sp)+,d0-d7/a0-a6
	rts

Kill 	move.l	4,a6
	jsr 	-132(a6)
	bsr.s	alertprog
	move.l	4,a6
	jsr	-138(a6)
	move.l	d7,d0		;Get pointer to first segment from stack
	move.l	d0,d1
	lsl.l	#2,d1		;* 4
	move.l	d1,a1
	move.l	#$42804e75,4(a1)	;Place new code in program 
					;	clr.l	d0
					;	rts
        bra.s	quit

alertprog
	lea	IntuitionText,a1
	move.l	378(a6),a0	;Library list
	jsr	-276(a6)	;FindName (intuition.library)
	move.l	d0,a6
	move.l	#40,d1		;height of alert
	clr.l	d0
	lea	Alert,a0
	jsr	-90(a6)		;display alert
	rts

tablelink
	dc.w	$d4		;IQR-virus offset 
	dc.l	$b1985680	;Control Value

	dc.w	$58		;TTV1-virus
	dc.l	$421fffb9

	dc.w	$40		;Revenge of Lamer ....
	dc.l	$b1985780

	dc.w	$440		;Xeno
	dc.l	$d8e5eeef

	dc.w	$40		;Test program
	dc.l	$45678901

	dc.w	0		;End

Alert
	dc.w	140
	dc.b	22
	dc.b	'Link-Virus Detected. ',0
	dc.b	0

IntuitionText
	dc.b	'intuition.library',0
	even
