Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![no_std]
- #![no_main]
- mod drivers;
- mod libs;
- use core::panic::PanicInfo;
- use drivers::serial;
- const VGA_BUFFER: *mut u8 = 0xA0000 as *mut u8;
- #[no_mangle]
- pub extern "C" fn _start() -> ! {
- serial::init_serial();
- let message = b"Hello world\n";
- for (i, &byte) in message.iter().enumerate() {
- serial::write_serial(byte);
- }
- for y in 0..=479 {
- for x in 0..=639 {
- put_pixel(x, y, 1);
- }
- }
- loop {}
- }
- fn put_pixel(pos_x: usize, pos_y: usize, vga_color: u8) {
- unsafe {
- let location = VGA_BUFFER.offset((640 * pos_y + pos_x) as isize);
- *location = vga_color;
- }
- }
- #[panic_handler]
- fn panic (_info: &PanicInfo) -> ! {
- loop {}
- }
Advertisement
Add Comment
Please, Sign In to add comment