Writes the given ASCII string to the buffer. Wraps lines at `BUFFER_WIDTH`. Supports the `\n` newline character. Does **not support strings with non-ASCII characters, since they can't be printed in the VGA text mode.
(&mut self, s: &str)
| 111 | /// support strings with non-ASCII characters, since they can't be printed in the VGA text |
| 112 | /// mode. |
| 113 | fn write_string(&mut self, s: &str) { |
| 114 | for byte in s.bytes() { |
| 115 | match byte { |
| 116 | // printable ASCII byte or newline |
| 117 | 0x20..=0x7e | b'\n' => self.write_byte(byte), |
| 118 | // not part of printable ASCII range |
| 119 | _ => self.write_byte(0xfe), |
| 120 | } |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | /// Shifts all lines one line up and clears the last row. |
| 125 | fn new_line(&mut self) { |
no test coverage detected