Skip to content
This repository was archived by the owner on Mar 16, 2026. It is now read-only.

Commit 7d42803

Browse files
authored
Update NES.ino
- added mapper 351 - fixed mappers 76 and 154
1 parent 80d8bd5 commit 7d42803

File tree

1 file changed

+46
-7
lines changed

1 file changed

+46
-7
lines changed

Cart_Reader/NES.ino

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ static const struct mapper_NES PROGMEM mapsize[] = {
317317
{ 329, 1, 7, 0, 0, 0, 3 }, // EDU2000 (duplicate of 177)
318318
{ 331, 0, 5, 0, 7, 0, 0 }, // NewStar multicarts (NS03, 7-in-1, 12-in-1)
319319
{ 332, 3, 4, 4, 5, 0, 0 }, // WS-1001
320+
{ 351, 0, 6, 0, 8, 0, 0 }, // Techline XB multicarts
320321
{ 366, 0, 6, 0, 8, 0, 0 }, // GN-45
321322
// 422 - TEC9719 [TODO]
322323
{ 446, 0, 8, 0, 0, 0, 0 }, // SMD172B_FPGA
@@ -2100,6 +2101,7 @@ void readPRG(bool readrom) {
21002101
case 248:
21012102
case 268: // submapper 0
21022103
case 315:
2104+
case 351:
21032105
case 366:
21042106
if ((mapper == 206) && (prgsize == 1)) {
21052107
dumpBankPRG(0x0, 0x8000, base);
@@ -2116,7 +2118,12 @@ void readPRG(bool readrom) {
21162118
write_prg_byte(0x5FF3, 0); // extended MMC3 mode: disabled
21172119
write_prg_byte(0x5FF0, 1); // 256K outer bank mode
21182120
}
2119-
for (size_t i = 0; i < banks; i += 1) {
2121+
if (mapper == 351) {
2122+
write_prg_byte(0x5000, 0);
2123+
write_prg_byte(0x5001, 0);
2124+
write_prg_byte(0x5002, 0);
2125+
}
2126+
for (size_t i = 0; i < banks; i++) {
21202127
if (mapper == 37) {
21212128
if (i == 0) {
21222129
write_prg_byte(0x6000, 0); // Switch to Lower Block ($0000-$FFFF)
@@ -2148,8 +2155,8 @@ void readPRG(bool readrom) {
21482155
write_prg_byte(0x6000, (i & 0x180) >> 3 | (i & 0x70) >> 4);
21492156
}
21502157
if (mapper == 134) {
2151-
write_prg_byte(0x6801, (i >> 4) & 0x02); // A18
2152-
write_prg_byte(0x6800, (i >> 2) & 0x10); // A19
2158+
write_prg_byte(0x6000, (i & 0x40) >> 2); // A19
2159+
write_prg_byte(0x6001, (i & 0x30) >> 4); // A18-17
21532160
}
21542161
if (mapper == 176) {
21552162
write_prg_byte(0x5FF1, (i & 0xE0) >> 1);
@@ -2177,6 +2184,9 @@ void readPRG(bool readrom) {
21772184
if (mapper == 315) {
21782185
write_prg_byte(0x6800, (i & 30) >> 3);
21792186
}
2187+
if (mapper == 351) {
2188+
write_prg_byte(0x5001, i << 1);
2189+
}
21802190
if (mapper == 366) {
21812191
write_prg_byte(0x6800 + (i & 0x70), i);
21822192
}
@@ -3375,15 +3385,13 @@ void readCHR(bool readrom) {
33753385
case 52:
33763386
case 64:
33773387
case 74:
3378-
case 76:
33793388
case 95: // 32K
33803389
case 115:
33813390
case 116:
33823391
case 118:
33833392
case 119:
33843393
case 126:
33853394
case 134:
3386-
case 154: // 128K
33873395
case 158:
33883396
case 176:
33893397
case 189:
@@ -3392,6 +3400,7 @@ void readCHR(bool readrom) {
33923400
case 206: // 16K/32K/64K
33933401
case 248:
33943402
case 315:
3403+
case 351:
33953404
case 366:
33963405
banks = int_pow(2, chrsize) * 4;
33973406
write_prg_byte(0xA001, 0x80);
@@ -3405,6 +3414,11 @@ void readCHR(bool readrom) {
34053414
write_prg_byte(0x5FF3, 0); // extended MMC3 mode: disabled
34063415
write_prg_byte(0x5FF0, 1); // 256K outer bank mode
34073416
}
3417+
if (mapper == 351) {
3418+
write_prg_byte(0x5000, 0);
3419+
write_prg_byte(0x5001, 0);
3420+
write_prg_byte(0x5002, 0);
3421+
}
34083422
for (size_t i = 0; i < banks; i++) {
34093423
if (mapper == 12) {
34103424
write_prg_byte(0x4132, (i & 0x100) >> 8 | (i & 0x100) >> 4);
@@ -3440,8 +3454,8 @@ void readCHR(bool readrom) {
34403454
write_prg_byte(0x6000, (i & 0x200) >> 5 | (i & 0x100) >> 3); // select outer bank
34413455
}
34423456
if (mapper == 134) {
3443-
write_prg_byte(0x6801, (i >> 3) & 0x20); // A18
3444-
write_prg_byte(0x6800, (i >> 4) & 0x20); // A19
3457+
write_prg_byte(0x6000, (i & 0x200) >> 4); // A19
3458+
write_prg_byte(0x6001, (i & 0x180) >> 3); // A18-17
34453459
}
34463460
if (mapper == 176) {
34473461
write_prg_byte(0x5FF2, (i & 0x700) >> 3); // outer 256k bank
@@ -3453,6 +3467,9 @@ void readCHR(bool readrom) {
34533467
if (mapper == 315) {
34543468
write_prg_byte(0x6800, ((i & 0x100) >> 8) | ((i & 0x80) >> 6) | ((i & 0x40) >> 3));
34553469
}
3470+
if (mapper == 351) {
3471+
write_prg_byte(0x5000, (i >> 1) & 0xFC);
3472+
}
34563473
if (mapper == 366) {
34573474
write_prg_byte(0x6800 + ((i & 0x380) >> 3), i);
34583475
}
@@ -3831,6 +3848,15 @@ void readCHR(bool readrom) {
38313848
}
38323849
break;
38333850

3851+
case 76:
3852+
banks = int_pow(2, chrsize) * 2;
3853+
for (size_t i = 0; i < banks; i++) {
3854+
write_prg_byte(0x8000, 2);
3855+
write_prg_byte(0x8001, i);
3856+
dumpBankCHR(0x0, 0x800);
3857+
}
3858+
break;
3859+
38343860
case 77: // 32K
38353861
banks = int_pow(2, chrsize) * 2;
38363862
for (size_t i = 0; i < banks; i++) { // 2K Banks
@@ -4012,6 +4038,19 @@ void readCHR(bool readrom) {
40124038
}
40134039
break;
40144040

4041+
case 154: // 128K
4042+
for (size_t i = 0; i < 64; i += 2) {
4043+
write_prg_byte(0x8000, 0);
4044+
write_prg_byte(0x8001, i);
4045+
dumpBankCHR(0x0, 0x800);
4046+
}
4047+
for (size_t i = 0; i < 64; i++) {
4048+
write_prg_byte(0x8000, 2);
4049+
write_prg_byte(0x8001, i);
4050+
dumpBankCHR(0x1000, 0x1400);
4051+
}
4052+
break;
4053+
40154054
case 165: // 128K
40164055
banks = int_pow(2, chrsize);
40174056
for (size_t i = 0; i < banks; i++) {

0 commit comments

Comments
 (0)