summaryrefslogtreecommitdiff
path: root/src/vga.c
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2017-05-01 16:45:04 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2017-05-01 16:45:04 +0200
commit8d675a7201780c1ef18c7cd22c3e53cfefe98285 (patch)
tree67a656c25b7fea2b15460dd13f8cdd241d56b5bd /src/vga.c
parent081dc76440b114fd7033868bc858710091e115d2 (diff)
downloadabaos-8d675a7201780c1ef18c7cd22c3e53cfefe98285.tar.gz
abaos-8d675a7201780c1ef18c7cd22c3e53cfefe98285.tar.bz2
playing with vga struct, fixed some boot loading issues
Diffstat (limited to 'src/vga.c')
-rw-r--r--src/vga.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/vga.c b/src/vga.c
index 26208a0..77ef043 100644
--- a/src/vga.c
+++ b/src/vga.c
@@ -1 +1,32 @@
#include "vga.h"
+
+#include "string.h"
+
+void vga_init( vga_t *vga )
+{
+ memset( vga, 0, sizeof( vga_t ) );
+
+ vga->res_x = VGA_DEFAULT_RES_X;
+ vga->res_y = VGA_DEFAULT_RES_Y;
+
+ // TODO: get current position from VGA hardware
+ //~ vga_set_cursor( vga, 0, 0 );
+};
+
+void vga_clear_screen( vga_t *vga )
+{
+ volatile uint8_t *VIDEO_MEMORY = (uint8_t *)0xb8000;
+
+ for( int i = 0; i < 2 * ( vga->res_x * vga->res_y ); i += 2 ) {
+ *(VIDEO_MEMORY+i) = ' ';
+ *(VIDEO_MEMORY+i+1) = 0x4f;
+ }
+
+ //~ vga_set_cursor( vga, 0, 0 );
+}
+
+void vga_set_cursor( vga_t *vga, int x, int y )
+{
+ vga->cursor_x = x;
+ vga->cursor_y = y;
+}