mirror of
https://github.com/sanni/cartreader.git
synced 2024-12-24 12:01:53 +01:00
Add support for NES mapper 45 (thx to skaman)
This commit is contained in:
parent
68fbd55291
commit
d086b277ef
@ -561,3 +561,6 @@ void setCart_COL() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
//******************************************
|
||||||
|
// End of File
|
||||||
|
//******************************************
|
||||||
|
@ -808,3 +808,6 @@ uint8_t gbSmartGetResizeParam(uint8_t rom_size, uint8_t sram_size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
//******************************************
|
||||||
|
// End of File
|
||||||
|
//******************************************
|
||||||
|
@ -960,3 +960,6 @@ void setCart_INTV() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
//******************************************
|
||||||
|
// End of File
|
||||||
|
//******************************************
|
||||||
|
@ -9,19 +9,20 @@
|
|||||||
|
|
||||||
//Line Content
|
//Line Content
|
||||||
//28 Supported Mappers
|
//28 Supported Mappers
|
||||||
//103 Defines
|
//106 Defines
|
||||||
//133 Variables
|
//136 Variables
|
||||||
//194 Menus
|
//197 Menus
|
||||||
//333 Setup
|
//383 Setup
|
||||||
//362 Low Level Functions
|
//412 No-Intro SD Database Functions
|
||||||
//609 CRC Functions
|
//1125 Low Level Functions
|
||||||
//669 File Functions
|
//1372 CRC Functions
|
||||||
//864 NES 2.0 Header Functions
|
//1426 File Functions
|
||||||
//1145 Config Functions
|
//1527 NES 2.0 Header Functions
|
||||||
//1946 ROM Functions
|
//1957 Config Functions
|
||||||
//3044 RAM Functions
|
//2760 ROM Functions
|
||||||
//3477 Eeprom Functions
|
//3951 RAM Functions
|
||||||
//3667 NESmaker Flash Cart Functions
|
//4384 Eeprom Functions
|
||||||
|
//4574 NESmaker Flash Cart Functions
|
||||||
|
|
||||||
/******************************************
|
/******************************************
|
||||||
Supported Mappers
|
Supported Mappers
|
||||||
@ -53,9 +54,10 @@ static const byte PROGMEM mapsize [] = {
|
|||||||
33, 3, 4, 5, 6, 0, 0, // taito tc0190
|
33, 3, 4, 5, 6, 0, 0, // taito tc0190
|
||||||
34, 3, 3, 0, 0, 0, 0, // bnrom [nina-1 NOT SUPPORTED]
|
34, 3, 3, 0, 0, 0, 0, // bnrom [nina-1 NOT SUPPORTED]
|
||||||
37, 4, 4, 6, 6, 0, 0, // (super mario bros + tetris + world cup)
|
37, 4, 4, 6, 6, 0, 0, // (super mario bros + tetris + world cup)
|
||||||
|
45, 3, 6, 0, 8, 0, 0, // ga23c asic multicart [UNLICENSED]
|
||||||
47, 4, 4, 6, 6, 0, 0, // (super spike vball + world cup)
|
47, 4, 4, 6, 6, 0, 0, // (super spike vball + world cup)
|
||||||
48, 3, 4, 6, 6, 0, 0, // taito tc0690
|
48, 3, 4, 6, 6, 0, 0, // taito tc0690
|
||||||
64, 2, 3, 4, 5, 0, 0, // tengen rambo-1
|
64, 2, 3, 4, 5, 0, 0, // tengen rambo-1 [UNLICENSED]
|
||||||
65, 3, 4, 5, 6, 0, 0, // irem h-3001
|
65, 3, 4, 5, 6, 0, 0, // irem h-3001
|
||||||
66, 2, 3, 2, 3, 0, 0, // gxrom/mhrom
|
66, 2, 3, 2, 3, 0, 0, // gxrom/mhrom
|
||||||
67, 3, 3, 5, 5, 0, 0, // sunsoft 3
|
67, 3, 3, 5, 5, 0, 0, // sunsoft 3
|
||||||
@ -90,7 +92,7 @@ static const byte PROGMEM mapsize [] = {
|
|||||||
153, 5, 5, 0, 0, 1, 1, // (famicom jump ii) [sram r/w]
|
153, 5, 5, 0, 0, 1, 1, // (famicom jump ii) [sram r/w]
|
||||||
154, 3, 3, 5, 5, 0, 0, // namcot-3453 (devil man)
|
154, 3, 3, 5, 5, 0, 0, // namcot-3453 (devil man)
|
||||||
155, 3, 3, 3, 5, 0, 1, // mmc1 variant [sram r/w]
|
155, 3, 3, 3, 5, 0, 1, // mmc1 variant [sram r/w]
|
||||||
158, 3, 3, 5, 5, 0, 0, // tengen rambo-1 variant (alien syndrome (u))
|
158, 3, 3, 5, 5, 0, 0, // tengen rambo-1 variant (alien syndrome (u)) [UNLICENSED]
|
||||||
159, 3, 4, 5, 6, 1, 1, // bandai x24c01 [eep r/w]
|
159, 3, 4, 5, 6, 1, 1, // bandai x24c01 [eep r/w]
|
||||||
180, 3, 3, 0, 0, 0, 0, // unrom variant (crazy climber)
|
180, 3, 3, 0, 0, 0, 0, // unrom variant (crazy climber)
|
||||||
184, 1, 1, 2, 3, 0, 0, // sunsoft 1
|
184, 1, 1, 2, 3, 0, 0, // sunsoft 1
|
||||||
@ -138,13 +140,13 @@ byte mapcount = (sizeof(mapsize) / sizeof(mapsize[0])) / 7;
|
|||||||
boolean mapfound = false;
|
boolean mapfound = false;
|
||||||
byte mapselect;
|
byte mapselect;
|
||||||
|
|
||||||
int PRG[] = {16, 32, 64, 128, 256, 512};
|
int PRG[] = {16, 32, 64, 128, 256, 512, 1024};
|
||||||
byte prglo = 0; // Lowest Entry
|
byte prglo = 0; // Lowest Entry
|
||||||
byte prghi = 5; // Highest Entry
|
byte prghi = 6; // Highest Entry
|
||||||
|
|
||||||
int CHR[] = {0, 8, 16, 32, 64, 128, 256, 512};
|
int CHR[] = {0, 8, 16, 32, 64, 128, 256, 512, 1024};
|
||||||
byte chrlo = 0; // Lowest Entry
|
byte chrlo = 0; // Lowest Entry
|
||||||
byte chrhi = 7; // Highest Entry
|
byte chrhi = 8; // Highest Entry
|
||||||
|
|
||||||
byte RAM[] = {0, 8, 16, 32};
|
byte RAM[] = {0, 8, 16, 32};
|
||||||
byte ramlo = 0; // Lowest Entry
|
byte ramlo = 0; // Lowest Entry
|
||||||
@ -192,7 +194,7 @@ byte newramsize;
|
|||||||
int b = 0;
|
int b = 0;
|
||||||
|
|
||||||
/******************************************
|
/******************************************
|
||||||
Menu
|
Menus
|
||||||
*****************************************/
|
*****************************************/
|
||||||
// NES start menu
|
// NES start menu
|
||||||
static const char nesMenuItem1[] PROGMEM = "Change Mapper";
|
static const char nesMenuItem1[] PROGMEM = "Change Mapper";
|
||||||
@ -2771,6 +2773,14 @@ void dumpCHR(word address) {
|
|||||||
myFile.write(sdBuffer, 512);
|
myFile.write(sdBuffer, 512);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dumpCHR_M2(word address) { // MAPPER 45 - PULSE M2 LO/HI
|
||||||
|
for (int x = 0; x < 512; x++) {
|
||||||
|
PHI2_LOW;
|
||||||
|
sdBuffer[x] = read_chr_byte(address + x);
|
||||||
|
}
|
||||||
|
myFile.write(sdBuffer, 512);
|
||||||
|
}
|
||||||
|
|
||||||
void dumpMMC5RAM(word base, word address) { // MMC5 SRAM DUMP - PULSE M2 LO/HI
|
void dumpMMC5RAM(word base, word address) { // MMC5 SRAM DUMP - PULSE M2 LO/HI
|
||||||
for (int x = 0; x < 512; x++) {
|
for (int x = 0; x < 512; x++) {
|
||||||
PHI2_LOW;
|
PHI2_LOW;
|
||||||
@ -3069,6 +3079,37 @@ void readPRG(boolean readrom) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 45: // MMC3 Clone with Outer Registers
|
||||||
|
banks = ((int_pow(2, prgsize) * 2)) - 2; // Set Number of Banks
|
||||||
|
for (int i = 0; i < banks; i += 2) { // 128K/256K/512K/1024K
|
||||||
|
// set outer bank registers
|
||||||
|
write_prg_byte(0x6000, 0x00); // CHR-OR
|
||||||
|
write_prg_byte(0x6000, (i & 0xC0)); // PRG-OR
|
||||||
|
write_prg_byte(0x6000, ((i >> 2) & 0xC0)); // CHR-AND,CHR-OR/PRG-OR
|
||||||
|
write_prg_byte(0x6000, 0x80); // PRG-AND
|
||||||
|
// set inner bank registers
|
||||||
|
write_prg_byte(0x8000, 6); // PRG Bank 0 ($8000-$9FFF)
|
||||||
|
write_prg_byte(0x8001, i);
|
||||||
|
for (word address = 0x0; address < 0x2000; address += 512) {
|
||||||
|
dumpPRG(base, address);
|
||||||
|
}
|
||||||
|
// set outer bank registers
|
||||||
|
write_prg_byte(0x6000, 0x00); // CHR-OR
|
||||||
|
write_prg_byte(0x6000, ((i + 1) & 0xC0)); // PRG-OR
|
||||||
|
write_prg_byte(0x6000, (((i + 1) >> 2) & 0xC0)); // CHR-AND,CHR-OR/PRG-OR
|
||||||
|
write_prg_byte(0x6000, 0x80); // PRG-AND
|
||||||
|
// set inner bank registers
|
||||||
|
write_prg_byte(0x8000, 7); // PRG Bank 1 ($A000-$BFFF)
|
||||||
|
write_prg_byte(0x8001, i + 1);
|
||||||
|
for (word address = 0x2000; address < 0x4000; address += 512) {
|
||||||
|
dumpPRG(base, address);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (word address = 0x4000; address < 0x8000; address += 512) { // Final 2 Banks ($C000-$FFFF)
|
||||||
|
dumpPRG(base, address);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 66: // 64K/128K
|
case 66: // 64K/128K
|
||||||
banks = int_pow(2, prgsize) / 2;
|
banks = int_pow(2, prgsize) / 2;
|
||||||
for (int i = 0; i < banks; i++) { // 64K/128K
|
for (int i = 0; i < banks; i++) { // 64K/128K
|
||||||
@ -3608,6 +3649,35 @@ void readCHR(boolean readrom) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 45: // 128K/256K/512K/1024K
|
||||||
|
banks = int_pow(2, chrsize) * 4;
|
||||||
|
write_prg_byte(0xA001, 0x80); // Unlock Write Protection - not used by some carts
|
||||||
|
for (int i = 0; i < banks; i++) {
|
||||||
|
// set outer bank registers
|
||||||
|
write_prg_byte(0x6000, 0x00); // CHR-OR
|
||||||
|
write_prg_byte(0x6000, 0x00); // PRG-OR
|
||||||
|
write_prg_byte(0x6000, (((i / 256) << 4) | 0x0F)); // CHR-AND,CHR-OR/PRG-OR
|
||||||
|
write_prg_byte(0x6000, 0x80); // PRG-AND
|
||||||
|
// set inner bank registers
|
||||||
|
write_prg_byte(0x8000, 0x2); // CHR Bank 2 ($1000-$13FF)
|
||||||
|
write_prg_byte(0x8001, i);
|
||||||
|
for (word address = 0x1000; address < 0x1200; address += 512) {
|
||||||
|
dumpCHR_M2(address); // Read CHR with M2 Pulse
|
||||||
|
}
|
||||||
|
// set outer bank registers
|
||||||
|
write_prg_byte(0x6000, 0x00); // CHR-OR
|
||||||
|
write_prg_byte(0x6000, 0x00); // PRG-OR
|
||||||
|
write_prg_byte(0x6000, (((i / 256) << 4) | 0x0F)); // CHR-AND,CHR-OR/PRG-OR
|
||||||
|
write_prg_byte(0x6000, 0x80); // PRG-AND
|
||||||
|
// set inner bank registers
|
||||||
|
write_prg_byte(0x8000, 0x2); // CHR Bank 2 ($1000-$13FF)
|
||||||
|
write_prg_byte(0x8001, i);
|
||||||
|
for (word address = 0x1200; address < 0x1400; address += 512) {
|
||||||
|
dumpCHR_M2(address); // Read CHR with M2 Pulse
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 67: // 128K
|
case 67: // 128K
|
||||||
banks = int_pow(2, chrsize) * 2;
|
banks = int_pow(2, chrsize) * 2;
|
||||||
for (int i = 0; i < banks; i += 4) { // 2K Banks
|
for (int i = 0; i < banks; i += 4) { // 2K Banks
|
||||||
|
@ -372,3 +372,6 @@ uint8_t readByte_NGP(uint32_t addr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
//******************************************
|
||||||
|
// End of File
|
||||||
|
//******************************************
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
//******************************************
|
//******************************************
|
||||||
// BENESSE POCKET CHALLENGE W MODULE
|
// BENESSE POCKET CHALLENGE W MODULE
|
||||||
//******************************************
|
//******************************************
|
||||||
|
#ifdef enable_PCW
|
||||||
|
|
||||||
// Benesse Pocket Challenge W
|
// Benesse Pocket Challenge W
|
||||||
// Cartridge Pinout
|
// Cartridge Pinout
|
||||||
// 38P 1.27mm pitch connector
|
// 38P 1.27mm pitch connector
|
||||||
@ -605,3 +607,7 @@ unsigned long verifySRAM_PCW() {
|
|||||||
|
|
||||||
return writeErrors;
|
return writeErrors;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
//******************************************
|
||||||
|
// End of File
|
||||||
|
//******************************************
|
||||||
|
@ -532,3 +532,6 @@ unsigned long verifySRAM_VB() {
|
|||||||
return writeErrors;
|
return writeErrors;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
//******************************************
|
||||||
|
// End of File
|
||||||
|
//******************************************
|
||||||
|
@ -1321,3 +1321,6 @@ void dataOut_WS()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
//******************************************
|
||||||
|
// End of File
|
||||||
|
//******************************************
|
||||||
|
@ -560,3 +560,6 @@ void setCart_WSV() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
//******************************************
|
||||||
|
// End of File
|
||||||
|
//******************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user