#include "cga.h" #include "arch/ioport.h" namespace CGA { IOPort index_port = IOPort(0x3d4); IOPort data_port = IOPort(0x3d5); void writeCGAReg(int reg, int data){ index_port.outb(reg); data_port.outw(data); } uint16_t readCGAReg(int reg){ index_port.outb(reg); return data_port.inb(); } void setCursor(unsigned abs_x, unsigned abs_y) { uint16_t pos = abs_y * COLUMNS + abs_x; writeCGAReg(RegisterIndex::CURSOR_LOW, pos & 0xFF); writeCGAReg(RegisterIndex::CURSOR_HIGH, ((pos >> 8) & 0xFF)); } void getCursor(unsigned& abs_x, unsigned& abs_y) { uint16_t pos = readCGAReg(RegisterIndex::CURSOR_LOW); pos |= (readCGAReg(RegisterIndex::CURSOR_HIGH) << 8); abs_x = pos / 80; abs_y = pos % 80; } void show(unsigned abs_x, unsigned abs_y, char character, Attribute attrib) { (void)abs_x; (void)abs_y; (void)character; (void)attrib; } }; // namespace CGA