Mealybug Tearoom Tests
Game Boy emulator test ROMs.
This project contains some test ROMs I wrote to verify the correctness of my Game Boy emulator - Beaten Dying Moon.
Currently the tests focus on changes made to the PPU registers during STAT mode 3. This allows you to verify correct timing of the background tile and sprite data fetches as each scanline is rendered.
These tests examine very specific PPU behaviour/timings, so produce different results on a DMG compared to a CGB. There are expected result screenshots for when running on a DMG, and CPU CGB C and CPU CGB D (for most tests).
These tests are written to be easily automated. See the usage section below for details.
Pictures are always interesting so here are some screenshots showing the expected results on DMG:
- RGBDS is required if you want to build the test ROMs yourself
- A Game Boy emulator and/or real Game Boy and flash cart to test on
Clone or download the project and run
makefrom the root directory. The test ROMs will be placed in the
builddirectory. You can also download an archive of the ROMs.
Check the results. You can check in the
expecteddirectory for screenshots from my Game Boy emulator (which I believe to be correct), and the
photosdirectory contains blurry photos of the ROMs running on real devices.
Automated testing can be achieved using the
comparecommand from imagemagick to get the number of pixels that are different when comparing the expected image to a screenshot from an emulator.
The screenshot from the emulator should be generated when the
LD B,Bsoftware breakpoint is encountered.
A DMG emulator should use these 8-bit values in greyscale images or in RGB components to ensure the images can be compared correctly:
A CGB emulator should use this formula to convert 5-bit CGB palette components to 8-bit:
(r << 3) | (r >> 2)
An example imagemagick compare command is below.
resultwill contain the number of pixels that differ between the two images, so
result=$(compare -metric AE emulator-screenshot.png expected-result.png NULL: 2>&1)