BB2 C port
API reference: Blitz libraries in C and the shared code
Loading...
Searching...
No Matches
maxslib.c File Reference
#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).

Function Documentation

◆ doallocst()

void doallocst ( void )

◆ doallocst_c()

ULONG doallocst_c ( const UBYTE * src,
ULONG len )
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.

Parameters
srcd0: the characters.
lend1: the length; 0 allocates nothing.
Returns
d0: the copy (points to the bytes), 0 for length 0.

◆ dofreest()

void dofreest ( void )

◆ dofreest_c()

void dofreest_c ( ULONG str)
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.

Parameters
strd0: the string (as allocst returned it); 0: nothing to do.

◆ setmaxs()

void setmaxs ( void )

◆ setmaxs_c()

void setmaxs_c ( const struct maxs * tab,
UWORD n )
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).

Parameters
taba2: the table of {offset.w, size.l}.
nd4.w: the number of entries - 1.