r/EmuDev • • Oct 25 '26
Need help with PPU background rendering
Building a Game Boy (DMG) emulator in Rust. The CPU passes Blargg test roms & the SM83 JSON test suite.
Current Behavior:
- Dr. Mario: Title screen renders properly, but after a few frames, the graphics get garbled up.


- Tetris: Stuck rendering a screen grid of
00tiles on startup.

- Blargg Test Roms: Renders correctly.

- OAM, DMA & Sprites have not been implemented yet, just the background and the window.
- The Joypad returns
0xCF
I have no idea on where to even look for the bug. Any direction would be very helpful. Thank You.
6
Upvotes
4
u/HeracliusAugutus Oct 25 '26
Looks like a problem with the addressing mode or tile map area. Make sure you've implemented the LCDC register properly, particularly bits 3, 4, and 6.
3
u/HowziCanReddit Oct 25 '26 edited Oct 25 '26
Double check that your background rendering function casts the tile index to i8 when LCDC Bit 4 is set to 0.
Also make sure your scanline loop correctly cycles through modes:
2
u/devraj7 Oct 25 '26
The blargg tests are not enough.
Pass the Single Step Tests, they will very likely find bugs in your CPU, and that might resolve the problems you're seeing here.