Skip to content

Commit

Permalink
Turn on the PPU to mimic CGB bootrom.
Browse files Browse the repository at this point in the history
Currently do it only for CGB mode when cgb enabledm, mainly since some test roms are sensitive to timing.

In the futrure I want to mimic the bootroms for both devices better
  • Loading branch information
alloncm committed Dec 14, 2024
1 parent 8037ae8 commit 74f4103
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/src/mmu/gb_mmu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ impl<'a, D:AudioDevice, G:GfxDevice, J:JoypadProvider> GbMmu<'a, D, G, J>{
// Mimic the CGB bootrom behavior
if cgb_reg & BIT_7_MASK != 0{
mmu.write(KEY0_REGISTER_ADDRESS, cgb_reg, 0);

// Both the bootroms leaves the PPU turned on, turning it on both modes makes some tests (turtle)
// fail as they seem really sensitive for timing.
// Setting this only for CGB mode (mostly to make games the assumes the PPU is turned on to work).
// TODO: Turn on the PPU on both modes while preserving accurate timing.
mmu.write(LCDC_REGISTER_ADDRESS, 0x80, 0);
}
else{
mmu.write(KEY0_REGISTER_ADDRESS, 0x4, 0); // Set bit 2 that indicates DMG compatibility mode
Expand Down

0 comments on commit 74f4103

Please sign in to comment.