diff options
author | B. Watson <yalhcru@gmail.com> | 2019-03-13 02:50:42 -0400 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2019-03-13 02:50:42 -0400 |
commit | 2973d0c78e9b8eed3c5af239927c6bd36af64604 (patch) | |
tree | a0fdfe7201303edd11c6d86015ef4f79796fcf0f /src/keybuf.h | |
download | fujichat-2973d0c78e9b8eed3c5af239927c6bd36af64604.tar.gz |
initial commit
Diffstat (limited to 'src/keybuf.h')
-rw-r--r-- | src/keybuf.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/keybuf.h b/src/keybuf.h new file mode 100644 index 0000000..1430ef4 --- /dev/null +++ b/src/keybuf.h @@ -0,0 +1,26 @@ + +/* Dead simple keyboard buffer mechanism + + Call keybuf_init() at startup + + During busy loops, periodically call keybuf_poll_kbd(), + which will buffer keystrokes as they're pressed. + + When ready to read the keyboard, call keybuf_cgetc() + Return value is 0 for no key pressed and no keys in buffer, + or else the ASCII code of the next key. + + Also, can call keybuf_is_empty() to find out whether the + buffer's got anything in it. + + It would be possible to have the OS periodically call + keybuf_poll_kbd() for us, using one of the countdown timers. + For now, not going to do this, as it adds complexity and + fujichat only has 2 or 3 places that count as busy + loops. + */ + +void __fastcall__ keybuf_init(void); +void __fastcall__ keybuf_poll_kbd(void); +char __fastcall__ keybuf_is_empty(void); +char __fastcall__ keybuf_cgetc(void); |