Sunday, March 6, 2016
NES MMC3 support + PPU improvements
Just finished adding support for MMC3 in emux! MMC3 is a type of cart that was pretty popular at the time, with quite a few games relying on it, such as Double Dragon II and Super Mario Bros 3, as seen in the above screenshots (nes libretro core running through RetroArch on Windows).
One of the nice features of this mapper is its scanline counter functionality (and associated interrupt signalling). The NES PPU (picture processing unit) does not have the ability to count scanlines natively, which is typically helpful for video games to draw some kind of status bar. For instance, when rendering a level (which commonly scrolls horizontally or vertically), you may want to reset the scroll registers at a certain Y coordinate to display the player's score, number of lives, or coins. During each visible scanline, the PPU accesses memory within the cart for rendering the background and sprites. Both are physically located at different address ranges, therefore from the cart's perspective this means a chip could actually detect the switch from background to sprite rendering once per line and increment a counter when this happens, effectively giving a scanline counter (reset being done during VBLANK). This is what MMC3 brings to the table.
The work done for this mapper forced me to perform more testing related to PPU rendering. A few issues were fixed, and I added support for missing features such as "large" sprite rendering and background/sprite clipping. The NES core is definitely looking better now. My next goal is to implement MMC1 support and get more classics running!