		section	memorychecker,code	; any mem will do !!!
		opt	o+,c-

*****************************************************************************
*									    
*         Memory Resident Virus Checker and Disk State Checker		    
*      ----------------------------------------------------------           
*									    
*		Programmed and Designed by Trevor Mensah © 1991		    
*		     Exclusivly for ACC in July 1991			    
*				    ~~~					    
*			    DEVPAC II SOURCE				    
*									    
* Just a simple but powerful memory virus hunting utility,it checks all the  
* execbase vectors were viruses can hide,if they are not the system standard 
* ones,then a system-alert will take over and a hard-reset will be performed 
* Also it checks the disk status,for write-protection and warns you if the
* disk in df0: is write-enabled !
*
*****************************************************************************

* Virus Pointers Reconised ( + all future memory resident virus )

Dasa		equ	$7f94c
Bandit		equ	$7ebe2
Sca		equ	$7ec3e
NorthStar	equ	$7ec0e	

*****************************************************************************
* Firstly Check memory for "KNOWN" viruses
*****************************************************************************

		lea	welcome.txt(pc),a3
		move.l	#endwelcome-welcome.txt,d3
		bsr	print_text

		move.l	(AbsExecBase).w,a6
Check_dasa	cmp.l	#Dasa,Kicktagptr(a6)
		bne.s	Check_Bandit

		lea	Dasa.txt(pc),a3
		moveq	#enddasa-dasa.txt,d3

		bsr	print_text
		bra	virus_alert 

Check_Bandit	cmp.l	#Bandit,Kicktagptr(a6)
		bne.s	Check_sca

		lea	Bandit.txt(pc),a3
		moveq	#endbandit-bandit.txt,d3
		bsr	print_text
		bra	virus_alert

Check_sca	cmp.l	#Sca,coolcapture(a6)
		bne.s	Check_nstar

		lea	Sca.txt(pc),a3
		moveq	#endsca-sca.txt,d3
		bsr	print_text
 		bra	virus_alert

Check_nstar	cmp.l	#Northstar,coolcapture(a6)
		bne.s	CheckVectors

		lea	NorthStar.txt(pc),a3
		moveq	#endnorthstar-northstar.txt,d3
		bsr	print_text

		bra	virus_alert
	
CheckVectors:	cmp.l	#standard,coldcapture(a6)
		bne	Reset
 		cmp.l	#standard,coolcapture(a6)
		bne	Reset
 		cmp.l	#standard,warmcapture(a6)
		bne	Reset
		cmp.l	#standard,kickmemptr(a6)
		bne	Reset
		cmp.l	#standard,kicktagptr(a6)
		bne	Reset
		cmp.l	#standard,kickchecksum(a6)
		bne	Reset

		lea	NotFound(pc),a3
		move.l	#endnotfound-notfound,d3
		bsr.s	print_text

CheckProtection	move.b	#$ff,$bfd100.l
		bclr	#3,$bfd100.l
		bclr	#7,$bfd100.l
		btst	#3,$bfe001.l
		bne.s	WriteEnabled

WriteProtected:	lea	WritePro(pc),a3
		moveq	#endpro-WritePro,d3
		bsr.s	print_text
		rts

WriteEnabled:	lea	WriteEnbled(pc),a3
		move.l	#endwrite-WriteEnbled,d3
		bsr.s	print_text

mousewait	move.w	#$0f0,$dff180.l
		btst	#6,$bfe001.l
		bne.s	mousewait
		rts

print_text	move.l	4.w,a6
 		lea	dosname(pc),a1
		moveq.l	#0,d0
		jsr	-408(a6)
		move.l	d0,a6

		jsr	-60(a6)
		move.l	d0,d1
		move.l	a3,d2			; get text
		jsr	-48(a6)
		move	#0,d0
exit		rts

Virus_Alert	rts

welcome.txt	dc.l	clearscreen
		dc.b	newline
		dc.b	'«« ACC: The Memory Resident Virus-Detector/Protector v1.0 »»',$a
		dc.b	'¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯',$a
		dc.b	'Copyright © July 1991. This Program is Fully P.D. Freeware !!!',$a
		dc.b	'Programmed and designed by Trevor Mensah',$a,$a
		dc.b	'Checking Memory for Viruses... »» All KNOWN and FUTURE ONES!!!',$a,$a
endwelcome

Dasa.txt	dc.b	'WARNING: DASA VIRUS DETECTED IN MEMORY !! ',newline
enddasa
Bandit.txt	dc.b	'WARNING: BYTE-BANDIT VIRUS DETECTED IN MEMORY !! ',newline
endbandit
Sca.txt		dc.b	'WARNING: SCA VIRUS DETECTED IN MEMORY !! ',newline
endsca
Northstar.txt	dc.b	'WARNING: NORTHSTAR VIRUS DETECTED IN MEMORY !! ',newline
endnorthstar

notfound	dc.b	'DASA virus         : not found',$a
		dc.b	'Byte-Bandit virus  : not found',$a
		dc.b	'SCA virus          : not found',$a
		dc.b	'SCA (mutant)       : not found',$a
		dc.b	'Northstar virus    : not found',$a
		dc.b	'Any Future Virus ! : not found',$a,$a
		dc.b	'All Execbase pointers are healthy... ',$a,$a
endnotfound
	
WritePro	dc.b	'Disk State (DF0:) : Disk is currently WRITE-PROTECTED ',$a,$a,$a
endpro

WriteEnbled	dc.b	'WARNING: This disk currently in drive 0 ( df0: ) is',$a
		dc.b	'write-enable. Note: I have checked the memory for ALL viruses',$a
		dc.b	'and there are -NONE- there,so you are o.k. but I still advise',$a
		dc.b	'you to write-protected your disks if you do not need to save ',$a
		dc.b	'anything to them !!',$a,$a
		dc.b	'WRITE-PROTECTION:',$a
		dc.b	'To write-protect a disk move the notch on the right ',$a
		dc.b	'hand size up,so you can see a through the hole. ',$a,$a
		dc.b	'««« Press left mouse button to continue »»» ',$a
endwrite
*******************************************************************************

* Virus detected,so clear execbase pointers and display an alert before reset *
*******************************************************************************

Reset:		move.l	4.w,a6
		moveq.l	#0,d0
		move.l	d0,coldcapture(a6)
		move.l	d0,coolcapture(a6)
		move.l	d0,warmcapture(a6)
		move.l	d0,kickmemptr(a6)
		move.l	d0,kicktagptr(a6)
		move.l	d0,kickchecksum(a6)
	
		move.l	4.w,a6
		lea	dosname(pc),a1
		moveq	#0,d0
		jsr	-408(a6)
		move.l	d0,dosbase
		beq.s	clearmem
	
		move.l	4.w,a6
		lea	IntName(pc),a1
		jsr	-408(a6)
		move.l	d0,intbase
		beq.s	clearmem
	
		move.l	d0,a6 
		moveq.l	#0,d0
		move.l	#$110,d1		;Size of AlertBox
		lea	Alert.txt(pc),a0
		jsr	-90(a6)

ClearMem	move.l	4.w,a6
		clr.l	$26(a6)
		move.l	$FC0004,$80.w
		trap	#0

*****************************************************************************
* text for VirusAlert 
*****************************************************************************

Alert.txt:          dc.b    0,$11,15
                    dc.b    'A L E R T        ­««««<<<<<-    W A R N I N G    ->>>>>»»»»­       A L E R T',0
                    dc.b    1,0
                    dc.b    $79
                    dc.b    $1F
                    dc.b    ' Virus Protector Detection Coding by Trev © 1991',0
                    dc.b    1
                    dc.b    0
                    dc.b    'U6A Virus Has Been Detected and killed from your Memory !!!',0
                    dc.b    1
                    dc.b    0
                    dc.b    'fFCheck Bootblocks Or Files On your disk(s) for A VIRUS ',0
                    dc.b    1
                    dc.b    0
                    dc.b    $99
                    dc.b    '^Execbase Vectors have now been restored ',0
                    dc.b    1
                    dc.b    0
                    dc.b    $20
                    dc.b    'v'						 
		    dc.b    'NOTE-: I will NOT continue as normal because the "Big Bad Virus" would',0
                    dc.b    1
                    dc.b    0
                    dc.b    $20
                    dc.b    $86
                    dc.b    'rewrite itself to your disk files and BOOTBLOCK!.Please reboot program',0
                    dc.b    1
                    dc.b    0
                    dc.b    $20
                    dc.b    $96
                    dc.b    'only off a clean disk.Warning ! Only cleared the virus out of memory!!',0
                    dc.b    1
                    dc.b    0
                    dc.b    $11
                    dc.b    $AF
                    dc.b    '   LEFT MOUSE BUTTON                                   RIGHT MOUSE BUTTON   ',0
                    dc.b    1
                    dc.b    0
                    dc.b    $11
                    dc.b    $BF
                    dc.b    'System Reset & restore                               System Reset & restore ',0
                    dc.b    1
                    dc.b    0
                    dc.b    $11
                    dc.b    $CF
                    dc.b    '     ALL Vectors                                          ALL Vectors       ',0
                    dc.b    1
                    dc.b    0
                    dc.b    $79
                    dc.b    $E6
                    dc.b    ' Virus Protector Detection Coding by Trev © 1991',0
                    dc.b    1
                    dc.b    0
                    dc.b    $11
                    dc.b    $F8
                    dc.b    'A L E R T        ­««««<<<<<-    W A R N I N G    ->>>>>»»»»­       A L E R T',0
                    even

Intname		dc.b	'intuition.library',0
		even
dosname		dc.b	'dos.library',0
		even
Intbase:	ds.l 1
DosBase:	ds.l 1

*****************************************************************************
* Define some Equ's for the Amiga Hardware References and libraries
*****************************************************************************
clearscreen	equ $9b489b4a
newline		equ $0a
Level3Vector	equ $6c
SysCop1		equ $26
_ciaa:		equ $bfe001
_ciab:		equ $bfd000
left		equ 6
coldcapture	equ $002a
coolcapture	equ $002e
warmcapture	equ $0032
kickmemptr	equ $0222
kicktagptr	equ $0226
kickchecksum	equ $022a
standard	equ $0

_custom:	equ $dff000
bltddat:	equ $000
dmaconr:	equ $002
vposr:		equ $004
vhposr:		equ $006
dskdatr:	equ $008
joy0dat:	equ $00a
joy1dat:	equ $00c
clxdat:		equ $00e
adkconr:	equ $010
pot0dat:	equ $012
pot1dat:	equ $014
potgor:		equ $016
serdatr:	equ $018
dskbytr:	equ $01a
intenar:	equ $01c
intreqr:	equ $01e
dskpth:		equ $020
dskptl:		equ $022
dsklen:		equ $024
dskdat:		equ $026
refptr:		equ $028
vposw:		equ $02a
vhposw:		equ $02c
copcon:		equ $02e
serdat:		equ $030
serper:		equ $032
potgo:		equ $034
joytest:	equ $036
strequ:		equ $038
strvbl:		equ $03a
strhor:		equ $03c
strlong:	equ $03e
bltcon0:	equ $040
bltcon1:	equ $042
bltafwm:	equ $044
bltalwm:	equ $046
bltcpth:	equ $048
bltcptl:	equ $04a
bltbpth:	equ $04c
bltbptl:	equ $04e
bltapth:	equ $050
bltaptl:	equ $052
bltdpth:	equ $054
bltdptl:	equ $056
bltsize:	equ $058
bltcmod:	equ $060
bltbmod:	equ $062
bltamod:	equ $064
bltdmod:	equ $066
bltcdat:	equ $070
bltbdat:	equ $072
bltadat:	equ $074
dsksync:	equ $07e
cop1lch:	equ $080
cop1lcl:	equ $082
cop2lch:	equ $084
cop2lcl:	equ $086
copjmp1:	equ $088
copjmp2:	equ $08a
copins:		equ $08c
diwstrt:	equ $08e
diwstop:	equ $090
ddfstrt:	equ $092
ddfstop:	equ $094
dmacon:		equ $096
clxcon:		equ $098
intena:		equ $09a
intreq:		equ $09c
adkcon:		equ $09e
aud0pth:	equ $0a0
aud0ptl:	equ $0a2
aud0len:	equ $0a4
aud0per:	equ $0a6
aud0vol:	equ $0a8
aud0dat:	equ $0aa
aud1pth:	equ $0b0
aud1ptl:	equ $0b2
aud1len:	equ $0b4
aud1per:	equ $0b6
aud1vol:	equ $0b8
aud1dat:	equ $0ba
aud2pth:	equ $0c0
aud2ptl:	equ $0c2
aud2len:	equ $0c4
aud2per:	equ $0c6
aud2vol:	equ $0c8
aud2dat:	equ $0ca
aud3pth:	equ $0d0
aud3ptl:	equ $0d2
aud3len:	equ $0d4
aud3per:	equ $0d6
aud3vol:	equ $0d8
aud3dat:	equ $0da
bpl1pth:	equ $0e0
bpl1ptl:	equ $0e2
bpl2pth:	equ $0e4
bpl2ptl:	equ $0e6
bpl3pth:	equ $0e8
bpl3ptl:	equ $0ea
bpl4pth:	equ $0ec
bpl4ptl:	equ $0ee
bpl5pth:	equ $0f0
bpl5ptl:	equ $0f2
bpl6pth:	equ $0f4
bpl6ptl:	equ $0f6
bplcon0:	equ $100
bplcon1:	equ $102
bplcon2:	equ $104
bpl1mod:	equ $108
bpl2mod:	equ $10a
bpl1dat:	equ $110
bpl2dat:	equ $112
bpl3dat:	equ $114
bpl4dat:	equ $116
bpl5dat:	equ $118
bpl6dat:	equ $11a
spr0pth:	equ $120
spr0ptl:	equ $122
spr1pth:	equ $124
spr1ptl:	equ $126
spr2pth:	equ $128
spr2ptl:	equ $12a
spr3pth:	equ $12c
spr3ptl:	equ $12e
spr4pth:	equ $130
spr4ptl:	equ $132
spr5pth:	equ $134
spr5ptl:	equ $136
spr6pth:	equ $138
spr6ptl:	equ $13a
spr7pth:	equ $13c
spr7ptl:	equ $13e
spr0pos:	equ $140
spr0ctl:	equ $142
spr0data:	equ $144
spr0datb:	equ $146
spr1pos:	equ $148
spr1ctl:	equ $14a
spr1data:	equ $14c
spr1datb:	equ $14e
spr2pos:	equ $150
spr2ctl:	equ $152
spr2data:	equ $154
spr2datb:	equ $156
spr3pos:	equ $158
spr3ctl:	equ $15a
spr3data:	equ $15c
spr3datb:	equ $15e
spr4pos:	equ $160
spr4ctl:	equ $162
spr4data:	equ $164
spr4datb:	equ $166
spr5pos:	equ $168
spr5ctl:	equ $16a
spr5data:	equ $16c
spr5datb:	equ $16e
spr6pos:	equ $170
spr6ctl:	equ $172
spr6data:	equ $174
spr6datb:	equ $176
spr7pos:	equ $178
spr7ctl:	equ $17a
spr7data:	equ $17c
spr7datb:	equ $17e
color00:	equ $180
color01:	equ $182
color02:	equ $184
color03:	equ $186
color04:	equ $188
color05:	equ $18a
color06:	equ $18c
color07:	equ $18e
color08:	equ $190
color09:	equ $192
color10:	equ $194
color11:	equ $196
color12:	equ $198
color13:	equ $19a
color14:	equ $19c
color15:	equ $19e
color16:	equ $1a0
color17:	equ $1a2
color18:	equ $1a4
color19:	equ $1a6
color20:	equ $1a8
color21:	equ $1aa
color22:	equ $1ac
color23:	equ $1ae
color24:	equ $1b0
color25:	equ $1b2
color26:	equ $1b4
color27:	equ $1b6
color28:	equ $1b8
color29:	equ $1ba
color30:	equ $1bc
color31:	equ $1be

Execute:	equ -222

*****************************************************************************
*       exec.lib.offsets
*****************************************************************************

AbsExecBase:	equ 4
forbid		equ -132
permit		equ -138

oldopenlibrary	equ -408


