neptune/src/main.rs

29 lines
706 B
Rust

#![feature(panic_implementation)] // required to define panic handler
#![no_std] // don't include rust std lib
#![no_main] // disable all rust entry point
use core::panic::PanicInfo;
/// This function is called on panic.
#[panic_implementation]
#[no_mangle]
pub fn panic(_info: &PanicInfo) -> ! {
loop {}
}
static HELLO: &[u8] = b"Hello World!";
#[no_mangle] // don't change the name of function in symbol table
pub extern "C" fn _start() -> ! {
let vga_buffer = 0xb8000 as *mut u8;
for (i, &byte) in HELLO.iter().enumerate() {
unsafe {
*vga_buffer.offset(i as isize * 2) = byte;
*vga_buffer.offset(i as isize * 2 + 1) = 0xb;
}
}
loop {}
}