Rust character drawing

This commit is contained in:
2025-11-14 09:57:42 +01:00
parent 6bbecc252e
commit d8596b2247
7 changed files with 212 additions and 68 deletions

View File

@@ -6,23 +6,50 @@ use core::arch::asm;
use fpga_lib::{
panic_handler,
register::X31,
vga::{VGA, WHITE},
vga::{BLUE, GREEN, RED, VGA, WHITE},
};
panic_handler! {}
#[unsafe(no_mangle)]
pub extern "C" fn _start() -> ! {
X31::write_const::<0xdead1ffffffff>();
let test = X31::read() + 10;
unsafe {
asm!(
"add x31, x0, x0",
"add x31, x0, {}", in(reg) test
);
pub extern "C" fn _start() -> !
{
unsafe { asm!("la sp, _stack_start") }
// X31::write_const::<0xdead1ffffffff>();
// let test = X31::read() + 10;
//unsafe {
// asm!(
// "add x31, x0, x0",
// "add x31, x0, {}", in(reg) test
// );
//
// for i in 0..100
// {
// VGA::write_pixel_unsafe(i, i, WHITE);
// }
//unsafe { VGA::draw_char(9, 3, 'S', RED) };
unsafe { VGA::draw_string(3, 3, "{Skibidi toilet !!}", GREEN) };
//}
VGA::write_pixel_unsafe(0, 0, WHITE);
}
// let mut a = core::hint::black_box(true);
// let mut x = core::hint::black_box(121);
// let mut y = core::hint::black_box(221);
// for i in 0..100
// {
// if i < x && i < y && a
// {
// unsafe {
// //VGA::write_pixel_unsafe(i, i, WHITE);
// }
// }
// }
loop {}
// let mut a = core::hint::black_box(true);
// if a
// {
// X31::write_const::<0xdead1ffffffff>();
// }
loop
{}
}