diff options
Diffstat (limited to 'src/vga.h')
-rw-r--r-- | src/vga.h | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -4,7 +4,7 @@ class VGA : public Console { public: /* Hardware text mode color constants. */ - enum vga_color { + enum vga_color : uint8_t { VGA_COLOR_BLACK = 0, VGA_COLOR_BLUE = 1, VGA_COLOR_GREEN = 2, @@ -26,14 +26,25 @@ public: VGA(vga_color fg = VGA_COLOR_BLACK, vga_color bg = VGA_COLOR_LIGHT_GREY, uint32_t address = 0xB8000); ~VGA() = default; + void set_color(vga_color fg, vga_color bg); + void write(char c) override; void write(ViewIterator& iter) override; - void set_color(vga_color fg, vga_color bg) { color = (fg | bg << 4); } + + struct Entry { + char c; + vga_color fg : 4; + vga_color bg : 4; + } __attribute((packed)); private: const size_t max_columns = 80, max_rows = 25; size_t column = 0, row = 0; - uint8_t color; - uint16_t* buffer; + + vga_color color_fg; + vga_color color_bg; + + Entry* buffer; }; + |