diff options
author | Tyler Murphy <=> | 2023-07-17 19:34:52 -0400 |
---|---|---|
committer | Tyler Murphy <=> | 2023-07-17 19:34:52 -0400 |
commit | 7a912d1b668ab86ffe088eca3ac7e6f78a04a0c5 (patch) | |
tree | 4e86ff20e73171285156631db043e12aaf63bf04 /kernel/src/tty/term.c | |
parent | paging (diff) | |
download | finix-7a912d1b668ab86ffe088eca3ac7e6f78a04a0c5.tar.gz finix-7a912d1b668ab86ffe088eca3ac7e6f78a04a0c5.tar.bz2 finix-7a912d1b668ab86ffe088eca3ac7e6f78a04a0c5.zip |
refactoring
Diffstat (limited to '')
-rw-r--r-- | kernel/src/term.c (renamed from kernel/src/tty/term.c) | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/kernel/src/tty/term.c b/kernel/src/term.c index a7451d2..4b42a6a 100644 --- a/kernel/src/tty/term.c +++ b/kernel/src/term.c @@ -5,12 +5,10 @@ #include <sys.h> #include <print.h> +#include "drivers/vga.h" #include "term.h" -#include "color.h" -#include "cursor.h" uint16_t buffer[TERM_W * TERM_H * sizeof(uint16_t)]; -uint16_t *front; uint8_t x, y; uint8_t color; @@ -28,7 +26,6 @@ static void term_clear_line(int y) { void term_init (void) { x = 0; y = 0; - front = (uint16_t*) 0xC03FF000; term_setfg(VGA_WHITE); term_setbg(VGA_BLACK); term_clear(); @@ -37,11 +34,11 @@ void term_init (void) { void term_setpos(uint8_t xp, uint8_t yp) { x = xp; y = yp; - cursor_setpos(x, y); + vgatext_cur_mov(x, y); } void term_scroll (int lines) { - int_disable(); + arch_disable_int(); y -= lines; if (!lines) return; if(lines >= TERM_H || lines <= -TERM_H) { @@ -52,14 +49,14 @@ void term_scroll (int lines) { } else { memmove(buffer + lines * TERM_W, buffer + lines, (TERM_H + lines) * TERM_W); } - int_enable(); + arch_enable_int(); } -void term_setfg(enum VGAColor c) { +void term_setfg(enum vga_color c) { color = (color & 0xF0) | c; } -void term_setbg(enum VGAColor c) { +void term_setbg(enum vga_color c) { color = (color & 0x0F) | c << 4; } @@ -80,7 +77,7 @@ void term_load(uint32_t state) { x = (uint8_t) (state >> 16); y = (uint8_t) (state >> 8); color = (uint8_t) (state >> 0); - cursor_setpos(x, y); + vgatext_cur_mov(x, y); } uint16_t term_save_col(void) { @@ -124,7 +121,7 @@ void putchar(int c) { y = TERM_H - 1; } - cursor_setpos(x, y); + vgatext_cur_mov(x, y); } bool term_newline(void) { @@ -132,7 +129,7 @@ bool term_newline(void) { } void term_flush(void) { - int_disable(); - memcpy(front, buffer, TERM_W * TERM_H * sizeof(uint16_t)); - int_enable(); + arch_disable_int(); + vgatext_write_buf(buffer); + arch_enable_int(); } |