#include #include #include #include #include static uint16_t *buffer = (uint16_t*) 0xC03FF000; static uint8_t start, end; void vgatext_write(char c, enum vga_color color, uint8_t x, uint8_t y) { const size_t index = y * VGA_TEXT_W + x; buffer[index] = c | (uint16_t) color << 8; } void vgatext_write_data(uint16_t data, uint16_t index) { buffer[index] = data; } void vgatext_write_buf(const uint16_t *src) { memcpy(buffer, src, VGA_TEXT_W * VGA_TEXT_H * sizeof(uint16_t)); } void vgatext_cur_mov(uint8_t x, uint8_t y) { const uint16_t pos = y * VGA_TEXT_W + x; outb(0x3D4, 0x0F); outb(0x3D5, (uint8_t) (pos & 0xFF)); outb(0x3D4, 0x0E); outb(0x3D5, (uint8_t) ((pos >> 8) & 0xFF)); } void vgatext_cur_resize(uint8_t s, uint8_t e) { start = s; end = e; outb(0x3D4, 0x0A); outb(0x3D5, (inb(0x3D5) & 0xC0) | start); outb(0x3D4, 0x0B); outb(0x3D5, (inb(0x3D5) & 0xE0) | end); } void vgatext_cur_visible(bool visible) { if (visible) { vgatext_cur_resize(start, end); } else { outb(0x3D4, 0x0A); outb(0x3D5, 0x20); } }