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

Macros

#define JOY0DAT_HI   (*(volatile UBYTE *)0xdff00a)
#define JOY0DAT_LO   (*(volatile UBYTE *)0xdff00b)

Functions

void dopointer (void)
void dopointer2 (void)
void domousearea (void)
void domousex (void)
 MouseX - the mouse's x position (Blitz mode only).
void domousey (void)
 MouseY - the mouse's y position (Blitz mode only).
void domousexs (void)
 MouseXSpeed - the last horizontal movement, the counter difference of the last vertical blank (Blitz mode only).
void domouseys (void)
 MouseYSpeed - the last vertical movement, the counter difference of the last vertical blank (Blitz mode only).
void doposmouse (void)
void mouselib_codeinit (void)
void mouselib_sspchk (void)
void domouse (WORD on)
 Mouse On|Off - read the mouse in the vertical blank interrupt (Blitz mode only).
void mouseint (void)
static void doposmouse_c (WORD x, WORD y)
 PositionMouse x,y - set the mouse position (Blitz and Amiga mode).
 BLITZ_ALIAS (doposmouse, doposmouse_c)
static void codeinit_c (WORD off)
 Library init - keep a5 and the offset of the used slice; mouse area 0,0,320,200, no Pointer.
static void dopointer_c (UWORD off, WORD chan, ULONG slice)
 Pointer Sprite#,Sprite Channel - show a sprite as the mouse pointer (Blitz mode only).
 BLITZ_ALIAS (dopointer, dopointer_c)
static void dopointer2_c (void)
 Pointer (no arguments) - no mouse sprite any more (Blitz mode only).
 BLITZ_ALIAS (dopointer2, dopointer2_c)
static void domousearea_c (WORD left, WORD top, WORD right, WORD bottom)
 MouseArea Minx,Miny,Maxx,Maxy - the area the mouse position is clipped to (Blitz and Amiga mode).
 BLITZ_ALIAS (domousearea, domousearea_c)
static WORD moveaxis (UBYTE now, UBYTE *last, WORD *speed, WORD pos, WORD min, WORD max)
static void showsprite (ULONG spr, ULONG x, ULONG y, ULONG chan)
static ULONG mouseint_c (void)
static void sspchk_c (WORD chan, const struct bb_slice *slice)
 The error check of Pointer Sprite#,Channel (debugger only).

Variables

static WORD mx
static WORD my
static UBYTE lx
static UBYTE ly
static WORD xs
static WORD ys
static WORD snum
static WORD cnum
static WORD minx
static WORD miny
static WORD maxx
static WORD maxy
static UBYTE * inta5
static ULONG uslice
static WORD sliceo

Macro Definition Documentation

◆ JOY0DAT_HI

#define JOY0DAT_HI   (*(volatile UBYTE *)0xdff00a)

◆ JOY0DAT_LO

#define JOY0DAT_LO   (*(volatile UBYTE *)0xdff00b)

Function Documentation

◆ BLITZ_ALIAS() [1/4]

BLITZ_ALIAS ( domousearea ,
domousearea_c  )

◆ BLITZ_ALIAS() [2/4]

BLITZ_ALIAS ( dopointer ,
dopointer_c  )

◆ BLITZ_ALIAS() [3/4]

BLITZ_ALIAS ( dopointer2 ,
dopointer2_c  )

◆ BLITZ_ALIAS() [4/4]

BLITZ_ALIAS ( doposmouse ,
doposmouse_c  )

◆ codeinit_c()

void codeinit_c ( WORD off)
static

Library init - keep a5 and the offset of the used slice; mouse area 0,0,320,200, no Pointer.

A nullsub with !libs{blitzcoplib,$0004}.

Parameters
offd0: the offset of blitzcoplib's "used slice" variable in the globals.

◆ domouse()

void domouse ( WORD on)

Mouse On|Off - read the mouse in the vertical blank interrupt (Blitz mode only).

On: SetInt (intlib $C100, BLibJsr) with mouseint on level $8015 (vertical blank); Off: ClrInt ($C101).

Fixed (#223): Mouse On initialises the last X counter from $DFF00B and the last Y counter from $DFF00A, as mouseint reads them; the original had them swapped, and the first interrupt moved the mouse by the difference of the two.

Parameters
ond0: On (<> 0) or Off (0).

◆ domousearea()

void domousearea ( void )

◆ domousearea_c()

void domousearea_c ( WORD left,
WORD top,
WORD right,
WORD bottom )
static

MouseArea Minx,Miny,Maxx,Maxy - the area the mouse position is clipped to (Blitz and Amiga mode).

The maximum is exclusive: the interrupt clips to Maxx-1, Maxy-1.

Parameters
leftd0: Minx.
topd1: Miny.
rightd2: Maxx.
bottomd3: Maxy.

◆ domousex()

void domousex ( void )

MouseX - the mouse's x position (Blitz mode only).

Result
d0: the position as a Quick (the value in the upper word).

◆ domousexs()

void domousexs ( void )

MouseXSpeed - the last horizontal movement, the counter difference of the last vertical blank (Blitz mode only).

Result
d0: the speed as a Quick (the value in the upper word).

◆ domousey()

void domousey ( void )

MouseY - the mouse's y position (Blitz mode only).

Result
d0: the position as a Quick (the value in the upper word).

◆ domouseys()

void domouseys ( void )

MouseYSpeed - the last vertical movement, the counter difference of the last vertical blank (Blitz mode only).

Result
d0: the speed as a Quick (the value in the upper word).

◆ dopointer()

void dopointer ( void )

◆ dopointer2()

void dopointer2 ( void )

◆ dopointer2_c()

void dopointer2_c ( void )
static

Pointer (no arguments) - no mouse sprite any more (Blitz mode only).

◆ dopointer_c()

void dopointer_c ( UWORD off,
WORD chan,
ULONG slice )
static

Pointer Sprite#,Sprite Channel - show a sprite as the mouse pointer (Blitz mode only).

The interrupt of Mouse On moves the sprite with the mouse, on the slice that was used when Pointer was called. Not a bug: the sprite number is the object offset >> 4 (offset = number * 16, LSR #4).

Errors (debugger only, sspchk): an uninitialized sprite or slice, or a channel the sprite does not fit in.

Parameters
offd0: the sprite's object offset (number * 16).
chand1: the sprite channel.
slicea2: the used slice (!libs blitzcoplib,$1202).

◆ doposmouse()

void doposmouse ( void )

◆ doposmouse_c()

void doposmouse_c ( WORD x,
WORD y )
static

PositionMouse x,y - set the mouse position (Blitz and Amiga mode).

MOVEM d0-d1,mx: only the position variables; it is not clipped to MouseArea here.

Parameters
xd0: the x position.
yd1: the y position.

◆ mouseint()

void mouseint ( void )

◆ mouseint_c()

ULONG mouseint_c ( void )
static

◆ mouselib_codeinit()

void mouselib_codeinit ( void )

◆ mouselib_sspchk()

void mouselib_sspchk ( void )

◆ moveaxis()

WORD moveaxis ( UBYTE now,
UBYTE * last,
WORD * speed,
WORD pos,
WORD min,
WORD max )
static

◆ showsprite()

void showsprite ( ULONG spr,
ULONG x,
ULONG y,
ULONG chan )
static

◆ sspchk_c()

void sspchk_c ( WORD chan,
const struct bb_slice * slice )
static

The error check of Pointer Sprite#,Channel (debugger only).

The sprite's channels (word at +6) from d1 on must fit the slice's (word at +6).

Errors: "Uninitialized Sprite", "Uninitialized Slice", "Sprite Channel Unavailable".

Parameters
chand1: the sprite channel.
slicea2: the used slice; a3 = the sprite.

Variable Documentation

◆ cnum

WORD cnum
static

◆ inta5

UBYTE* inta5
static

◆ lx

UBYTE lx
static

◆ ly

UBYTE ly
static

◆ maxx

WORD maxx
static

◆ maxy

WORD maxy
static

◆ minx

WORD minx
static

◆ miny

WORD miny
static

◆ mx

WORD mx
static

◆ my

WORD my
static

◆ sliceo

WORD sliceo
static

◆ snum

WORD snum
static

◆ uslice

ULONG uslice
static

◆ xs

WORD xs
static

◆ ys

WORD ys
static