aboutsummaryrefslogtreecommitdiff
path: root/kernel/io/vga/text_mode_display.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/io/vga/text_mode_display.c')
-rw-r--r--kernel/io/vga/text_mode_display.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/kernel/io/vga/text_mode_display.c b/kernel/io/vga/text_mode_display.c
index bfee909..db0e028 100644
--- a/kernel/io/vga/text_mode_display.c
+++ b/kernel/io/vga/text_mode_display.c
@@ -4,7 +4,7 @@
#define ROWS 25
#define FRAME_SIZE (ROWS * COLS)
-char *video_ram = (char *)0xB8000;
+char *video_ram = (char *) 0xB8000;
int cursor_pos = 0;
int char_attribute_byte = 0x07;
@@ -45,4 +45,20 @@ 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