libretroadmin 26bb785c9d mmc5: acknowledge and re-arm the scanline IRQ like the hardware
Model the MMC5 scanline IRQ the way the chip actually works: the line counter
runs every frame and asserts at the compare scanline, a $5204 read acknowledges
(de-asserts) the current assertion, and the counter then re-asserts the next
frame without needing to be reprogrammed. Previously the read reported the
pending flag but never de-asserted, and the IRQ was only armed by an explicit
$5203 write, so a game that armed the split once and polled $5204 to sync (Metal
Slader Glory's message-window raster split) never saw the acknowledge it
expected.

Add irq_compare_time() for the scanline->time conversion, re-arm irq_time from
the compare scanline in end_frame, and clear irq_time on a $5204 read that
reports the pending flag. Castlevania 3, which reprograms $5203 from its IRQ
handler every frame, is byte-for-byte identical over 900 frames; the 15-game
non-MMC5 battery plus Metal Slader Glory are unchanged; the other MMC5 titles
(Gemfire, Ishin no Arashi, Uncharted Waters, Just Breed) still render correctly.
Frame rates are within measurement noise.

This corrects the IRQ acknowledge/re-arm behaviour to match the reference
(FCEUmm's MMC5_hb + X6502_IRQEnd); it is not by itself a visible fix for any
one title.
2026-07-06 20:09:23 +02:00
2024-10-21 14:43:29 -07:00
2023-01-02 22:58:07 +01:00
2013-01-09 15:07:26 +01:00
2026-04-02 15:22:42 +01:00
2017-10-23 21:24:31 -04:00
2019-08-14 13:02:57 -04:00
2015-09-18 09:14:31 +02:00
S
Description
No description provided
GPL-2.0
2.1 MiB
0 Stars 1 Watchers 0 Forks
Languages
C 60.4%
C++ 32.9%
Python 5%
Makefile 1.7%