Skip to content

Commit

Permalink
Made OS display serialized images
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniD3v committed Oct 31, 2023
1 parent 932cd55 commit 0bb13e7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions os/.cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
1 change: 1 addition & 0 deletions os/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
9 changes: 8 additions & 1 deletion os/src/main.rs
Original file line number Diff line number Diff line change
@@ -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 {}
}

0 comments on commit 0bb13e7

Please sign in to comment.