Initial revision
[ssr] / StraySrc / Libraries / Sapphire / sail / sh / mem
1 ;
2 ; mem.sh
3 ;
4 ; Generic memory allocation for TermScript
5 ;
6 ; © 1995 Straylight
7 ;
8
9 ;----- Overview -------------------------------------------------------------
10 ;
11 ; Functions provided:
12 ;
13 ; mem_alloc
14 ; mem_free
15 ; mem_realloc
16
17 [ :LNOT::DEF:mem__dfn
18 GBLL mem__dfn
19
20 ; --- mem_alloc ---
21 ;
22 ; On entry: R0 == size of block to allocate
23 ;
24 ; On exit: R0 == pointer to anchor for that block
25 ; May return an error
26 ;
27 ; Use: Tries to allocate a block of memory, and returns a pointer
28 ; to the anchor for that block. All very unusual really,
29 ; but we blame Wimp_Extension which allocates anchors for
30 ; you in an utterley horrible way.
31
32
33 IMPORT mem_alloc
34
35 ; --- mem_free ---
36 ;
37 ; On entry: R0 == anchor of the block to free
38 ;
39 ; On exit: --
40 ;
41 ; Use: Frees the block.
42
43 IMPORT mem_free
44
45 ; --- mem_realloc ---
46 ;
47 ; On entry: R0 == pointer to block anchor
48 ; R1 == new size requested
49 ;
50 ; On exit: May return an error
51 ;
52 ; Use: Resizes a block
53
54 IMPORT mem_realloc
55
56 ]
57
58 ;----- That's all, folks ----------------------------------------------------
59
60 END