Skip to content

Commit 3ccab84

Browse files
authored
Update NES.ino
- added mappers 224, 396, 422, 534 - added placeholders for 268 submappers 2-11 at fake numbers 995-999
1 parent 7d42803 commit 3ccab84

File tree

1 file changed

+103
-48
lines changed

1 file changed

+103
-48
lines changed

Cart_Reader/NES.ino

+103-48
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,12 @@ static const struct mapper_NES PROGMEM mapsize[] = {
262262
{ 221, 0, 7, 0, 0, 0, 0 }, // NTDEC N625092 (400-in-1)
263263
// 222 - 810343-C [TODO]
264264
// 223 - not used (duplicate of 199)
265-
// 224 - 晶科泰 [Jncota] KT-008 (duplicate of 268)
266-
{ 225, 4, 7, 5, 8, 0, 0 }, // ET-4310 / K-1010
267-
{ 226, 6, 7, 0, 0, 0, 0 }, // 0380 / 910307
268-
{ 227, 1, 5, 0, 0, 0, 0 }, // 810449-C-A1 / 外星 [Wàixīng] FW01 / N120-72
269-
{ 228, 4, 7, 5, 7, 0, 0 }, // Action 52 / Cheetahmen II
270-
{ 229, 5, 5, 6, 6, 0, 0 }, // SC 0892 / BMC 31-IN-1
265+
{ 224, 0, 11, 0, 8, 0, 0 }, // 晶科泰 [Jncota] KT-008
266+
{ 225, 4, 7, 5, 8, 0, 0 }, // ET-4310 / K-1010
267+
{ 226, 6, 7, 0, 0, 0, 0 }, // 0380 / 910307
268+
{ 227, 1, 5, 0, 0, 0, 0 }, // 810449-C-A1 / 外星 [Wàixīng] FW01 / N120-72
269+
{ 228, 4, 7, 5, 7, 0, 0 }, // Action 52 / Cheetahmen II
270+
{ 229, 5, 5, 6, 6, 0, 0 }, // SC 0892 / BMC 31-IN-1
271271
// 230 - CTC-43A [TODO]
272272
// 231 - 20-in-1 [TODO]
273273
{ 232, 4, 4, 0, 0, 0, 0 }, // BIC BF9096 (Camerica/Codemasters "Quattro" cartridges)
@@ -305,27 +305,33 @@ static const struct mapper_NES PROGMEM mapsize[] = {
305305
// 264 - Yoko Soft / Cony Soft [TODO]
306306
// 265 - T-262 multicarts [TODO]
307307
// 266 - City Fighter IV [TODO]
308-
// 267 - 晶太 EL861121C / JY-119 multicart [TODO]
309-
{ 268, 0, 11, 0, 8, 0, 0 }, // KP6022 / AA6023 ASIC (Mindkids/Coolboy)
308+
// 267 - 晶太 [Jīngtài] EL861121C / JY-119 multicart [TODO]
309+
{ 268, 0, 11, 0, 8, 0, 0 }, // KP6022 / AA6023 ASIC (Mindkids/Coolboy) [268.0-1]
310310
{ 286, 0, 3, 0, 5, 0, 0 }, // Benshieng BS-5 multicarts [TODO]
311311
{ 288, 0, 3, 0, 4, 0, 0 }, // GKCXIN1 (21-in-1)
312312
{ 289, 5, 7, 0, 0, 0, 0 }, // 60311C / N76A-1
313313
{ 290, 0, 5, 0, 4, 0, 0 }, // Asder 20-in-1
314314
// 313 - undumpable (reset-based TKROM multicarts)
315-
{ 315, 0, 5, 0, 7, 0, 0 }, // 820732C / 830134C
316-
{ 319, 3, 3, 4, 4, 0, 0 }, // HP-898F / KD-7/9-E
317-
{ 329, 1, 7, 0, 0, 0, 3 }, // EDU2000 (duplicate of 177)
318-
{ 331, 0, 5, 0, 7, 0, 0 }, // NewStar multicarts (NS03, 7-in-1, 12-in-1)
319-
{ 332, 3, 4, 4, 5, 0, 0 }, // WS-1001
320-
{ 351, 0, 6, 0, 8, 0, 0 }, // Techline XB multicarts
321-
{ 366, 0, 6, 0, 8, 0, 0 }, // GN-45
322-
// 422 - TEC9719 [TODO]
315+
{ 315, 0, 5, 0, 7, 0, 0 }, // 820732C / 830134C
316+
{ 319, 3, 3, 4, 4, 0, 0 }, // HP-898F / KD-7/9-E
317+
{ 329, 1, 7, 0, 0, 0, 3 }, // EDU2000 (duplicate of 177)
318+
{ 331, 0, 5, 0, 7, 0, 0 }, // NewStar multicarts (NS03, 7-in-1, 12-in-1)
319+
{ 332, 3, 4, 4, 5, 0, 0 }, // WS-1001
320+
{ 351, 0, 6, 0, 8, 0, 0 }, // Techline XB multicarts
321+
{ 366, 0, 6, 0, 8, 0, 0 }, // GN-45
322+
{ 396, 0, 6, 0, 0, 0, 0 }, // 晶太 [Jīngtài] YY850437C
323+
{ 422, 1, 8, 0, 8, 0, 0 }, // TEC9719
323324
{ 446, 0, 8, 0, 0, 0, 0 }, // SMD172B_FPGA
324325
{ 470, 0, 11, 0, 0, 0, 0 }, // INX_007T_V01
325326
{ 532, 4, 4, 6, 6, 0, 0 }, // CHINA_ER_SAN2 (duplicate of 19)
326-
// 534 - ING003C [TODO]
327+
{ 534, 1, 8, 0, 8, 0, 0 }, // ING003C / PJ-008 / AT-207
327328
// 551 - 晶科泰 [Jncota] KT-xxx [TODO]
328-
{ 552, 0, 5, 0, 6, 0, 0 } // Taito P3-044 (X1-017, actual bank order)
329+
{ 552, 0, 5, 0, 6, 0, 0 }, // Taito P3-044 (X1-017, actual bank order)
330+
{ 995, 0, 11, 0, 8, 0, 0 }, // [placeholder for 268.2-3]
331+
{ 996, 0, 8, 0, 8, 0, 0 }, // [placeholder for 268.4-5]
332+
{ 997, 0, 11, 0, 8, 0, 0 }, // [placeholder for 268.6-7]
333+
{ 998, 0, 6, 0, 6, 0, 0 }, // [placeholder for 268.8-9]
334+
{ 999, 0, 6, 0, 6, 0, 0 } // [placeholder for 268.10-11]
329335
};
330336

331337
const char _file_name_no_number_fmt[] PROGMEM = "%s.%s";
@@ -2097,19 +2103,27 @@ void readPRG(bool readrom) {
20972103
case 195:
20982104
case 196:
20992105
case 206: // 32/64/128K
2106+
case 224:
21002107
case 245: // 1024K
21012108
case 248:
21022109
case 268: // submapper 0
21032110
case 315:
21042111
case 351:
21052112
case 366:
2113+
case 422:
2114+
case 534:
2115+
case 995:
2116+
case 996:
2117+
case 997:
2118+
case 998:
2119+
case 999:
21062120
if ((mapper == 206) && (prgsize == 1)) {
21072121
dumpBankPRG(0x0, 0x8000, base);
21082122
} else {
21092123
banks = int_pow(2, prgsize) * 2;
21102124
write_prg_byte(0xA001, 0x80); // Block Register - PRG RAM Chip Enable, Writable
2111-
if (mapper == 126) {
2112-
write_prg_byte(0x6003, 0); // set MMC3 banking mode
2125+
if ((mapper == 126) || (mapper == 422) || (mapper == 534)) {
2126+
write_prg_byte(0x6803, 0); // set MMC3 banking mode
21132127
}
21142128
if ((mapper == 115) || (mapper == 134) || (mapper == 248)) {
21152129
write_prg_byte(0x6000, 0); // set MMC3 banking mode
@@ -2151,8 +2165,9 @@ void readPRG(bool readrom) {
21512165
if (mapper == 116) {
21522166
write_prg_byte(0x4100, 0x01); // MMC3 mode
21532167
}
2154-
if (mapper == 126) {
2155-
write_prg_byte(0x6000, (i & 0x180) >> 3 | (i & 0x70) >> 4);
2168+
if ((mapper == 126) || (mapper == 422) || (mapper == 534)) {
2169+
write_prg_byte(0x6800, (i & 0x300) >> 4 | (i & 0x70) >> 4); // submapper 0
2170+
// write_prg_byte(0x6800, (i & 0x80) >> 2 | (i & 0x70) >> 4); // submapper 1
21562171
}
21572172
if (mapper == 134) {
21582173
write_prg_byte(0x6000, (i & 0x40) >> 2); // A19
@@ -2171,15 +2186,11 @@ void readPRG(bool readrom) {
21712186
write_prg_byte(0x8001, 0xFF);
21722187
}
21732188
}
2174-
if (mapper == 268) {
2189+
if ((mapper == 224) || (mapper == 268)) {
21752190
write_prg_byte(0x5000, ((i & 0x70) >> 4) | ((i & 0xC00) >> 6));
21762191
write_prg_byte(0x5001, ((i & 0x80) >> 3) | ((i & 0x300) >> 6) | 0x60);
2177-
write_prg_byte(0x5002, 0);
2178-
write_prg_byte(0x5003, 0);
21792192
write_prg_byte(0x6000, ((i & 0x70) >> 4) | ((i & 0xC00) >> 6));
21802193
write_prg_byte(0x6001, ((i & 0x80) >> 3) | ((i & 0x300) >> 6) | 0x60);
2181-
write_prg_byte(0x6002, 0);
2182-
write_prg_byte(0x6003, 0);
21832194
}
21842195
if (mapper == 315) {
21852196
write_prg_byte(0x6800, (i & 30) >> 3);
@@ -2190,6 +2201,42 @@ void readPRG(bool readrom) {
21902201
if (mapper == 366) {
21912202
write_prg_byte(0x6800 + (i & 0x70), i);
21922203
}
2204+
if (mapper == 995) {
2205+
write_prg_byte(0x5000, ((i & 0x70) >> 4) | ((i & 0xC00) >> 6));
2206+
write_prg_byte(0x5001, ((i & 0x80) >> 4) | ((i & 0x100) >> 6) | ((i & 0x200) >> 8) | 0x60);
2207+
write_prg_byte(0x6000, ((i & 0x70) >> 4) | ((i & 0xC00) >> 6));
2208+
write_prg_byte(0x6001, ((i & 0x80) >> 4) | ((i & 0x100) >> 6) | ((i & 0x200) >> 8) | 0x60);
2209+
}
2210+
if (mapper == 996) {
2211+
write_prg_byte(0x5000, ((i & 0x70) >> 4) | ((i & 0x180) >> 3));
2212+
write_prg_byte(0x5001, 0x60);
2213+
write_prg_byte(0x6000, ((i & 0x70) >> 4) | ((i & 0x180) >> 3));
2214+
write_prg_byte(0x6001, 0x60);
2215+
}
2216+
if (mapper == 997) {
2217+
if (i >= banks / 2) {
2218+
write_prg_byte(0x5000, ((i & 0x70) >> 4) | ((i & 0xC00) >> 6) | 0x88);
2219+
write_prg_byte(0x6000, ((i & 0x70) >> 4) | ((i & 0xC00) >> 6) | 0x88);
2220+
} else {
2221+
write_prg_byte(0x5000, ((i & 0x70) >> 4) | ((i & 0xC00) >> 6));
2222+
write_prg_byte(0x6000, ((i & 0x70) >> 4) | ((i & 0xC00) >> 6));
2223+
}
2224+
write_prg_byte(0x6001, ((i & 0x80) >> 3) | ((i & 0x300) >> 6) | 0x60);
2225+
write_prg_byte(0x6002, 0x00);
2226+
write_prg_byte(0x6003, 0x00);
2227+
}
2228+
if ((mapper == 998) || (mapper == 999)) {
2229+
write_prg_byte(0x5000, ((i & 0x70) >> 4));
2230+
write_prg_byte(0x5001, 0x60);
2231+
write_prg_byte(0x6000, ((i & 0x70) >> 4));
2232+
write_prg_byte(0x6001, 0x60);
2233+
}
2234+
if ((mapper == 224) || (mapper == 268) || (mapper == 995) || (mapper == 996) || (mapper == 997) || (mapper == 998) || (mapper == 999)) {
2235+
write_prg_byte(0x5002, 0x00);
2236+
write_prg_byte(0x5003, 0x00);
2237+
write_prg_byte(0x6002, 0x00);
2238+
write_prg_byte(0x6003, 0x00);
2239+
}
21932240
write_prg_byte(0x8000, 0x06); // PRG Bank 0 ($8000-$9FFF)
21942241
write_prg_byte(0x8001, i);
21952242
dumpBankPRG(0x0, 0x2000, base);
@@ -2710,7 +2757,7 @@ void readPRG(bool readrom) {
27102757

27112758
case 91:
27122759
banks = int_pow(2, prgsize) * 2;
2713-
for (size_t i = 0; i < banks; i += 1) {
2760+
for (size_t i = 0; i < banks; i++) {
27142761
write_prg_byte(0x8000 + ((i & 0x30) >> 3), i); // PRG A18-A17 (submapper 0 only)
27152762
write_prg_byte(0x7000, i); // PRG -A13
27162763
dumpBankPRG(0x0, 0x2000, base);
@@ -2833,7 +2880,7 @@ void readPRG(bool readrom) {
28332880

28342881
case 120:
28352882
base = 0x6000;
2836-
for (size_t i = 0; i < 8; i += 1) {
2883+
for (size_t i = 0; i < 8; i++) {
28372884
write_prg_byte(0x41FF, i);
28382885
dumpBankPRG(0x0, 0x2000, base);
28392886
}
@@ -2843,7 +2890,7 @@ void readPRG(bool readrom) {
28432890

28442891
case 125:
28452892
base = 0x6000;
2846-
for (size_t i = 0; i < 16; i += 1) {
2893+
for (size_t i = 0; i < 16; i++) {
28472894
write_prg_byte(0x6000, i);
28482895
dumpBankPRG(0x0, 0x2000, base);
28492896
}
@@ -3271,6 +3318,15 @@ void readPRG(bool readrom) {
32713318
}
32723319
break;
32733320

3321+
case 396:
3322+
banks = int_pow(2, prgsize);
3323+
for (int i = 0; i < banks; i++) {
3324+
write_prg_byte(0xA000, (i >> 3) & 0x07);
3325+
write_prg_byte(0x8000, i & 0x07);
3326+
dumpBankPRG(0x0, 0x4000, base);
3327+
}
3328+
break;
3329+
32743330
case 446:
32753331
banks = int_pow(2, prgsize) * 2;
32763332
write_prg_byte(0x5003, 0);
@@ -3398,14 +3454,18 @@ void readCHR(bool readrom) {
33983454
case 195:
33993455
case 196:
34003456
case 206: // 16K/32K/64K
3457+
case 224:
34013458
case 248:
3459+
case 268:
34023460
case 315:
34033461
case 351:
34043462
case 366:
3463+
case 422:
3464+
case 534:
34053465
banks = int_pow(2, chrsize) * 4;
34063466
write_prg_byte(0xA001, 0x80);
3407-
if (mapper == 126) {
3408-
write_prg_byte(0x6003, 0); // set MMC3 banking mode
3467+
if ((mapper == 126) || (mapper == 422) || (mapper == 534)) {
3468+
write_prg_byte(0x6803, 0); // set MMC3 banking mode
34093469
}
34103470
if ((mapper == 115) || (mapper == 134) || (mapper == 248)) {
34113471
write_prg_byte(0x6000, 0); // set MMC3 banking mode
@@ -3451,7 +3511,7 @@ void readCHR(bool readrom) {
34513511
write_prg_byte(0x4100, 0x01 | ((i & 0x100) >> 6)); // A18
34523512
}
34533513
if (mapper == 126) {
3454-
write_prg_byte(0x6000, (i & 0x200) >> 5 | (i & 0x100) >> 3); // select outer bank
3514+
write_prg_byte(0x6800, (i & 0x200) >> 5 | (i & 0x100) >> 3); // select outer bank
34553515
}
34563516
if (mapper == 134) {
34573517
write_prg_byte(0x6000, (i & 0x200) >> 4); // A19
@@ -3460,7 +3520,7 @@ void readCHR(bool readrom) {
34603520
if (mapper == 176) {
34613521
write_prg_byte(0x5FF2, (i & 0x700) >> 3); // outer 256k bank
34623522
}
3463-
if (mapper == 268) {
3523+
if ((mapper == 224) || (mapper == 268) || (mapper == 995) || (mapper == 996) || (mapper == 997)) {
34643524
write_prg_byte(0x5000, ((i & 0x380) >> 4) | ((i & 0xC00) >> 9));
34653525
write_prg_byte(0x6000, ((i & 0x380) >> 4) | ((i & 0xC00) >> 9));
34663526
}
@@ -3473,6 +3533,13 @@ void readCHR(bool readrom) {
34733533
if (mapper == 366) {
34743534
write_prg_byte(0x6800 + ((i & 0x380) >> 3), i);
34753535
}
3536+
if ((mapper == 422) || (mapper == 534)) {
3537+
write_prg_byte(0x6800, (i & 0x380) >> 4);
3538+
}
3539+
if ((mapper == 998) || (mapper == 999)) {
3540+
write_prg_byte(0x5000, (i & 0x80) >> 4);
3541+
write_prg_byte(0x6000, (i & 0x80) >> 4);
3542+
}
34763543
write_prg_byte(0x8000, 0x02);
34773544
write_prg_byte(0x8001, i);
34783545
dumpBankCHR(0x1000, 0x1400);
@@ -3650,7 +3717,7 @@ void readCHR(bool readrom) {
36503717

36513718
case 34: // NINA
36523719
banks = int_pow(2, chrsize);
3653-
for (size_t i = 0; i < banks; i += 1) {
3720+
for (size_t i = 0; i < banks; i++) {
36543721
write_prg_byte(0x7FFE, i); // Select 4 KB CHR bank at $0000
36553722
delay(200); // NINA seems slow to switch banks
36563723
dumpBankCHR(0x0, 0x1000);
@@ -3960,7 +4027,7 @@ void readCHR(bool readrom) {
39604027

39614028
case 91:
39624029
banks = int_pow(2, chrsize) * 2;
3963-
for (size_t i = 0; i < banks; i += 1) {
4030+
for (size_t i = 0; i < banks; i++) {
39644031
write_prg_byte(0x8000 + ((i & 0x100) >> 8), i); // CHR A19 (submapper 0 only)
39654032
write_prg_byte(0x6000, i); // CHR A18-A11
39664033
dumpBankCHR(0x0, 0x800);
@@ -4210,18 +4277,6 @@ void readCHR(bool readrom) {
42104277
}
42114278
break;
42124279

4213-
case 268: // mapper 268.0 and 268.1
4214-
banks = int_pow(2, chrsize) * 4;
4215-
write_prg_byte(0xA001, 0x80);
4216-
for (size_t i = 0; i < banks; i++) {
4217-
write_prg_byte(0x6000, ((i & 0x380) >> 4) | ((i & 0xC00) >> 9));
4218-
write_prg_byte(0x5000, ((i & 0x380) >> 4) | ((i & 0xC00) >> 9));
4219-
write_prg_byte(0x8000, 0x02);
4220-
write_prg_byte(0x8001, i);
4221-
dumpBankCHR(0x1000, 0x1400);
4222-
}
4223-
break;
4224-
42254280
case 286:
42264281
banks = int_pow(2, chrsize) * 2;
42274282
for (int i = 0; i < banks; i++) {

0 commit comments

Comments
 (0)