Peanut-GB
Peanut-GB copied to clipboard
First frame after reenabling LCD isn't white
When the program turns on rendering by changing bit 7 of LCDC ($FF40) from 0 to 1, the PPU goes straight to the start of rendering (scanline 0) without sending the vsync pulse to the LCD. This causes the LCD to display a white screen for one frame. (On monochrome systems, this is the same whiter-than-white shade displayed when rendering is off.) Some games, such as Pokémon Pinball, use this blank frame to prepare things before the first visible frame, such as the sprite display list to be DMA copied to OAM during the first vblank.
Though recent BGB emulates this quirk, mGBA, WasmBoy, and Peanut-GB do not. This causes 1 frame of corruption to appear in Pokémon Pinball and numerous other games after a screen transition. Many games on KiGB's compatibility list are there because of this quirk. Affected games may include A Boy and His Blob, Boxing by Tonkin House, Captain Knick-Knack, HyperDunk, Hyper Lode Runner, and Xiang Pu -- Dong Hai Dao Chang Suo.
I've attached a test ROM for this quirk, which repeatedly turns the LCD on for one frame before turning it off.
- platform: Xubuntu 18.04 (amd64)
- CPU: Pentium N3710
- ROM used: The first frame is always white
- expect: screen remains white (all but SGB) or rolling image (SGB)
- actual: "Incorrect" message
Thanks for the bug report and for writing & providing the test ROM. As mentioned in the commit, I think this is a partial fix, so I will leave this issue open. I need to do more testing, especially with Pokemon Pinball to see if this commit actually fixes the problem. Below is a before and after test of the firstwhite.gb ROM.
Before:
After: