1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-26 19:18:08 +11:00
collapseos/emul/z80/ti84_kbd.h
Virgil Dupras 490eceab6d emul/z80: flatten directory structure
I'm about to reuse sdc.c in sms.c and the old directory structure
was becoming awkward.
2020-10-25 15:58:00 -04: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);