sanni / cartreader

A shield for the Arduino Mega that can back up video game cartridges.
GNU General Public License v3.0
2.23k stars 226 forks source link

Fix for VRC2B Famicom Carts #998

Closed andy-miles closed 4 months ago

andy-miles commented 4 months ago

Here's my fix for reading VRC2B Famicom Carts (Mapper 23) on HW5. The symptoms were reading incorrect CHR data on VRC2B carts resulting in consistently bad dumps with the wrong CRC32. If you think there is a better way to fix the issue, please feel free to reject. I know that this fixes the specific issue for myself with minimal risk of impacting other mapper types.

Example log with a bad dump of Contra (J):

Saving to NES/ROM/Contra/481/...
[*******************]
CRC32... 6F0B8DB7 -> Not found

Instead of bank switching on a single bank and reading 1024 bytes at a time, this update switches 8 banks at a time and reads 8 KiB per iteration. The hypothesis is that the timing between bank switching and reading 1024 bytes at a time is insufficient for the mapper while reading in batches of 8 KiB allows for enough time for the data to be switched and accessible.

This change fixes the ability to dump the following VRC2B Famicom cartridges:

B27B8CF4 -> Contra (Japan).nes 49123146 -> Getsu Fuuma Den (Japan).nes AC9895CC -> Dragon Scroll - Yomigaerishi Maryuu (Japan).nes

Also verified a VRC4E Famicom Cartridge:

C1FBF659 -> Akumajou Special - Boku Dracula-kun (Japan).nes