aboutsummaryrefslogtreecommitdiff
path: root/vga.cc
diff options
context:
space:
mode:
Diffstat (limited to 'vga.cc')
-rw-r--r--vga.cc41
1 files changed, 13 insertions, 28 deletions
diff --git a/vga.cc b/vga.cc
index a696d77..83d0060 100644
--- a/vga.cc
+++ b/vga.cc
@@ -11,7 +11,7 @@ constexpr uint16_t vga_entry(unsigned char uc, uint8_t color) {
VGA::VGA(vga_color fg, vga_color bg, uint32_t address) {
color = vga_entry_color(fg, bg);
- buffer = (uint16_t *)address;
+ buffer = (uint16_t*)address;
// clear buffer
for (size_t y = 0; y < max_rows; y++) {
@@ -22,20 +22,17 @@ VGA::VGA(vga_color fg, vga_color bg, uint32_t address) {
}
}
-void VGA::put_char(char c, size_t x, size_t y, uint8_t color) {
- const size_t index = y * max_columns + x;
- buffer[index] = vga_entry(c, (color == 0) ? this->color : color);
-}
-
void VGA::write(char c) {
switch (c) {
- case '\n':
- column = 0;
- ++row;
- break;
- default:
- put_char(c, column, row, color);
- ++column;
+ case '\n':
+ column = 0;
+ ++row;
+ break;
+ default: {
+ const size_t index = row * max_columns + column;
+ buffer[index] = vga_entry(c, (color == 0) ? this->color : color);
+ ++column;
+ }
}
if (column == max_columns) {
@@ -57,20 +54,8 @@ void VGA::write(char c) {
}
}
-void VGA::write(const String &data) {
- auto it = data.begin();
- while (it) {
- write(it.next());
+void VGA::write(ViewIterator& iter) {
+ while (iter) {
+ write(iter.next());
}
}
-
-void VGA::write(int n) {
- char buffer[max_columns];
- itoa<16>(n, buffer);
- write(buffer);
-}
-
-void VGA::write(unsigned int n) {
- // TODO
- write((int)n);
-}