; BeRightBack Checking code
; 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 (27/12/98)

;already picked up on load address

.brb_text		dcb	"BASIC -quit ",0
			align

			funcName "brb_check"

.brb_check		mov	r0,#0	;position counter
			adr	r1,bufferTopOfFile_0
 			adr	r2,brb_text

 			ldr	r3,[r2]

.brb_check_again	cmp	r0,#1500
			movge	r0,#0
			movge	pc,r14	;out of buffer - return not found

			ldr	r4,[r1,r0]	;get byte from buffer
			teq	r3,r4

			addne	r0,r0,#4
			bne	brb_check_again

;matched first 4 bytes - do full check now - full thing is 12 bytes

			ldr	r3,[r2,#4]
			add	r0,r0,#4
			ldr	r4,[r1,r0]
			teq	r3,r4
			bne	brb_check_again

			ldr	r3,[r2,#8]
			add	r0,r0,#4
			ldr	r4,[r1,r0]
			teq	r3,r4

 			moveq	r0,#brb
 			ldmeqfd	r13!,{pc}	;found virus: unstack and
 						;return to caller

 			bne	brb_check_again



