toolboxmem 1.32 KB
Newer Older
Stewart Brodie's avatar
Stewart Brodie committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
; Copyright 1998 Acorn Computers Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
;     http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
; File:    toolboxmem.s
; Purpose: veneers onto Toolbox memory allocation SWIs
; Author:  Kevin Bracey
; History: 22-Nov-96: KJB:   created

XToolbox_Memory * &64EF9

	AREA	|ToolboxMemCode|,CODE,READONLY,PIC

	EXPORT	toolbox_memory_alloc
	EXPORT	toolbox_memory_free
	EXPORT	toolbox_memory_extend

28 29 30 31 32 33 34 35 36
        MACRO
        MOVRet  $cond
        [ {CONFIG}=26
        MOV$cond.S    pc,r12
        |
        MOV$cond      pc,r12
        ]
        MEND

Stewart Brodie's avatar
Stewart Brodie committed
37 38 39 40 41 42
toolbox_memory_alloc
	MOV	R12,LR
	MOV	R1,R0
	MOV	R0,#0
	SWI	XToolbox_Memory
	MOVVS	R0,#0
43
        MOVRet
Stewart Brodie's avatar
Stewart Brodie committed
44 45 46 47 48 49

toolbox_memory_free
	MOV	R12,LR
	MOV	R1,R0
	MOV	R0,#1
	SWI	XToolbox_Memory
50
        MOVRet
Stewart Brodie's avatar
Stewart Brodie committed
51 52 53 54 55 56 57 58

toolbox_memory_extend
	MOV	R12,LR
	MOV	R2,R1
	MOV	R1,R0
	MOV	R0,#2
	SWI	XToolbox_Memory
	MOVVS	R0,#0
59
        MOVRet
Stewart Brodie's avatar
Stewart Brodie committed
60 61

	END