From bd77381c27ef5b61bf1c123efef3895b98a7a615 Mon Sep 17 00:00:00 2001 From: James Barnett Date: Sun, 26 May 2019 19:28:27 +0100 Subject: Proxy keypress from kernel to focused program --- os/shell/shell.c | 23 +++++++++++++++++++++++ os/shell/shell.h | 3 +++ 2 files changed, 26 insertions(+) create mode 100644 os/shell/shell.c create mode 100644 os/shell/shell.h (limited to 'os/shell') 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 -- cgit v1.2.3