#include "print.h" #define VGA_WIDTH 80 #define VGA_HEIGHT 25 char* vga_text_pos; void print_init(void) { vga_text_pos = (char*)0xb8000; } void print_newline(void) { vga_text_pos += 160 - ((vga_text_pos - (char*)0xb8000) % 160); } void print_clr(const char* string, enum VGA_FG_COLOR fg_color, enum VGA_BG_COLOR bg_color) { for (int i = 0; string[i]; i++) { *vga_text_pos++ = string[i]; *vga_text_pos++ = (bg_color << 4) | fg_color; } } void println_clr(const char* string, enum VGA_FG_COLOR fg_color, enum VGA_BG_COLOR bg_color) { print_clr(string, fg_color, bg_color); print_newline(); } void print(const char* string) { print_clr(string, VGA_FG_WHITE, VGA_BG_BLACK); } void println(const char* string) { println_clr(string, VGA_FG_WHITE, VGA_BG_BLACK); }