sxkb
Sxkb is the Sphinx keyboard driver. It is functionally similar to comboKeyboard in the Object Exchange but, once installed, it occupies no hub memory except for one long used to communicate with the rest of the Propeller. It maintains a queue of up to 15 keystrokes in cog memory.
Programs that just want to use sxkb's functionality should use the sxkb interface object, isxkb. Only programs that need to install the sxkb driver, such as sphinx.bin, should use the sxkb object itself.
Spin interface methods
PUB start(pingroup) -- starts the keyboard driver. An even value for pingroup indicates a Demo/Protoboard-compatible keyboard interface; an odd value indicates a HYDRA-style keyboard interface.
PUB startx(pingroup, locks, auto) -- similar to start but also lets you specify lock key behavior and auto-repeat timing. See sxkb.spn for details.
PUB peekkey -- returns the next keycode but does not remove it from the queue. Returns 0 if no key pressed.
PUB key -- returns the next keycode. Returns 0 if no key pressed.
PUB getkey -- returns the next keycode. If no keys are in the queue, this method will wait until one is.
Implementation notes
The rendezvous location for sxkb is $7ff8.If no keyboard input is available, the value at the rendezvous remains 0. If keyboard input is available, sxkb stores the next keycode at the rendezvous.
A program consuming keyboard input should wait for a non-0 value at the rendezvous, read the non-0 keycode, then clear the rendezvous to 0 so that sxkb can set it to the next keycode.
Sxkb is a moderately modified version of comboKeyboard by Mike Green.