|
BB2 C port
API reference: Blitz libraries in C and the shared code
|
#include "blitzlib.h"Data Structures | |
| struct | maxs |
Functions | |
| void | setmaxs (void) |
| void | doallocst (void) |
| void | dofreest (void) |
| static ULONG | doallocst_c (const UBYTE *src, ULONG len) |
| allocst ($CF01) - copy a string into global memory. | |
| static void | dofreest_c (ULONG str) |
| freest ($CF02) - free a string copied by allocst. | |
| static void | setmaxs_c (const struct maxs *tab, UWORD n) |
| setmaxs ($CF00) - allocate the object arrays and global buffers of the program (called by the program start code, blitz2.s ~11236). | |
| void doallocst | ( | void | ) |
|
static |
allocst ($CF01) - copy a string into global memory.
The copy is length.l, the bytes, 0 (memlib globalloc, MEMF_PUBLIC). Keeps a0-a1 (MOVEM) and d2-d7/a2-a6: third-party libraries hold pointers in a0 (nGadTools, EFMUILib, LotanIntuition) and a1 (RIGTMenuLib, RomulusRequestLib, EFMUILib) across the call (analyse-internal-token-callers.md). d1 is free: the original returns d1 = -1 after copying (d1 = 0 if nothing was copied), no caller reads it.
| src | d0: the characters. |
| len | d1: the length; 0 allocates nothing. |
| void dofreest | ( | void | ) |
|
static |
freest ($CF02) - free a string copied by allocst.
Frees length + 5 bytes (memlib globfree). Keeps d0, a0-a1 and d2-d7/a2-a6: third-party libraries hold pointers in a0 (NeilsReqToolsLib) and a1 (LotanArray, RomulusRequestLib) across the call; LotanArray ArSet passes the d0 it leaves on to allocst as the source of a copy it overwrites, so d0 stays the string (the original returns memlib's d0 there; analyse-internal-token-callers.md). d1 is free: the original keeps it, no caller reads it.
| str | d0: the string (as allocst returned it); 0: nothing to do. |
| void setmaxs | ( | void | ) |
|
static |
setmaxs ($CF00) - allocate the object arrays and global buffers of the program (called by the program start code, blitz2.s ~11236).
Every entry gets size bytes (memlib globalloc, MEMF_PUBLIC|MEMF_CLEAR) at offset(a5). a0/a1 are kept (memlib's globalloc keeps them, so the original does). The original leaves a2 behind the table, d3 = last offset, d4.w = -1; the program start code does not use them (like staticslib).