aboutsummaryrefslogtreecommitdiff
path: root/os/main.c
diff options
context:
space:
mode:
authorJames Barnett <noreply@jamesbarnett.xyz>2019-10-06 15:53:52 +0100
committerJames Barnett <noreply@jamesbarnett.xyz>2019-10-06 15:53:52 +0100
commite77b371fb0fc4e62fa727a340b2e322fa60ebcff (patch)
tree78a278b63831a856e8d39bace88d12bb3a5a9b60 /os/main.c
parent64aa82592c6c2b043d8c62100d4ce110bf616c1e (diff)
downloadtinyOS-add-shell.tar.xz
tinyOS-add-shell.zip
Add command parsing and echo commandadd-shell
Diffstat (limited to 'os/main.c')
-rw-r--r--os/main.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/os/main.c b/os/main.c
index b04ee62..3e71c1e 100644
--- a/os/main.c
+++ b/os/main.c
@@ -57,6 +57,21 @@ void os_update_infobar_rc()
scrn_set_cursor_pos(curr_r, curr_c);
}
+void os_update_infobar_program() {
+ int curr_attr_byte = scrn_get_char_attr_byte();
+ int curr_r = scrn_get_cursor_row();
+ int curr_c = scrn_get_cursor_col();
+
+ scrn_set_text_colour(COLOUR_WHITE, COLOUR_BLUE);
+ scrn_set_cursor_pos(0, 11);
+ line_pad(64);
+ scrn_set_cursor_pos(0, 11);
+ scrn_print(focused_program.name);
+
+ scrn_set_char_attr_byte(curr_attr_byte);
+ scrn_set_cursor_pos(curr_r, curr_c);
+}
+
void os_init_infobar()
{
scrn_clear();
@@ -64,9 +79,7 @@ void os_init_infobar()
scrn_set_text_colour(COLOUR_WHITE, COLOUR_BLUE);
line_pad(80); // fill line
scrn_set_cursor_pos(0, 2);
- scrn_print("tinyOS");
- scrn_set_cursor_pos(0, 30);
- scrn_print("running: ");
+ scrn_print("tinyOS - ");
scrn_print(focused_program.name);
os_update_infobar_rc();
@@ -77,6 +90,7 @@ void os_init_infobar()
// TODO keep a stack of running programs
void os_update_focused_program(Program_t program) {
focused_program = program;
+ os_update_infobar_program();
}
// Send keypress from kernel to the currently focused programs keypress handler
@@ -87,11 +101,11 @@ void os_proxy_keypress(unsigned char key) {
void os_start()
{
- os_update_focused_program(shell_run());
scrn_enable_cursor(10, 12);
os_init_infobar();
os_show_splash();
- os_update_infobar_rc();
-}
+
+ os_update_focused_program(shell_run());
-// TODO display handling \ No newline at end of file
+ os_update_infobar_rc();
+} \ No newline at end of file