mgba icon indicating copy to clipboard operation
mgba copied to clipboard

First frame after reenabling LCD isn't white

Open pinobatch opened this issue 5 years ago • 1 comments

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). And for some reason, the LCD does not receive the first frame that the PPU generates, instead displaying 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 0.8-5388-f92059be does 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.

So I've made a test ROM for this quirk.

  • platform: Xubuntu 18.04 (amd64)
  • toolkit: Qt
  • version: 0.8-5388-f92059be
  • CPU: Pentium N3710
  • ROM used: firstwhite-0.01.zip
  • expect: plain white screen (or whiter-than-white on DMG/MGB)
  • actual: three words in black text in Impact font on a white background

pinobatch avatar Nov 11 '18 21:11 pinobatch

By the way, @liji32 determined that the LCD timings differ on DMG models and CGB ones - IIRC, on DMG Mode 0 is always at its longest, CGB instead has variable Mode 0's as normal.

ISSOtm avatar Jan 12 '19 22:01 ISSOtm