Fix vga printing newlines

This commit is contained in:
greg 2019-07-11 02:38:49 -07:00
parent 9b61d543d6
commit 380b7adfbb
2 changed files with 19 additions and 1 deletions

View File

@ -22,9 +22,10 @@ pub fn init() {
pub extern "C" fn _start() -> ! { pub extern "C" fn _start() -> ! {
init(); init();
x86_64::instructions::interrupts::int3(); //x86_64::instructions::interrupts::int3();
println!("Gamarjoba, munde: {}", 1); println!("Gamarjoba, munde: {}", 1);
println!("Gamarjoba, munde: {}", 2);
//panic!("A bad thing happened"); //panic!("A bad thing happened");
loop {} loop {}
} }

View File

@ -103,7 +103,24 @@ impl Writer {
} }
fn new_line(&mut self) { fn new_line(&mut self) {
for row in 1..BUFFER_HEIGHT {
for col in 0..BUFFER_WIDTH {
let character = self.buffer.chars[row][col].read();
self.buffer.chars[row - 1][col].write(character);
}
}
self.clear_row(BUFFER_HEIGHT - 1);
self.column_position = 0;
}
fn clear_row(&mut self, row: usize) {
let blank = ScreenChar {
ascii_char: b' ',
color_code: self.color_code,
};
for col in 0..BUFFER_WIDTH {
self.buffer.chars[row][col].write(blank);
}
} }
} }