diff options
Diffstat (limited to 'drivers/cga.cc')
-rw-r--r-- | drivers/cga.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/cga.cc b/drivers/cga.cc index 6589cee..51b7221 100644 --- a/drivers/cga.cc +++ b/drivers/cga.cc @@ -21,31 +21,31 @@ constexpr uint8_t cursor_addr_l = 15; // 0xf * 1 1 | blink fast */ constexpr uint8_t cursor_hide = 0b00100000; -constexpr uint32_t address = 0xc03ff000; -CGA::CGA() { +void CGA::set_buffer(uint32_t address) { buffer = reinterpret_cast<Entry*>(address); + clear(); + enable_cursor(14, 15); + update_cursor(); +} - // clear buffer +void CGA::set_colour(Colour fg, Colour bg) { + colour_fg = fg; + colour_bg = bg; for (size_t y = 0; y < max_rows; y++) { for (size_t x = 0; x < max_columns; x++) { const size_t index = y * max_columns + x; - buffer[index].c = ' '; buffer[index].fg = colour_fg; buffer[index].bg = colour_bg; } } - - enable_cursor(14, 15); - update_cursor(); } -void CGA::set_colour(Colour fg, Colour bg) { - colour_fg = fg; - colour_bg = bg; +void CGA::clear() { for (size_t y = 0; y < max_rows; y++) { for (size_t x = 0; x < max_columns; x++) { const size_t index = y * max_columns + x; + buffer[index].c = ' '; buffer[index].fg = colour_fg; buffer[index].bg = colour_bg; } |