aboutsummaryrefslogtreecommitdiff
path: root/os/shell
diff options
context:
space:
mode:
authorJames Barnett <noreply@jamesbarnett.xyz>2019-05-26 19:28:27 +0100
committerJames Barnett <noreply@jamesbarnett.xyz>2019-05-26 19:28:27 +0100
commitbd77381c27ef5b61bf1c123efef3895b98a7a615 (patch)
treeba798b442305ad4e174d79cf5bb7a822b7e1e2e9 /os/shell
parenteb4de24523e8f0832daae89a083844c8e9a261e9 (diff)
downloadtinyOS-bd77381c27ef5b61bf1c123efef3895b98a7a615.tar.xz
tinyOS-bd77381c27ef5b61bf1c123efef3895b98a7a615.zip
Proxy keypress from kernel to focused program
Diffstat (limited to 'os/shell')
-rw-r--r--os/shell/shell.c23
-rw-r--r--os/shell/shell.h3
2 files changed, 26 insertions, 0 deletions
diff --git a/os/shell/shell.c b/os/shell/shell.c
new file mode 100644
index 0000000..933b19c
--- /dev/null
+++ b/os/shell/shell.c
@@ -0,0 +1,23 @@
+#include "../../os/main.h"
+#include "../../kernel/gpu/text_mode/display.h"
+
+void keypress_handler(unsigned char key) {
+ switch(key)
+ {
+ case '\b':
+ scrn_backspace();
+ break;
+ case '\n':
+ scrn_newline();
+ break;
+ default:
+ scrn_putchar(key);
+ }
+}
+
+Program_t shell_run() {
+ Program_t this;
+ this.keypress_handler = keypress_handler;
+ this.name = "shell";
+ return this;
+} \ No newline at end of file
diff --git a/os/shell/shell.h b/os/shell/shell.h
new file mode 100644
index 0000000..2a8f508
--- /dev/null
+++ b/os/shell/shell.h
@@ -0,0 +1,3 @@
+#include "../../os/main.h"
+
+Program_t shell_run(); \ No newline at end of file