|
BB2 C port
API reference: Blitz libraries in C and the shared code
|
#include "blitzlib.h"#include "blitzexec.h"#include <exec/interrupts.h>#include <proto/graphics.h>Data Structures | |
| struct | intnode |
Macros | |
| #define | __NOLIBBASE__ |
| #define | GRAPHICS_BASE_NAME gfx |
| #define | NODESIZE (sizeof(struct Interrupt) + 6) /* SizeOf.Interrupt+6 = 28 */ |
| #define | fints (allints) /* _bints: Blitz mode lists */ |
| #define | bints (allints + 16) /* (cleanup frees all 32) */ |
Functions | |
| void | setint (void) |
| void | clrint (void) |
| void | newint (void) |
| void | oldint (void) |
| oldint ($C103), the end of an interrupt handler: nothing to do. | |
| void | dovwait (void) |
| void | intlib_goblitz (void) |
| void | intlib_goamiga (void) |
| void | intlib_codeinit (void) |
| void | vwaitchk (void) |
| static void | cleanup (void) |
| Cleanup ($C105) at program end: remove the servers, free all nodes of both sets. | |
| static void | dovwait_c (UWORD n, struct GfxBase *gfx) |
| VWait [n] ($C104, Amiga mode): wait for n+1 vertical blanks. | |
| static void | b_dovwait_c (UWORD n) |
| VWait [n] ($C104, Blitz mode): wait for n+1 frames. | |
| void | b_dovwait (void) |
| static void | codeinit_c (void) |
| The library's init: zero out all ints (both sets, 32 lists), remember a5 (the program's globals) for the handlers. | |
| static void | intson (struct intnode **set) |
| static void | intsoff (struct intnode **set) |
| static void | newint_c (void) |
| newint ($C102), the start of an interrupt handler's code: a5 = the program's globals (remembered by init). | |
| static void | setint2 (UWORD level, ULONG code) |
| static void | setint_c (ULONG level, ULONG code) |
| SetInt level ($C100, Amiga mode): install an interrupt handler. | |
| static void | b_setint_c (ULONG level, ULONG code) |
| SetInt level ($C100, Blitz mode): as SetInt in Amiga mode, in the Blitz mode lists; the server is added now only if the blitz servers are on (SEQ dontdo: $FF00 = don't). | |
| void | b_setint (void) |
| static void | clrint2 (UWORD level) |
| static void | clrint_c (ULONG level) |
| ClrInt level ($C101, Amiga mode): remove the interrupt handlers of a level. | |
| static void | b_clrint_c (ULONG level) |
| ClrInt level ($C101, Blitz mode): as ClrInt in Amiga mode, in the Blitz mode lists; the servers are removed only if the blitz servers are on. | |
| void | b_clrint (void) |
| static void | goblitz_c (void) |
| goblitz ($C106, switchlib): going to Blitz mode, add the blitz servers (once). | |
| static void | goamiga_c (void) |
| goamiga ($C107, switchlib): back to Amiga mode, remove the blitz servers (if they are on). | |
| static void | vwaitchk_c (UWORD n) |
Variables | |
| static UWORD | dontdo |
| static UBYTE * | inta5 |
| static struct intnode * | allints [32] |
| static struct intnode ** | ints |
| static UWORD | blitzintson |
| #define __NOLIBBASE__ |
| #define GRAPHICS_BASE_NAME gfx |
| #define NODESIZE (sizeof(struct Interrupt) + 6) /* SizeOf.Interrupt+6 = 28 */ |
| void b_clrint | ( | void | ) |
|
static |
ClrInt level ($C101, Blitz mode): as ClrInt in Amiga mode, in the Blitz mode lists; the servers are removed only if the blitz servers are on.
| level | d0: the level as given to SetInt |
| void b_dovwait | ( | void | ) |
|
static |
VWait [n] ($C104, Blitz mode): wait for n+1 frames.
Polls VPOSR bit 0 (V8, vertical position >= 256): waits for it to become 1, then 0 again = one frame. Only d0 is changed by the original (DBF), so the thunk keeps d1/a0-a1.
| n | d0.w: the DBF count (0 = once, $FFFF = 65536 times) |
| void b_setint | ( | void | ) |
|
static |
SetInt level ($C100, Blitz mode): as SetInt in Amiga mode, in the Blitz mode lists; the server is added now only if the blitz servers are on (SEQ dontdo: $FF00 = don't).
| level | d0: the interrupt number (low 4 bits) |
| code | d1: the handler's code |
|
static |
Cleanup ($C105) at program end: remove the servers, free all nodes of both sets.
blitzintson is not reset (not a bug: a program ends in Amiga mode anyway). The original changes d0-d2/a0-a3/a6.
| void clrint | ( | void | ) |
|
static |
|
static |
ClrInt level ($C101, Amiga mode): remove the interrupt handlers of a level.
Every node of list level & 15 whose level word equals d0 (clrint2); the servers are removed at once.
| level | d0: the level as given to SetInt |
|
static |
The library's init: zero out all ints (both sets, 32 lists), remember a5 (the program's globals) for the handlers.
| void dovwait | ( | void | ) |
|
static |
VWait [n] ($C104, Amiga mode): wait for n+1 vertical blanks.
WaitTOF with the graphics base in a6 (!libs); the original (MOVE d0,d2) keeps no register but a6 and d3-d7/a2-a5. Errors (debugger, vwaitchk; both modes): "Can't VWait 0 Frames!" (#1201: the original had no check, VWait 0 waited 65536 frames).
| n | d0.w: the DBF count (0 = once, $FFFF = 65536 times) |
| gfx | a6: graphics.library |
|
static |
goamiga ($C107, switchlib): back to Amiga mode, remove the blitz servers (if they are on).
|
static |
goblitz ($C106, switchlib): going to Blitz mode, add the blitz servers (once).
| void intlib_codeinit | ( | void | ) |
| void intlib_goamiga | ( | void | ) |
| void intlib_goblitz | ( | void | ) |
|
static |
|
static |
| void newint | ( | void | ) |
|
static |
newint ($C102), the start of an interrupt handler's code: a5 = the program's globals (remembered by init).
| void oldint | ( | void | ) |
oldint ($C103), the end of an interrupt handler: nothing to do.
| void setint | ( | void | ) |
|
static |
|
static |
SetInt level ($C100, Amiga mode): install an interrupt handler.
A node (setint2) in the Amiga mode lists; the server is added at once. The allocation is not checked (#196, see setint2).
| level | d0: the interrupt number (low 4 bits; the other bits allow a selective ClrInt) |
| code | d1: the handler's code |
| void vwaitchk | ( | void | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |