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/keybuftest.c | |
download | fujichat-2973d0c78e9b8eed3c5af239927c6bd36af64604.tar.gz |
initial commit
Diffstat (limited to 'src/keybuftest.c')
-rw-r--r-- | src/keybuftest.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/keybuftest.c b/src/keybuftest.c new file mode 100644 index 0000000..4ea7f12 --- /dev/null +++ b/src/keybuftest.c @@ -0,0 +1,51 @@ +#include <stdio.h> +#include <peekpoke.h> +#include <conio.h> + +#include "keybuf.h" + +#define RTCLOK 0x14 + +void read_input(void) { + char got[20]; + char c, *p = got; + + while( (c = keybuf_cgetc()) ) + putchar(c); + + // *p++ = c; + + /* + *p = '\0'; + + if(p != got) + fputs(got, stdout); + */ +} + +void process(void) { + POKE(RTCLOK, 0); + while(PEEK(RTCLOK) < 30) { + keybuf_poll_kbd(); + } +} + +void idle(void) { + char c; + POKE(RTCLOK, 0); + while(PEEK(RTCLOK) < 30) { + if( (c = keybuf_cgetc()) ) + putchar(c); + } +} + +void main(void) { + cursor(1); + keybuf_init(); + + while(1) { + process(); + read_input(); + idle(); + } +} |