Use volatile writes for accessing the VGA buffer

This commit is contained in:
Philipp Oppermann
2019-01-25 13:16:44 +01:00
parent d71e6a7cb6
commit d1897af515
3 changed files with 13 additions and 3 deletions

View File

@@ -1,3 +1,5 @@
use volatile::Volatile;
#[allow(dead_code)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(u8)]
@@ -40,7 +42,7 @@ const BUFFER_HEIGHT: usize = 25;
const BUFFER_WIDTH: usize = 80;
struct Buffer {
chars: [[ScreenChar; BUFFER_WIDTH]; BUFFER_HEIGHT],
chars: [[Volatile<ScreenChar>; BUFFER_WIDTH]; BUFFER_HEIGHT],
}
pub struct Writer {
@@ -62,10 +64,10 @@ impl Writer {
let col = self.column_position;
let color_code = self.color_code;
self.buffer.chars[row][col] = ScreenChar {
self.buffer.chars[row][col].write(ScreenChar {
ascii_character: byte,
color_code,
};
});
self.column_position += 1;
}
}