diff --git a/agb/src/lib.rs b/agb/src/lib.rs index edf1de2f..286b0076 100644 --- a/agb/src/lib.rs +++ b/agb/src/lib.rs @@ -89,7 +89,9 @@ where mgba::DebugLevel::Info, ) .unwrap(); + mgba::number_of_cycles_tagged(785); self(gba); + mgba::number_of_cycles_tagged(785); mgba.print(format_args!("[ok]"), mgba::DebugLevel::Info) .unwrap(); } @@ -138,6 +140,8 @@ pub extern "C" fn main() -> ! { #[cfg(test)] fn assert_image_output(image: &str) { + display::busy_wait_for_VBlank(); + display::busy_wait_for_VBlank(); let mut mgba = crate::mgba::Mgba::new().unwrap(); mgba.print( format_args!("image:{}", image), diff --git a/agb/src/mgba.rs b/agb/src/mgba.rs index ae881222..380efdf4 100644 --- a/agb/src/mgba.rs +++ b/agb/src/mgba.rs @@ -26,6 +26,12 @@ fn is_running_in_mgba() -> bool { DEBUG_ENABLE.get() == ENABLE_HANDSHAKE_OUT } +const NUMBER_OF_CYCLES: MemoryMapped = unsafe { MemoryMapped::new(0x04FF_F800) }; + +pub fn number_of_cycles_tagged(tag: u16) { + NUMBER_OF_CYCLES.set(tag) +} + pub struct Mgba { bytes_written: usize, }