|
BB2 C port
API reference: Blitz libraries in C and the shared code
|
Macros | |
| #define | BLITZONLY ((void *)1) |
Functions | |
| void | dorstat (void) |
| RawStatus(Rawkey): whether a key is down. | |
| void | doblitzqualifier (void) |
| void | binkey (void) |
| BlitzKey: the next key from keyboard.device's buffer, -1 if none. | |
| void | dobkeys (WORD on) |
| BlitzKeys On|Off: BlitzKey as the input handler (Blitz mode only). | |
| void | doblitzrepeat (void) |
| BlitzRepeat Delay,Speed: does nothing (RTS). | |
| static void | codeinit (UBYTE *kd) |
| The init routine: remember keyboard.device and its key matrix. | |
| static UWORD | doblitzqualifier_c (void) |
| BlitzQualifier: the qualifier of the last key BlitzKey read. | |
| BLITZ_ALIAS (doblitzqualifier, doblitzqualifier_c) | |
Variables | |
| static UBYTE * | key |
| static UWORD | ison |
| static UWORD | bqual |
| UBYTE * | oldin |
| static WORD | matoff |
| #define BLITZONLY ((void *)1) |
| void binkey | ( | void | ) |
BlitzKey: the next key from keyboard.device's buffer, -1 if none.
Also the input handler's single character entry. Takes the next key down event from keyboard.device's buffer (+$70 read index, +$72 write index, entries {code.w, qualifier.w} at +$74, index + 4 & 127) and writes the read index for every entry it passes, also key up codes (bit 7, skipped; needed to get past them); $7D gives -1. The character comes from rawkeylib qconvertkey (+3) with the qualifier, which is also kept for BlitzQualifier. Keeps d1/a0-a1 (MOVEM).
The original's code, an assembler entry: Inkey$ calls it through the input handler, and as a C function behind a thunk it cost about 90 cycles more for "no key" (the call of the C function, the save of d2/d3). The upper words of d0 and d1 are the caller's (word loads); qconvertkey gets d0 = the code, d1 = the qualifier, a0 = the key data and the caller's a1 (it does not read a1).
The handler: -4 = BRA dobinkey2 (read a line through the old handler), 0 = binkey (one character).
Out: d0 the character, -1 = no key
| BLITZ_ALIAS | ( | doblitzqualifier | , |
| doblitzqualifier_c | ) |
|
static |
The init routine: remember keyboard.device and its key matrix.
Clears the BlitzKeys flag and the qualifier; matoff = $136 (exec V36+) or $106 (CMP #36,20(a0):BCC): the offset of the key matrix in keyboard.device.
| kd | a0: switchlib's init value, the keyboard.device base (!libs{switchlib,la0}; switchlib walks the device list) |
| void dobkeys | ( | WORD | on | ) |
BlitzKeys On|Off: BlitzKey as the input handler (Blitz mode only).
On installs binkey as input handler (inputoutputlib +3, TOK_setin) and keeps the old one in oldin; the handler's -4 entry (read a line) jumps to the -4 entry of the old handler. ison is toggled with NOT (On: $FFFF, only tested for 0; not a bug). Errors: Blitz mode only (err1 = 1). Off puts oldin back as the input handler (inputoutputlib +3) if BlitzKey is still the current one; an input the program chose after On (e.g. FileInput) stays. Fixed (#408): the original's Off only cleared the flag, the handler stayed, and a second On made oldin BlitzKey itself (a line read through the -4 entry then jumped to itself for ever).
| on | d0.w: 0 = Off, otherwise On |
| void doblitzqualifier | ( | void | ) |
|
static |
BlitzQualifier: the qualifier of the last key BlitzKey read.
MOVE bqual(pc),d0: a word function; the upper word of d0 is the caller's in the original and undefined here (the register rule; the compiler uses only d0.w).
| void doblitzrepeat | ( | void | ) |
BlitzRepeat Delay,Speed: does nothing (RTS).
| void dorstat | ( | void | ) |
RawStatus(Rawkey): whether a key is down.
Bit code&7 of byte code>>3 of keyboard.device's key matrix: the original's code (MOVE.l key(pc),a0 ... BTST d1,0(a0,d0.w):SNE d0:EXT d0), an assembler entry, as a C function it cost 100 cycles more. A word function: the upper word of d0 is the caller's (undefined by the register rule; the compiler uses only d0.w). Changes d0, d1 and a0 and keeps a1, which RILesDebugLib's SearchMem holds across it (KEEPS a1 in libs/tests/systest_cmdlibs.c).
In: d0.w the raw key code Out: d0.w -1 = down, 0 = up
|
static |
|
static |
|
static |
|
static |
| UBYTE* oldin |