aboutsummaryrefslogtreecommitdiff
path: root/os/main.c
blob: 905b0f70df6d11aea0c32eb0cb39eaa31983d817 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "../kernel/gpu/text_mode/display.h"
#include "../kernel/gpu/text_mode/colours.h"
#include "main.h"
#include "./shell/shell.h"

Program_t focused_program;

void os_show_splash()
{
  scrn_enable_cursor(10, 12);
  scrn_clear();
  scrn_set_text_colour(COLOUR_LIGHT_GREEN, COLOUR_BLACK);

  scrn_println("  _   _              ____   _____ ");
  scrn_println(" | | (_)            / __ \\ / ____|");
  scrn_println(" | |_ _ _ __  _   _| |  | | (___  ");
  scrn_println(" | __| | '_ \\| | | | |  | |\\___ \\ ");
  scrn_println(" | |_| | | | | |_| | |__| |____) |");
  scrn_println("  \\__|_|_| |_|\\__, |\\____/|_____/ ");
  scrn_println("               __/ |              ");
  scrn_println("              |___/               ");

  scrn_set_text_colour(COLOUR_WHITE, COLOUR_BLACK);
  scrn_newline();
}

void os_start()
{
  os_show_splash();
}

// TODO keep a stack of running programs
void os_update_focused_program(Program_t program) {
  focused_program = shell_run();
}

// Send keypress from kernel to the currently focused programs keypress handler
void os_proxy_keypress(unsigned char key) {
  (focused_program.keypress_handler)(key);
}

// TODO display handling