Conversation
MMC2 is used exclusively by Mike Tyson's Punch-Out!! and features tile-triggered CHR bank switching with two independent 4KB latches. The PPU rendering pipeline now calls latchAccess() during BG and sprite tile fetches so the mapper can monitor pattern table addresses, matching real hardware behavior. Unused sprite slot dummy fetches (tile $FF in 8x16 mode) are simulated to correctly reset latch 1 between scanlines. Fixes #430 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implementation details
Mapper (
src/mappers/mapper9.js):PPU changes (
src/ppu/index.js):renderBgScanline: callslatchAccess()after each BG tile fetch with the computed pattern table high-byte addressrenderSpritesPartially: callslatchAccess()for each sprite's pattern table fetch (both 8x8 and 8x16)_inRenderingguard prevents recursion when latch bank switches triggertriggerRendering()All latch access calls are no-ops for non-MMC2 mappers (base class
latchAccessis empty). Benchmark shows ~1% overhead (1778 fps vs ~1800 baseline).Fixes #430
Test plan
🤖 Generated with Claude Code