summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--stage3/font.c12
-rw-r--r--stage3/font.h1
-rw-r--r--stage3/main.c5
-rw-r--r--stage3/shell.c7
4 files changed, 18 insertions, 7 deletions
diff --git a/stage3/font.c b/stage3/font.c
index 67127f6..82b407b 100644
--- a/stage3/font.c
+++ b/stage3/font.c
@@ -68,6 +68,12 @@ void font_load_classic()
free(cfont);
}
+void font_clear_screen()
+{
+ cursor_x = cursor_y = 0;
+ gfx_set_area(0, 0, gfx_info->width, gfx_info->height, 0xFF000000);
+}
+
static void render_char(u8 c)
{
u16 base_x = cursor_x * outer_width;
@@ -94,10 +100,8 @@ static void fix_cursor()
cursor_y++;
}
- while (cursor_y >= screen_height) {
- gfx_set_area(0, 0, gfx_info->width, gfx_info->height, 0xFF000000);
- cursor_y -= screen_height;
- }
+ if (cursor_y >= screen_height)
+ font_clear_screen();
}
void print_char(char c)
diff --git a/stage3/font.h b/stage3/font.h
index 400fb3d..49b2817 100644
--- a/stage3/font.h
+++ b/stage3/font.h
@@ -7,6 +7,7 @@ void font_init();
void font_set_size(u16 size);
void font_load_blob(const void *blob);
void font_load_classic();
+void font_clear_screen();
void print(str line);
void print_char(char c);
diff --git a/stage3/main.c b/stage3/main.c
index 03a1db5..8b8654f 100644
--- a/stage3/main.c
+++ b/stage3/main.c
@@ -82,12 +82,11 @@ void kmain()
// heap init
MMAP heap_add_region(mreg);
- // gfx init
- gfx_set_area(0, 0, gfx_info->width, gfx_info->height, 0xFF000000);
-
+ // font init
font_init();
font_set_size(1);
font_load_classic();
+ font_clear_screen();
// memory map
print(S("memory map:\n"));
diff --git a/stage3/shell.c b/stage3/shell.c
index 9cfe833..f635e30 100644
--- a/stage3/shell.c
+++ b/stage3/shell.c
@@ -131,6 +131,12 @@ static void cmd_loadkeys(str arg)
}
}
+static void cmd_clear(str arg)
+{
+ (void) arg;
+ font_clear_screen();
+}
+
typedef struct {
str name;
void (*fn)(str arg);
@@ -145,6 +151,7 @@ static command registry[] = {
{ S("lspci"), &cmd_lspci },
{ S("run"), &cmd_run },
{ S("loadkeys"), &cmd_loadkeys },
+ { S("clear"), &cmd_clear },
};
void shell_run_cmd(str cmd)