Future proofing
This commit is contained in:
parent
bdb3dac4b7
commit
ea104a8014
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -7,6 +7,7 @@ name = "KarxOS"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bootloader",
|
||||
"volatile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -14,3 +15,9 @@ name = "bootloader"
|
|||
version = "0.9.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7c452074efc3c0bfb241fb7bc87df04741c7c85e926f6a07c05f8fbd6008240"
|
||||
|
||||
[[package]]
|
||||
name = "volatile"
|
||||
version = "0.2.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6b06ad3ed06fef1713569d547cdbdb439eafed76341820fb0e0344f29a41945"
|
||||
|
|
|
@ -7,3 +7,4 @@ edition = "2018"
|
|||
|
||||
[dependencies]
|
||||
bootloader = "0.9.8"
|
||||
volatile = "0.2.6"
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
use volatile::Volatile;
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u8)]
|
||||
|
@ -42,7 +44,7 @@ const BUFFER_WIDTH: usize = 80;
|
|||
|
||||
#[repr(transparent)]
|
||||
struct Buffer {
|
||||
chars: [[ScreenChar; BUFFER_WIDTH]; BUFFER_HEIGHT]
|
||||
chars: [[Volatile<ScreenChar>; BUFFER_WIDTH]; BUFFER_HEIGHT]
|
||||
}
|
||||
|
||||
pub struct Writer {
|
||||
|
@ -65,10 +67,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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue