aboutsummaryrefslogtreecommitdiff
path: root/src/keybuftest.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/keybuftest.c')
-rw-r--r--src/keybuftest.c51
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();
+ }
+}