Corrects critical mistake where core tried to bypass even if previous instruction did not write-back

This commit is contained in:
2025-11-15 00:57:59 +01:00
parent 0c377a1380
commit e35f2a4242
8 changed files with 75 additions and 62 deletions

View File

@@ -11,37 +11,38 @@ use fpga_lib::{
panic_handler! {}
#[inline(never)]
pub fn magic(x: &mut u16, y: &mut u16, z: &mut bool, i: u16, j: u16)
{
if *x > i && *y < 198 && *z
{
unsafe { VGA::write_pixel_unsafe(i, j, GREEN) };
}
else
{
unsafe { VGA::write_pixel_unsafe(i, j, RED) };
}
//*x += 1;
*y -= 1;
}
#[unsafe(no_mangle)]
pub extern "C" fn main() -> !
{
// 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);
// }
//let c = core::hint::black_box('S');
let c = core::hint::black_box('S');
//unsafe { VGA::draw_char(10, 10, c, RED) };
//unsafe { VGA::draw_string(3, 3, "{Skibidi toilet !!}", GREEN) };
//}
let mut x = core::hint::black_box(100u16);
let mut y = core::hint::black_box(192);
let mut z = core::hint::black_box(true);
// for i in 0..2
// {
// unsafe { VGA::draw_char(0 + i as u16 * FONT_WIDTH as u16, 0, c, RED) };
// }
let x = core::hint::black_box(&mut x);
let y = core::hint::black_box(&mut y);
let z = core::hint::black_box(&mut z);
// unsafe { VGA::draw_char(0, 0, c, RED) };
// unsafe { VGA::draw_char(1, 0, c, RED) };
for i in 0..(*x)
{
magic(x, y, z, i, i);
}
unsafe { VGA::draw_char(1, 0, c, RED) };
unsafe { VGA::draw_char(1, 0, c, GREEN) };
// if (c as u8 > b'~') || ((c as u8) < b' ')
// {
// X31::write_const::<0x01>();