1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-08 10:38:06 +11:00
collapseos/emul/hw/ti/kbd.h
Virgil Dupras 9216057db8 emul/hw: add TI-84+ emulator
I implement the screen using XCB which is much more friendly
than z80e's SDL+CMake for development machines that want to install
minimal dependencies (for example, a port-less OpenBSD rig).
2020-01-01 22:48:01 -05:00

26 lines
798 B
C

#include <stdint.h>
#include <stdbool.h>
// These are keycodes for special keys
#define KBD_ALPHA 0x57
#define KBD_2ND 0x65
// NOTE: We don't manage the ON key here.
typedef struct {
// Bitmask of pressed keys. Like on real hardware, 0xff means nothing
// pressed. The group 7 has no key, but for code simplicity, we have a neat
// array of 8 bytes.
uint8_t pressed[8];
// Selected groups. Active low.
uint8_t selected;
} KBD;
void kbd_init(KBD *kbd);
uint8_t kbd_rd(KBD *kbd);
void kbd_wr(KBD *kbd, uint8_t val);
// The key is separated in two nibble. High nibble is group, low nibble is key.
void kbd_setkey(KBD *kbd, uint8_t key, bool pressed);
// Attempts to returns a key code corresponding to the specified char. 0 if
// nothing matches.
uint8_t kbd_trans(char c);