[NES] Added mapper 148

AddedNES  mapper 148
This commit is contained in:
nsx0r 2023-04-30 13:42:16 +02:00 committed by GitHub
parent 3dc1fbe3e0
commit 8c13b615d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -118,6 +118,7 @@ static const byte PROGMEM mapsize[] = {
140, 3, 3, 3, 5, 0, 0, // jaleco jf-11/jf-14
142, 1, 3, 0, 0, 0, 0, // UNL-KS7032 [UNLICENSED]
146, 1, 2, 2, 3, 0, 0, // Sachen 3015 [UNLICENSED]
148, 1, 2, 0, 4, 0, 0, // Sachen SA-0037 & Tengen 800008 [UNLICENSED]
// 151 - bad mapper, not used
152, 2, 3, 5, 5, 0, 0, // BANDAI-74*161/161/32
153, 5, 5, 0, 0, 1, 1, // (famicom jump ii) [sram r/w]
@ -224,16 +225,17 @@ int banks;
int prg;
int chr;
byte ram;
boolean vrc4e = false;
bool vrc4e = false;
byte prgchk0;
byte prgchk1;
boolean mmc6 = false;
bool mmc6 = false;
byte prgchk2;
byte prgchk3;
word eepsize;
byte bytecheck;
byte firstbyte;
boolean flashfound = false; // NESmaker 39SF040 Flash Cart
bool flashfound = false; // NESmaker 39SF040 Flash Cart
bool busConflict = false;
// Cartridge Config
byte mapper;
@ -567,7 +569,7 @@ void getMapping() {
}
oldcrc32 = ~oldcrc32;
oldcrc32MMC3 = ~oldcrc32MMC3;
boolean browseDatabase;
bool browseDatabase;
// Filter out all 0xFF checksums at 0x8000 and 0xE000
if (oldcrc32 == 0xBD7BC39F && oldcrc32MMC3 == 0xBD7BC39F) {
@ -778,7 +780,7 @@ static void readDatabaseEntry(FsFile& database, struct database_entry* entry) {
entry->crc512 = strtoul(entry->crc512_str, NULL, 16);
}
boolean selectMapping(FsFile& database) {
bool selectMapping(FsFile& database) {
// Select starting letter
byte myLetter = starting_letter();
@ -1746,7 +1748,7 @@ chooseMapper:
newmapper = hundreds * 100 + tens * 10 + units;
// Check if valid
boolean validMapper = 0;
bool validMapper = 0;
byte mapcount = (sizeof(mapsize) / sizeof(mapsize[0])) / 7;
for (byte currMaplist = 0; currMaplist < mapcount; currMaplist++) {
if (pgm_read_byte(mapsize + currMaplist * 7) == newmapper)
@ -1826,7 +1828,7 @@ chooseMapper:
#elif defined(enable_serial)
setmapper:
String newmap;
boolean mapfound = false;
bool mapfound = false;
Serial.println(F("SUPPORTED MAPPERS:"));
for (int i = 0; i < mapcount; i++) {
int index = i * 7;
@ -2498,7 +2500,7 @@ void writeMMC5RAM(word base, word address) { // MMC5 SRAM WRITE
write_prg_byte(0x5103, 0); // PRG RAM PROTECT2
}
void readPRG(boolean readrom) {
void readPRG(bool readrom) {
if (!readrom) {
display_Clear();
display_Update();
@ -3382,6 +3384,26 @@ void readPRG(boolean readrom) {
}
}
break;
case 148: // Sachen SA-008-A and Tengen 800008 -- Bus conflicts
banks = int_pow(2, prgsize) / 2;
busConflict = true;
for (int i = 0; i < banks; i++) {
for (int x = 0; x < 0x8000; x++) {
if (read_prg_byte(0x8000 + x) == i) {
write_prg_byte(0x8000 + x, i << 3);
busConflict = false;
break;
}
}
if (busConflict) {
write_prg_byte(0x8000 + i, i << 3);
}
for (word address = 0x0; address < 0x8000; address += 512) {
dumpPRG(base, address);
}
}
break;
case 153: // 512K
banks = int_pow(2, prgsize);
@ -3710,7 +3732,7 @@ void readPRG(boolean readrom) {
LED_BLUE_OFF;
}
void readCHR(boolean readrom) {
void readCHR(bool readrom) {
if (!readrom) {
display_Clear();
display_Update();
@ -4466,6 +4488,26 @@ void readCHR(boolean readrom) {
}
}
break;
case 148: // Sachen SA-008-A and Tengen 800008 -- Bus conflicts
banks = int_pow(2, chrsize);
busConflict = true;
for (int i = 0; i < banks; i++) {
for (int x = 0; x < 0x8000; x++) {
if (read_prg_byte(0x8000 + x) == i) {
write_prg_byte(0x8000 + x, i & 0x07);
busConflict = false;
break;
}
}
if (busConflict) {
write_prg_byte(0x8000 + i, i & 0x07);
}
for (word address = 0x0; address < 0x2000; address += 512) {
dumpCHR(address);
}
}
break;
case 174: // 64k
for (int i = 0; i < 8; i++) {