; memory block scanning code for the VDEngine
; 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
; -------------------------------------------------------------------------



; move memory block into check buffers then perform /every/ check on it
; =>	R1 = memory block to play with
;	R2 = size of memory block

.memory_block_scan	;first copy the top buffer stuff
			mov		r0,#0	;counter
			adr		r3,bufferTopOfFile
			mov		r4,#FILE_TOP_BUFFER_SIZE
.memory_top_loop	ldr		r5,[r1,r0]
			str		r5,[r3,r0]
			add		r0,r0,#4
			cmp		r0,r4
			blt		memory_top_loop

; copy the bottom buffer in
			sub		r0,r1,#FILE_BOTTOM_BUFFER_SIZE
			adr		r3,bufferBottomOfFile
			mov		r4,r1
.memory_bottom_loop	ldr		r5,[r1,r0]
			str		r5,[r3,r0]
			add		r0,r0,#4
			cmp		r0,r4
			blt		memory_bottom_loop

;commence the scans
			b		scan4All
