#include "vga.h" #include #include struct __attribute__((packed)) VGAEntry { unsigned char text; uint8_t foreground : 4; uint8_t background : 4; }; _Static_assert(sizeof(struct VGAEntry) == 2); const size_t width = 80; const size_t height = 25; struct VGAEntry *buffer; void vga_init() { buffer = (struct VGAEntry *)0xc03ff000; vga_clear(VGA_COLOR_LIGHT_BLUE, VGA_COLOR_LIGHT_GREY); } void vga_clear(enum vga_color foreground, enum vga_color background) { for (size_t y = 0; y < height; ++y) for (size_t x = 0; x < width; ++x) { const size_t index = y * width + x; buffer[index].text = ' '; buffer[index].foreground = foreground; buffer[index].background = background; } }