agbrs / agb

Library for writing Game Boy Advance games in Rust
https://agbrs.dev/
Mozilla Public License 2.0
319 stars 27 forks source link

`no_game` wont run in NanoBoyAdvance #710

Closed tolik518 closed 6 months ago

tolik518 commented 6 months ago

When I was writing a demo for a small library I wrote (gba_env) I was trying to figure out why it wasn't running in NanoBoyAdvance 1.8.1, with Bios loaded, but skipped (Config -> System -> Skin BIOS), it wasn't working as intended. It just shows the background-color and seems to be stuck.

Now I've figured out that it's not only my demo, but also the examples included here in the repo.

#[agb::entry]
fn main(mut gba: agb::Gba) -> ! {
    agb::no_game(gba);
}

It looks like even no_game() seems to do be missing something that usually is initialized in the BIOS, because if the BIOS isn't skipped, it works as intended.

In discord someone suggested to wait for the vblank interrupt as the first step in the main

 while (REG_VCOUNT != 160); while (REG_VCOUNT != 161);

which I tried to do the following way but it seems like this won't fix the issue just yet.

let vblank = agb::interrupt::VBlank::get();
agb::interrupt::VBlank::wait_for_vblank(&vblank);

Is there a known solution?

corwinkuiper commented 6 months ago

As it works on real hardware, this looks like an nba bug.