summaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 0d36800f2380a101842c3319da1e75cf2456a119 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#![no_std]
#![no_main]

extern crate bootloader_precompiled;

use core::panic::PanicInfo;

/// This function is called on panic.
#[panic_handler]
#[no_mangle]
pub fn panic(_info: &PanicInfo) -> ! {
    loop {}
}

static TEXT: &[u8] = b"Hello Marius! I do cool operating system development stuff look at meeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee!";

#[no_mangle]
pub extern "C" fn _start() -> ! {
    let vga_buffer = 0xb8000 as *mut u8;

    for (i, &byte) in TEXT.iter().enumerate() {
        unsafe {
            *vga_buffer.offset(i as isize * 2) = byte;
            *vga_buffer.offset(i as isize * 2 + 1) = 0x6;
        }
    }

    loop {}
}