get cycles

This commit is contained in:
Corwin Kuiper 2021-07-03 22:18:53 +01:00
parent cda7e95a28
commit 744c7a8bb4
2 changed files with 10 additions and 0 deletions

View file

@ -89,7 +89,9 @@ where
mgba::DebugLevel::Info, mgba::DebugLevel::Info,
) )
.unwrap(); .unwrap();
mgba::number_of_cycles_tagged(785);
self(gba); self(gba);
mgba::number_of_cycles_tagged(785);
mgba.print(format_args!("[ok]"), mgba::DebugLevel::Info) mgba.print(format_args!("[ok]"), mgba::DebugLevel::Info)
.unwrap(); .unwrap();
} }
@ -138,6 +140,8 @@ pub extern "C" fn main() -> ! {
#[cfg(test)] #[cfg(test)]
fn assert_image_output(image: &str) { fn assert_image_output(image: &str) {
display::busy_wait_for_VBlank();
display::busy_wait_for_VBlank();
let mut mgba = crate::mgba::Mgba::new().unwrap(); let mut mgba = crate::mgba::Mgba::new().unwrap();
mgba.print( mgba.print(
format_args!("image:{}", image), format_args!("image:{}", image),

View file

@ -26,6 +26,12 @@ fn is_running_in_mgba() -> bool {
DEBUG_ENABLE.get() == ENABLE_HANDSHAKE_OUT DEBUG_ENABLE.get() == ENABLE_HANDSHAKE_OUT
} }
const NUMBER_OF_CYCLES: MemoryMapped<u16> = unsafe { MemoryMapped::new(0x04FF_F800) };
pub fn number_of_cycles_tagged(tag: u16) {
NUMBER_OF_CYCLES.set(tag)
}
pub struct Mgba { pub struct Mgba {
bytes_written: usize, bytes_written: usize,
} }