Skip to content

Commit

Permalink
Update NES.ino
Browse files Browse the repository at this point in the history
fix mapper 80
  • Loading branch information
nsx0r authored Aug 28, 2024
1 parent 125e9b4 commit 5cbbfa6
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions Cart_Reader/NES.ino
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ static const struct mapper_NES PROGMEM mapsize[] = {
{ 78, 3, 3, 5, 5, 0, 0 }, // irem 74hc161/32
{ 79, 1, 2, 2, 3, 0, 0 }, // NINA-03/06 by AVE [UNLICENSED]
{ 80, 3, 3, 5, 6, 0, 1 }, // taito x1-005 [prgram r/w]
{ 82, 3, 3, 5, 6, 0, 1 }, // taito x1-017 [prgram r/w]
{ 82, 3, 5, 5, 6, 0, 1 }, // taito x1-017 [prgram r/w]
// 84 - bad mapper, not used
{ 85, 3, 5, 0, 5, 0, 1 }, // vrc7 [sram r/w]
{ 86, 3, 3, 4, 4, 0, 0 }, // jaleco jf-13 (moero pro yakyuu)
Expand Down Expand Up @@ -2286,10 +2286,9 @@ void readPRG(bool readrom) {
case 80: // 128K
case 207: // 256K [CART SOMETIMES NEEDS POWERCYCLE]
banks = int_pow(2, prgsize) * 2;
for (size_t i = 0; i < banks; i += 2) {
for (size_t i = 0; i < banks; i++) {
write_prg_byte(0x7EFA, i); // PRG Bank 0 ($8000-$9FFF)
write_prg_byte(0x7EFC, i + 1); // PRG Bank 1 ($A000-$BFFF)
dumpBankPRG(0x0, 0x4000, base);
dumpBankPRG(0x0, 0x2000, base);
}
break;

Expand Down Expand Up @@ -3296,13 +3295,12 @@ void readCHR(bool readrom) {
case 80: // 128K/256K
case 82: // 128K/256K
case 207: // 128K [CART SOMETIMES NEEDS POWERCYCLE]
banks = int_pow(2, chrsize) * 4;
for (size_t i = 0; i < banks; i += 4) {
write_prg_byte(0x7EF2, i); // CHR Bank 2 [REGISTERS 0x7EF0/0x7EF1 WON'T WORK]
write_prg_byte(0x7EF3, i + 1); // CHR Bank 3
write_prg_byte(0x7EF4, i + 2); // CHR Bank 4
write_prg_byte(0x7EF5, i + 3); // CHR Bank 5
dumpBankCHR(0x0, 0x2000);
banks = int_pow(2, chrsize) * 2;
write_prg_byte(0x7EF6, 0x00); // CHR mode [2x 2KiB banks at $0000-$0FFF]
for (size_t i = 0; i < banks; i += 2) {
write_prg_byte(0x7EF0, i << 1);
write_prg_byte(0x7EF1, (i + 1) << 1);
dumpBankCHR(0x0, 0x1000);
}
break;

Expand Down Expand Up @@ -4651,4 +4649,4 @@ void A29040B_writeFLASH() {
#endif
//******************************************
// End of File
//******************************************
//******************************************

0 comments on commit 5cbbfa6

Please sign in to comment.