torch2424 / wasmboy

Game Boy / Game Boy Color Emulator Library, 🎮written for WebAssembly using AssemblyScript. 🚀Demos built with Preact and Svelte. ⚛️
https://wasmboy.app/
GNU General Public License v3.0
1.4k stars 66 forks source link

First frame after reenabling LCD isn't white #203

Open pinobatch opened 5 years ago

pinobatch commented 5 years ago

WasmBoy 0.3.2 in VaporBoy 0.1.1 gives the same problem as mGBA issue #1231.

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, wasmBoy 0.3.2 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.

torch2424 commented 5 years ago

Thanks for this! @pinobatch 😄