Skip to content

Commit

Permalink
Disable SRAM when flashing 2x2MB repro
Browse files Browse the repository at this point in the history
  • Loading branch information
sanni committed Jun 29, 2024
1 parent 4e7ef93 commit 27b84d2
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Cart_Reader/FLASH.ino
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ void writeByte_Flash(unsigned long myAddress, byte myData) {
// A15-A22
PORTL = (myAddress >> 15) & 0xFF;
// Flip A22(PL7) to reverse P0 and P1 roms
PORTL ^= (1 << PL7);
PORTL ^= (1 << 7);
}
// for SNES ExHiRom repro
else if (mapping == 3) {
Expand Down Expand Up @@ -909,7 +909,7 @@ void writeByte_Flash(unsigned long myAddress, byte myData) {
// A15-A22
PORTL = (myAddress >> 15) & 0xFF;
// Flip BA6(PL6) to address second rom chip
PORTL ^= (1 << PL6);
PORTL ^= (1 << 6);
}
// for SNES HiRom repro with 2x 2MB
else if (mapping == 5) {
Expand All @@ -918,7 +918,9 @@ void writeByte_Flash(unsigned long myAddress, byte myData) {
// A16-A23
PORTL = (myAddress >> 16) & 0xFF;
// Flip BA5(PL5) to address second rom chip
PORTL ^= (1 << PL5);
PORTL ^= (1 << 5);
// Switch SNES BA6(PL6) to HIGH to disable SRAM
PORTL |= (1 << 6);
}

// Data
Expand Down Expand Up @@ -985,7 +987,7 @@ byte readByte_Flash(unsigned long myAddress) {
// A15-A22
PORTL = (myAddress >> 15) & 0xFF;
// Flip A22(PL7) to reverse P0 and P1 roms
PORTL ^= (1 << PL7);
PORTL ^= (1 << 7);
}
// for SNES ExHiRom repro
else if (mapping == 3) {
Expand Down Expand Up @@ -1013,7 +1015,7 @@ byte readByte_Flash(unsigned long myAddress) {
// A15-A22
PORTL = (myAddress >> 15) & 0xFF;
// Flip BA6(PL6) to address second rom chip
PORTL ^= (1 << PL6);
PORTL ^= (1 << 6);
}
// for SNES HiRom repro with 2x 2MB
else if (mapping == 5) {
Expand All @@ -1022,7 +1024,9 @@ byte readByte_Flash(unsigned long myAddress) {
// A16-A23
PORTL = (myAddress >> 16) & 0xFF;
// Flip BA5(PL5) to address second rom chip
PORTL ^= (1 << PL5);
PORTL ^= (1 << 5);
// Switch SNES BA6(PL6) to HIGH to disable SRAM
PORTL |= (1 << 6);
}

// Arduino running at 16Mhz -> one nop = 62.5ns
Expand Down

0 comments on commit 27b84d2

Please sign in to comment.