; Extend Checking code (also checks for IRQFix)
; Slayer - a desktop anti-virus for RISC OS
; Copyright (C) 1996 - 2000 Kiwi Software (UK)
;
; 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
; 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; if not, write to the Free Software
; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
;
; info@kiwisoft.co.uk
; -------------------------------------------------------------------------


; created by Luke (1/10/98)

;look for the 'Extend	1.56 (08 Jul 1989)' in module header
;look for the 'IRQFix	1.56 (08 Jul 1989)' in module header
;look for the 'OhShit	3.32 (12 Oct 1993)' in module header
;look for the 'andrew	1.56 (08 Jul 1989)' in module header
;look for the 'Amigas	better than Arc's!' in module header

.extend_text		dcb	"Extend		1.56 (08 Jul 1989)"
			align


			funcName "extend_irqfix_check"

.extend_irqfix_check	adr	r1,bufferTopOfFile_56
 			adr	r2,extend_text

			;mov	r0,#0		;our counter
._strcmp_loop
#rept (24/4)
			ldr	r4, [r1], #4
			ldr	r5, [r1], #4
			teq	r4, r5
			bne	extend2_check
#endr
;#rept 26
#rept 2
			ldrb	r4, [r1], #1
			ldrb	r5, [r2], #1
			teq	r4, r5
			bne	extend2_check
#endr
			b	extend_grab_generation

 			;ldrb	r4,[r1,r0]
 			;ldrb	r5,[r2,r0]
			;teq	r4,r5
 			;bne	extend2_check		;no virus found return to other checks
 			;add	r0,r0,#1
 			;teq	r0,#26
 			;bne	_strcmp_loop
 			;b	extend_grab_generation

.extend2_text		dcb	"OhShit		3.32 (12 Oct 1993)"
			align


.extend2_check		adr	r2,extend2_text
			adr	r1,bufferTopOfFile_56

			;mov	r0,#0		;our counter

._strcmp_loop2
#rept (24/4)
			ldr	r4, [r1], #4
			ldr	r5, [r1], #4
			teq	r4, r5
			bne	extend3_check
#endr
;#rept 26
#rept 2
			ldrb	r4, [r1], #1
			ldrb	r5, [r2], #1
			teq	r4, r5
			bne	extend3_check
#endr
			b	extend_grab_generation

; 			ldrb	r4,[r1,r0]
; 			ldrb	r5,[r2,r0]
; 			teq	r4,r5
; 			bne	extend3_check		;no virus found return to other checks
; 			add	r0,r0,#1
; 			teq	r0,#26
; 			bne	_strcmp_loop2
; 			b	extend_grab_generation

.extend3_text		dcb	"andrew		1.56 (08 Jul 1989)"
			align


.extend3_check		adr	r2,extend3_text
			adr	r1,bufferTopOfFile_56

			;mov	r0,#0		;our counter
._strcmp_loop3
#rept (24/4)
			ldr	r4, [r1], #4
			ldr	r5, [r1], #4
			teq	r4, r5
			bne	extend4_check
#endr
;#rept 26
#rept 2
			ldrb	r4, [r1], #1
			ldrb	r5, [r2], #1
			teq	r4, r5
			bne	extend4_check
#endr
			b	extend_grab_generation

 			;ldrb	r4,[r1,r0]
 			;ldrb	r5,[r2,r0]
 			;teq	r4,r5
 			;bne	extend4_check		;no virus found return to other checks
 			;add	r0,r0,#1
 			;teq	r0,#26
 			;bne	_strcmp_loop3
 			;b	extend_grab_generation

.extend4_text		dcb	"Amigas		better than Arc's!"
			align


.extend4_check		adr	r2,extend4_text
			adr	r1,bufferTopOfFile_56

			;mov	r0,#0		;our counter
._strcmp_loop4
#rept (24/4)
			ldr	r4, [r1], #4
			ldr	r5, [r1], #4
			teq	r4, r5
			bne	irqfix_check
#endr
;#rept 26
#rept 2
			ldrb	r4, [r1], #1
			ldrb	r5, [r2], #1
			teq	r4, r5
			bne	irqfix_check
#endr
			b	extend_grab_generation


			;ldrb	r4,[r1,r0]
 			;ldrb	r5,[r2,r0]
 			;teq	r4,r5
 			;bne	irqfix_check		;no virus found return to other checks
 			;add	r0,r0,#1
 			;teq	r0,#26
 			;bne	_strcmp_loop4
 			;b	extend_grab_generation

.irqfix_text		dcb	"IRQfix		1.56 (08 Jul 1989)"
			align

.irqfix_check
			mov	r0,#no_virus

			adr	r2,irqfix_text
			adr	r1,bufferTopOfFile_56
#rept (24/4)
			ldr	r4, [r1], #4
			ldr	r5, [r1], #4
			teq	r4, r5
			movnes	pc, r14
#endr
;#rept 26
#rept 2
			ldrb	r4, [r1], #1
			ldrb	r5, [r2], #1
			teq	r4, r5
			movnes	pc, r14
#endr

			;strcmp	26

			b	irqfix_grab_generation

.extend_grab_generation	ldr	r0,bufferTopOfFile_52
			str	r0,generation_block
			mov	r0,#extend
 			ldmfd	r13!,{pc}	;found virus: unstack and
 						;return to caller

.irqfix_grab_generation	ldr	r0,bufferTopOfFile_52
			str	r0,generation_block
			mov	r0,#irqfix
 			ldmfd	r13!,{pc}	;found virus: unstack and
 						;return to caller



