V5.1: Fix Mapper 21 carts

Fix for Wai Wai World 2 (VRC4a) and Ganbare Goemon Gaiden 2 (VRC4c)
Thanks to skaman
This commit is contained in:
sanni 2020-05-25 07:34:18 +02:00
parent 8794e4c878
commit c9f5c9ac36
2 changed files with 14 additions and 5 deletions

View File

@ -2,8 +2,8 @@
Cartridge Reader for Arduino Mega2560 Cartridge Reader for Arduino Mega2560
Author: sanni Author: sanni
Date: 12.05.2020 Date: 25.05.2020
Version: 5.0 Version: 5.1
SD lib: https://github.com/greiman/SdFat SD lib: https://github.com/greiman/SdFat
LCD lib: https://github.com/adafruit/Adafruit_SSD1306 LCD lib: https://github.com/adafruit/Adafruit_SSD1306
@ -43,7 +43,7 @@
**********************************************************************************/ **********************************************************************************/
#include <SdFat.h> #include <SdFat.h>
char ver[5] = "5.0"; char ver[5] = "5.1";
/****************************************** /******************************************
Options Options

View File

@ -1596,7 +1596,16 @@ void readPRG() {
} }
break; break;
case 21: case 21: // 256K
banks = int_pow(2, prgsize) * 2;
for (int i = 0; i < banks; i++) {
write_prg_byte(0xA000, i);
for (word address = 0x2000; address < 0x4000; address += 512) {
dumpPRG(base, address);
}
}
break;
case 22: case 22:
case 23: case 23:
case 25: case 25:
@ -2077,7 +2086,7 @@ void readCHR() {
banks = int_pow(2, chrsize) * 4; banks = int_pow(2, chrsize) * 4;
for (int i = 0; i < banks; i++) { for (int i = 0; i < banks; i++) {
write_prg_byte(0xB000, i & 0xF); // CHR Bank Lower 4 bits write_prg_byte(0xB000, i & 0xF); // CHR Bank Lower 4 bits
if (banks == 128) if (chrsize == 5) // Check CHR Size to determine VRC4a (128K) or VRC4c (256K)
write_prg_byte(0xB002, (i >> 4) & 0xF); // CHR Bank Upper 4 bits VRC4a (Wai Wai World 2) write_prg_byte(0xB002, (i >> 4) & 0xF); // CHR Bank Upper 4 bits VRC4a (Wai Wai World 2)
else // banks == 256 else // banks == 256
write_prg_byte(0xB040, (i >> 4) & 0xF); // CHR Bank Upper 4 bits VRC4c (Ganbare Goemon Gaiden 2) write_prg_byte(0xB040, (i >> 4) & 0xF); // CHR Bank Upper 4 bits VRC4c (Ganbare Goemon Gaiden 2)