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

Macro Definition Documentation

◆ __NOLIBBASE__

#define __NOLIBBASE__

◆ bints

#define bints   (allints + 16) /* (cleanup frees all 32) */

◆ fints

#define fints   (allints) /* _bints: Blitz mode lists */

◆ GRAPHICS_BASE_NAME

#define GRAPHICS_BASE_NAME   gfx

◆ NODESIZE

#define NODESIZE   (sizeof(struct Interrupt) + 6) /* SizeOf.Interrupt+6 = 28 */

Function Documentation

◆ b_clrint()

void b_clrint ( void )

◆ b_clrint_c()

void b_clrint_c ( ULONG level)
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.

Parameters
leveld0: the level as given to SetInt

◆ b_dovwait()

void b_dovwait ( void )

◆ b_dovwait_c()

void b_dovwait_c ( UWORD n)
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.

Parameters
nd0.w: the DBF count (0 = once, $FFFF = 65536 times)

◆ b_setint()

void b_setint ( void )

◆ b_setint_c()

void b_setint_c ( ULONG level,
ULONG code )
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).

Parameters
leveld0: the interrupt number (low 4 bits)
coded1: the handler's code

◆ cleanup()

void cleanup ( void )
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.

◆ clrint()

void clrint ( void )

◆ clrint2()

void clrint2 ( UWORD level)
static

◆ clrint_c()

void clrint_c ( ULONG level)
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.

Parameters
leveld0: the level as given to SetInt

◆ codeinit_c()

void codeinit_c ( void )
static

The library's init: zero out all ints (both sets, 32 lists), remember a5 (the program's globals) for the handlers.

◆ dovwait()

void dovwait ( void )

◆ dovwait_c()

void dovwait_c ( UWORD n,
struct GfxBase * gfx )
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).

Parameters
nd0.w: the DBF count (0 = once, $FFFF = 65536 times)
gfxa6: graphics.library

◆ goamiga_c()

void goamiga_c ( void )
static

goamiga ($C107, switchlib): back to Amiga mode, remove the blitz servers (if they are on).

◆ goblitz_c()

void goblitz_c ( void )
static

goblitz ($C106, switchlib): going to Blitz mode, add the blitz servers (once).

◆ intlib_codeinit()

void intlib_codeinit ( void )

◆ intlib_goamiga()

void intlib_goamiga ( void )

◆ intlib_goblitz()

void intlib_goblitz ( void )

◆ intsoff()

void intsoff ( struct intnode ** set)
static

◆ intson()

void intson ( struct intnode ** set)
static

◆ newint()

void newint ( void )

◆ newint_c()

void newint_c ( void )
static

newint ($C102), the start of an interrupt handler's code: a5 = the program's globals (remembered by init).

◆ oldint()

void oldint ( void )

oldint ($C103), the end of an interrupt handler: nothing to do.

◆ setint()

void setint ( void )

◆ setint2()

void setint2 ( UWORD level,
ULONG code )
static

◆ setint_c()

void setint_c ( ULONG level,
ULONG code )
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).

Parameters
leveld0: the interrupt number (low 4 bits; the other bits allow a selective ClrInt)
coded1: the handler's code

◆ vwaitchk()

void vwaitchk ( void )

◆ vwaitchk_c()

void vwaitchk_c ( UWORD n)
static

Variable Documentation

◆ allints

struct intnode* allints[32]
static

◆ blitzintson

UWORD blitzintson
static

◆ dontdo

UWORD dontdo
static

◆ inta5

UBYTE* inta5
static

◆ ints

struct intnode** ints
static