Corrects critical mistake where core tried to bypass even if previous instruction did not write-back
This commit is contained in:
@@ -6,7 +6,7 @@ members = ["fpga-lib", "fpga-lib-macros", "hello-rust"]
|
||||
panic = "abort"
|
||||
codegen-units = 1 # better optimizations
|
||||
lto = true # better optimizations
|
||||
strip = true
|
||||
strip = false
|
||||
opt-level = "z"
|
||||
|
||||
[profile.dev]
|
||||
|
||||
@@ -46,10 +46,12 @@ impl VGA
|
||||
{
|
||||
let c = if (c as u8 > b'~') || ((c as u8) < b' ')
|
||||
{
|
||||
unsafe { Self::write_pixel_unsafe(x, y, RED) };
|
||||
b'/' - b' '
|
||||
}
|
||||
else
|
||||
{
|
||||
unsafe { Self::write_pixel_unsafe(x, y, GREEN) };
|
||||
c as u8 - b' '
|
||||
};
|
||||
|
||||
@@ -64,12 +66,12 @@ impl VGA
|
||||
let xx = x + i;
|
||||
let yy = y + j;
|
||||
|
||||
if xx < (WIDTH as u16)
|
||||
&& yy < (HEIGHT as u16)
|
||||
&& unsafe { Self::font_plate_index(char_x as u16 + i, char_y as u16 + j) }
|
||||
//if unsafe { Self::font_plate_index(char_x as u16 + i, char_y as u16 + j) }
|
||||
// if xx < (WIDTH as u16)
|
||||
// && yy < (HEIGHT as u16)
|
||||
// && unsafe { Self::font_plate_index(char_x as u16 + i, char_y as u16 + j) }
|
||||
if unsafe { Self::font_plate_index(char_x as u16 + i, char_y as u16 + j) }
|
||||
{
|
||||
unsafe { Self::write_pixel_unsafe(xx, yy, color) }
|
||||
// //unsafe { Self::write_pixel_unsafe(xx, yy, color) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>();
|
||||
|
||||
Reference in New Issue
Block a user