Print to vga buffer

This commit is contained in:
greg 2019-07-10 01:37:58 -07:00
parent 3ed67bfd33
commit b2af51ffa6
2 changed files with 13 additions and 0 deletions

View File

@ -11,4 +11,5 @@ panic = "abort"
panic = "abort"
[dependencies]
bootloader = "0.6.0"

View File

@ -8,7 +8,19 @@ fn panic(_info: &PanicInfo) -> !{
loop {}
}
static GREETING: &[u8] = b"Gamarjoba, munde";
#[no_mangle]
pub extern "C" fn _start() -> ! {
let vga_buffer = 0xb8000 as *mut u8;
for (i, &byte) in GREETING.iter().enumerate() {
unsafe {
*vga_buffer.offset(i as isize * 2) = byte;
*vga_buffer.offset(i as isize * 2 + 1) = 0xb; //light cyan
}
}
loop {}
}