pull/28/head
E. Almqvist 3 years ago
parent 21d8767ec8
commit 28aeaec396
  1. 14
      drivers/vga.c

@ -1,9 +1,6 @@
// VGA Graphics Library // VGA Graphics Library
#include "../kernel/io.h" #include "../kernel/io.h"
// VGA base address: 0xb8000
// Charpos = 0xb8000 + 2(row*80 + col)
// Memory // Memory
#define VGA_ADDRESS (char*)0xb8000 #define VGA_ADDRESS (char*)0xb8000
#define VGA_ADDRESS_MAX (char*)0xb8fa0 #define VGA_ADDRESS_MAX (char*)0xb8fa0
@ -11,7 +8,6 @@
#define MAX_ROWS 25 #define MAX_ROWS 25
#define MAX_COLS 80 #define MAX_COLS 80
// Global
static unsigned int cursor_row = 0; static unsigned int cursor_row = 0;
static unsigned int cursor_col = 0; static unsigned int cursor_col = 0;
@ -32,6 +28,11 @@ void writechar(char c, unsigned int col, unsigned int row, int attribute_byte) {
} }
void set_cursor_pos(unsigned int x, unsigned int y) {
cursor_col = x;
cursor_row = y;
}
/* /*
Graphics Functions Graphics Functions
*/ */
@ -50,11 +51,6 @@ void disable_vga_cursor() {
/* /*
General Printing Functions General Printing Functions
*/ */
void set_cursor_pos(unsigned int x, unsigned int y) {
cursor_col = x;
cursor_row = y;
}
void print(char* str, int attribute_byte) { void print(char* str, int attribute_byte) {
for( char* c = str; *c != '\0'; c++ ) for( char* c = str; *c != '\0'; c++ )
writechar(*c, (unsigned int)(c - str) + cursor_col, cursor_row, attribute_byte); writechar(*c, (unsigned int)(c - str) + cursor_col, cursor_row, attribute_byte);

Loading…
Cancel
Save