Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First frame after reenabling LCD isn't white #33

Open
pinobatch opened this issue Aug 23, 2019 · 1 comment
Open

First frame after reenabling LCD isn't white #33

pinobatch opened this issue Aug 23, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@pinobatch
Copy link

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
@deltabeard deltabeard added the bug Something isn't working label Aug 28, 2019
deltabeard added a commit that referenced this issue Jan 1, 2022
This is a partial fix for issue #33, whereby the Game Boy LCD must
display a white screen for one frame after the LCD is enabled. This
stops garbled graphics being displayed by some games when the LCD is
enabled.

This is only a "partial" fix because Peanut-GB will simply not update
the LCD when the LCD has been enabled by the game. This means that
instead of showing a white screen, it is possible that the last
previously rendered frame will remain on the screen. This is not
accurate.

Signed-off-by: Mahyar Koshkouei <mk@deltabeard.com>
@deltabeard
Copy link
Owner

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:
BEFORE_FIRSTWHITE_0000000000

After:
AFTER_FIRSTWHITE_0000000000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants