BB2 C port
API reference: Blitz libraries in C and the shared code
Loading...
Searching...
No Matches
varslib.c File Reference
#include "blitzlib.h"
#include "blitzexec.h"

Functions

void varslib_codeinit (void)
 init entry (thunk of codeinit_c).
static void codefinit (ULONG size)
 finit - free the global variables.
static ULONG codeinit_c (ULONG size)
 init - allocate the global variables.

Function Documentation

◆ codefinit()

void codefinit ( ULONG size)
static

finit - free the global variables.

Frees a5-$8000: ADD $8000,a1 adds the sign extended word -32768.

Parameters
sized0: the size of the globals, as given to codeinit

◆ codeinit_c()

ULONG codeinit_c ( ULONG size)
static

init - allocate the global variables.

Allocates the block (MEMF_PUBLIC | MEMF_CLEAR) and sets a5 (blitz_globals) to block+$8000, so the globals are addressed with signed 16 bit offsets.

Parameters
sized0: the size of the globals
Returns
d0: the new a5, 0 if there is no memory (the entry codeinit then ends the program)

◆ varslib_codeinit()

void varslib_codeinit ( void )

init entry (thunk of codeinit_c).

a0 is preserved. Without memory the original drops 12 bytes (saved a0, its own return address and the start code's return address) and so returns from the program start - the program ends.