From b2af51ffa6b7903e2a9adce6502dcd94cbd2128f Mon Sep 17 00:00:00 2001 From: greg Date: Wed, 10 Jul 2019 01:37:58 -0700 Subject: [PATCH] Print to vga buffer --- Cargo.toml | 1 + src/main.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 2abc2e7..aef2c8f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,4 +11,5 @@ panic = "abort" panic = "abort" [dependencies] +bootloader = "0.6.0" diff --git a/src/main.rs b/src/main.rs index 3a00d98..98ecf3e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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 {} }