4 ; Generic memory allocation for TermScript
9 ;----- Standard Header ------------------------------------------------------
16 ;----- External dependencies ------------------------------------------------
21 ;----- Main code ------------------------------------------------------------
23 AREA |TermScript$$Code|,CODE,READONLY
27 ; On entry: R0 == size of block to allocate
29 ; On exit: R0 == pointer to anchor for that block
32 ; Use: Tries to allocate a block of memory, and returns a pointer
33 ; to the anchor for that block. All very unusual really,
34 ; but we blame Wimp_Extension which allocates anchors for
35 ; you in an utterley horrible way.
41 ; --- For now, we will use the RMA ---
43 STMFD R13!,{R1-R3,R14}
51 LDMFD R13!,{R1-R3,PC}^
53 99mem_alloc MOV R0,#err_noMem
60 ; On entry: R0 == anchor of the block to free
64 ; Use: Frees the block.
69 STMFD R13!,{R0-R2,R14}
74 LDMFD R13!,{R0-R2,PC}^
80 ; On entry: R0 == pointer to block anchor
81 ; R1 == new size requested
83 ; On exit: May return an error
85 ; Use: Resizes a block
95 ;----- That's all, folks ----------------------------------------------------