From 5b1f2361f23a9d479004d8cdf063c708ebacf92a Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Thu, 24 Sep 2015 18:20:49 +0200 Subject: [PATCH] Use `println!` to print the `Hello World! --- src/lib.rs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 8be4c8b4..686f2d24 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,23 +19,13 @@ extern crate rlibc; extern crate spin; +#[macro_use] mod vga_buffer; #[no_mangle] pub extern fn rust_main() { // ATTENTION: we have a very small stack and no guard page - - let hello = b"Hello World!"; - let color_byte = 0x1f; // white foreground, blue background - - let mut hello_colored = [color_byte; 24]; - for (i, char_byte) in hello.into_iter().enumerate() { - hello_colored[i*2] = *char_byte; - } - - // write `Hello World!` to the center of the VGA text buffer - let buffer_ptr = (0xb8000 + 1988) as *mut _; - unsafe { *buffer_ptr = hello_colored }; + println!("Hello World{}", "!"); loop{} }