From 0bb13e7d14ecde286b09a706b32310055608ac2f Mon Sep 17 00:00:00 2001 From: DaniD3v Date: Tue, 31 Oct 2023 23:47:35 +0100 Subject: [PATCH] Made OS display serialized images --- os/.cargo/config.toml | 3 +++ os/Cargo.toml | 1 + os/src/main.rs | 9 ++++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/os/.cargo/config.toml b/os/.cargo/config.toml index aa893d0..b8e592b 100644 --- a/os/.cargo/config.toml +++ b/os/.cargo/config.toml @@ -4,3 +4,6 @@ build-std = ["core", "compiler_builtins"] [build] target = "x86_64-unknown-vid_os.json" + +[target.'cfg(target_os = "none")'] +runner = "bootimage runner" diff --git a/os/Cargo.toml b/os/Cargo.toml index 55bd3b5..afe4bb2 100644 --- a/os/Cargo.toml +++ b/os/Cargo.toml @@ -4,3 +4,4 @@ version = "0.1.0" edition = "2021" [dependencies] +bootloader = "0.9.23" # TODO migrate to new version (new main signature or smth https://crates.io/crates/bootloader) diff --git a/os/src/main.rs b/os/src/main.rs index 6b1ee03..7c3d462 100644 --- a/os/src/main.rs +++ b/os/src/main.rs @@ -1,10 +1,17 @@ #![no_std] #![no_main] +const VGA_BUFFER: *mut u8 = 0xb8000 as *mut u8; +static IMAGE: &[u8; 4000] = include_bytes!("../../converter/examples/images/ser/incredible.bin"); + #[panic_handler] fn panic(_info: &core::panic::PanicInfo) -> ! { loop {} } #[no_mangle] pub extern "C" fn _start() -> ! { - loop {}; + for (i, &byte) in IMAGE.iter().enumerate() { + unsafe { *VGA_BUFFER.offset(i as isize) = byte; } + } + + loop {} }