diff options
| author | James Barnett <noreply@jamesbarnett.xyz> | 2019-05-26 15:32:53 +0100 |
|---|---|---|
| committer | James Barnett <noreply@jamesbarnett.xyz> | 2019-05-26 15:32:53 +0100 |
| commit | c68b5b688db76e00126302bbac669a5639949943 (patch) | |
| tree | 1260c4fc3c4ea24a5bdfbcc3652670e33a74d71c /kernel/io/vga/text_mode_display.c | |
| parent | ef0c2b2bfe2de7721674521f11c583f943f77461 (diff) | |
| download | tinyOS-c68b5b688db76e00126302bbac669a5639949943.tar.xz tinyOS-c68b5b688db76e00126302bbac669a5639949943.zip | |
Reorganise files
Diffstat (limited to 'kernel/io/vga/text_mode_display.c')
| -rw-r--r-- | kernel/io/vga/text_mode_display.c | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/kernel/io/vga/text_mode_display.c b/kernel/io/vga/text_mode_display.c deleted file mode 100644 index db0e028..0000000 --- a/kernel/io/vga/text_mode_display.c +++ /dev/null @@ -1,64 +0,0 @@ -#include "colours.h" - -#define COLS (80 * 2) // 2 bytes per char -#define ROWS 25 -#define FRAME_SIZE (ROWS * COLS) - -char *video_ram = (char *) 0xB8000; -int cursor_pos = 0; -int char_attribute_byte = 0x07; - -void vga_clear_screen() -{ - for (int i = 0; i < FRAME_SIZE; i = i + 2) - { - video_ram[i] = ' '; - video_ram[i + 1] = char_attribute_byte; - }; - cursor_pos = 0; -} - -void vga_print(char *msg) -{ - int j = 0; - while (msg[j] != '\0') - { - video_ram[cursor_pos++] = msg[j]; - video_ram[cursor_pos++] = char_attribute_byte; - ++j; - } -} - -void vga_print_ln(char *msg) -{ - vga_print(msg); - int current_line = cursor_pos / COLS; - cursor_pos = (current_line + 1) * COLS; -} - -void vga_set_text_colour(int foreground, int background) -{ - char_attribute_byte = (background << 4) | foreground; -} - -void vga_print_raw(unsigned char byte) -{ - video_ram[cursor_pos++] = byte; - video_ram[cursor_pos++] = char_attribute_byte; -} - -// TODO - jump cursor to prev non 0 text char rather than reversing through whole array -void vga_backspace() -{ - if (cursor_pos != 0) - { - video_ram[--cursor_pos] = char_attribute_byte; - video_ram[--cursor_pos] = 0; - } -} - -void vga_newline() -{ - int current_line = cursor_pos / COLS; - cursor_pos = (current_line + 1) * COLS; -}
\ No newline at end of file |