4 ; Operations on memory blocks (TMA)
6 ; © 1994-1998 Straylight
9 ;----- Licensing note -------------------------------------------------------
11 ; This file is part of Straylight's Sapphire library.
13 ; Sapphire is free software; you can redistribute it and/or modify
14 ; it under the terms of the GNU General Public License as published by
15 ; the Free Software Foundation; either version 2, or (at your option)
18 ; Sapphire is distributed in the hope that it will be useful,
19 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ; GNU General Public License for more details.
23 ; You should have received a copy of the GNU General Public License
24 ; along with Sapphire. If not, write to the Free Software Foundation,
25 ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 ;----- Standard header ------------------------------------------------------
32 ;----- External dependencies ------------------------------------------------
36 ;----- Main code ------------------------------------------------------------
38 AREA |Sapphire$$Code|,CODE,READONLY
42 ; On entry: R0 == pointer to a block of memory (word-aligned)
43 ; R1 == size of the block
44 ; R2 == word value to store in the block
48 ; Use: Initialises a block by filling every word within it with the
49 ; same value. This is normally 0, although maybe MOVS PC,#0
50 ; might be useful too.
55 STMFD R13!,{R0-R8,R14} ;Stack registers away
57 ; --- Set up seed value in lots of registers ---
69 00mem_set SUBS R1,R1,#32 ;Is there enough for fastblat
70 STMGEIA R0!,{R2-R8,R14} ;Yes -- *blat*
73 ; --- Now to word blats ---
75 ADD R1,R1,#32 ;How much left to do?
76 01mem_set SUBS R1,R1,#4 ;Enough for a word?
77 STRGE R14,[R0],#4 ;Yes -- store it
78 BGE %01mem_set ;And go round again
80 LDMFD R13!,{R0-R8,PC}^ ;Return to caller
84 ;----- That's all folks -----------------------------------------------------