aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Cart_Reader/5200.ino2
-rw-r--r--Cart_Reader/7800.ino2
-rw-r--r--Cart_Reader/ARC.ino2
-rw-r--r--Cart_Reader/C64.ino2
-rw-r--r--Cart_Reader/COLV.ino2
-rw-r--r--Cart_Reader/Cart_Reader.ino20
-rw-r--r--Cart_Reader/Config.h36
-rw-r--r--Cart_Reader/FAIRCHILD.ino2
-rw-r--r--Cart_Reader/FLASH.ino300
-rw-r--r--Cart_Reader/GB.ino15
-rw-r--r--Cart_Reader/GBA.ino10
-rw-r--r--Cart_Reader/INTV.ino2
-rw-r--r--Cart_Reader/MD.ino2
-rw-r--r--Cart_Reader/MSX.ino2
-rw-r--r--Cart_Reader/N64.ino141
-rw-r--r--Cart_Reader/NGP.ino2
-rw-r--r--Cart_Reader/ODY2.ino2
-rw-r--r--Cart_Reader/OSCR.cpp6
-rw-r--r--Cart_Reader/OSCR.h2
-rw-r--r--Cart_Reader/PCE.ino220
-rw-r--r--Cart_Reader/PCW.ino53
-rw-r--r--Cart_Reader/SFM.ino5
-rw-r--r--Cart_Reader/SNES.ino241
-rw-r--r--Cart_Reader/SUPRACAN.ino2
-rw-r--r--Cart_Reader/VECTREX.ino99
-rw-r--r--Cart_Reader/WS.ino2
-rw-r--r--Cart_Reader/WSV.ino2
-rw-r--r--sd/7800.txt3
-rw-r--r--sd/n64.txt2
-rwxr-xr-xsd/nes.txt3
-rw-r--r--sd/pcw.txt4
31 files changed, 887 insertions, 301 deletions
diff --git a/Cart_Reader/5200.ino b/Cart_Reader/5200.ino
index 4cf137e..2b881d4 100644
--- a/Cart_Reader/5200.ino
+++ b/Cart_Reader/5200.ino
@@ -332,7 +332,7 @@ void checkMapperSize_5200() {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
void printRomSize_5200(int index) {
display_Clear();
- print_Msg(F("ROM Size: "));
+ print_Msg(FS(FSTRING_ROM_SIZE));
println_Msg(a5200[index]);
}
#endif
diff --git a/Cart_Reader/7800.ino b/Cart_Reader/7800.ino
index fee491d..778bbcc 100644
--- a/Cart_Reader/7800.ino
+++ b/Cart_Reader/7800.ino
@@ -478,7 +478,7 @@ void println_Mapper7800(byte mapper) {
void printRomSize_7800(int index) {
display_Clear();
- print_Msg(F("ROM Size: "));
+ print_Msg(FS(FSTRING_ROM_SIZE));
println_Msg(a7800[index]);
}
#endif
diff --git a/Cart_Reader/ARC.ino b/Cart_Reader/ARC.ino
index d3c62a0..b3179d8 100644
--- a/Cart_Reader/ARC.ino
+++ b/Cart_Reader/ARC.ino
@@ -179,7 +179,7 @@ void readROM_ARC() {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
void printRomSize_ARC(int index) {
display_Clear();
- print_Msg(F("ROM Size: "));
+ print_Msg(FS(FSTRING_ROM_SIZE));
println_Msg(ARC[index]);
}
#endif
diff --git a/Cart_Reader/C64.ino b/Cart_Reader/C64.ino
index cac9258..c34537d 100644
--- a/Cart_Reader/C64.ino
+++ b/Cart_Reader/C64.ino
@@ -629,7 +629,7 @@ void checkMapperSize_C64() {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
void printRomSize_C64(int index) {
display_Clear();
- print_Msg(F("ROM Size: "));
+ print_Msg(FS(FSTRING_ROM_SIZE));
println_Msg(C64[index]);
}
#endif
diff --git a/Cart_Reader/COLV.ino b/Cart_Reader/COLV.ino
index 4a5afb2..56b7401 100644
--- a/Cart_Reader/COLV.ino
+++ b/Cart_Reader/COLV.ino
@@ -204,7 +204,7 @@ void readROM_COL() {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
void printRomSize_COL(int index) {
display_Clear();
- print_Msg(F("ROM Size: "));
+ print_Msg(FS(FSTRING_ROM_SIZE));
println_Msg(pgm_read_byte(&(COL[index])));
}
#endif
diff --git a/Cart_Reader/Cart_Reader.ino b/Cart_Reader/Cart_Reader.ino
index 3b56d48..0188f36 100644
--- a/Cart_Reader/Cart_Reader.ino
+++ b/Cart_Reader/Cart_Reader.ino
@@ -4,8 +4,8 @@
This project represents a community-driven effort to provide
an easy to build and easy to modify cartridge dumper.
- Date: 2024-03-02
- Version: 13.2
+ Date: 2024-07-05
+ Version: 13.5
SD lib: https://github.com/greiman/SdFat
LCD lib: https://github.com/olikraus/u8g2
@@ -34,14 +34,16 @@
RobinTheHood - GameboyAdvanceRomDumper
Gens-gs - Megadrive checksum
fceux - iNes header
+ PsyK0p4T - Sufami Turbo module
+ LuigiBlood - SNES Game Processor RAM Cassette module
And a special Thank You to all coders and contributors on Github and the Arduino forum:
jiyunomegami, splash5, Kreeblah, ramapcsx2, PsyK0p4T, Dakkaron, majorpbx, Pickle, sdhizumi,
- Uzlopak, sakman55, Tombo89, scrap-a, borti4938, vogelfreiheit, CaitSith2, Modman,
- philenotfound, karimhadjsalem, nsx0r, ducky92, niklasweber, Lesserkuma, BacteriaMage,
- vpelletier, Ancyker, mattiacci, RWeick, joshman196, partlyhuman, ButThouMust, hxlnt,
- breyell, qufb
-
+ Uzlopak, sakman55, Tombo89, scrap-a, borti4938, vogelfreiheit, CaitSith2, Modman, Chomemel,
+ philenotfound, karimhadjsalem, nsx0r, ducky92, niklasweber, Lesserkuma, BacteriaMage, qufb,
+ vpelletier, Ancyker, mattiacci, RWeick, ButThouMust, partlyhuman, fakkuyuu, hxlnt, breyell,
+ smesgr9000, joshman196, PsychoFox11, plaidpants, LuigiBlood, InvalidInterrupt
+
And to nocash for figuring out the secrets of the SFC Nintendo Power cartridge.
This program is free software: you can redistribute it and/or modify
@@ -2826,7 +2828,7 @@ unsigned char questionBox_Display(const __FlashStringHelper* question, char answ
// Attract Mode
if (millis() - idleTime > 300000) {
if ((millis() - idleTime) % 4000 == 0) {
- if (currentColor < 7) {
+ if (currentColor < 5) {
currentColor++;
if (currentColor == 1) {
currentColor = 2; // skip red as that signifies an error to the user
@@ -2834,8 +2836,8 @@ unsigned char questionBox_Display(const __FlashStringHelper* question, char answ
} else {
currentColor = 0;
}
+ rgbLed(currentColor);
}
- rgbLed(currentColor);
}
/* Check Button/rotary encoder
diff --git a/Cart_Reader/Config.h b/Cart_Reader/Config.h
index 2ad5b27..8424328 100644
--- a/Cart_Reader/Config.h
+++ b/Cart_Reader/Config.h
@@ -131,7 +131,7 @@
/****/
-/* [ Flashrom Programmer for SNES repros -------------------------- ]
+/* [ Flashrom Programmer for repro carts -------------------------- ]
*/
#define ENABLE_FLASH
@@ -449,46 +449,46 @@
*/
#if defined(ENABLE_CONFIG)
-# define CONFIG_FILE "config.txt"
+#define CONFIG_FILE "config.txt"
// Define the max length of the key=value pairs
// Do your best not to have to increase these.
-# define CONFIG_KEY_MAX 32
-# define CONFIG_VALUE_MAX 32
+#define CONFIG_KEY_MAX 32
+#define CONFIG_VALUE_MAX 32
#endif
#if (defined(HW4) || defined(HW5))
-# define ENABLE_LCD
-# define ENABLE_NEOPIXEL
-# define ENABLE_ROTARY
+#define ENABLE_LCD
+#define ENABLE_NEOPIXEL
+#define ENABLE_ROTARY
//# define rotate_counter_clockwise
-# define ENABLE_CLOCKGEN
-# define OPTION_N64_FASTCRC
-# define OPTION_WS_ADAPTER_V2
+#define ENABLE_CLOCKGEN
+#define OPTION_N64_FASTCRC
+#define OPTION_WS_ADAPTER_V2
#endif
#if (defined(HW2) || defined(HW3))
-# define ENABLE_OLED
-# define ENABLE_BUTTON2
-# define ENABLE_CLOCKGEN
-# define ENABLE_CA_LED
-# define OPTION_N64_FASTCRC
+#define ENABLE_OLED
+#define ENABLE_BUTTON2
+#define ENABLE_CLOCKGEN
+#define ENABLE_CA_LED
+#define OPTION_N64_FASTCRC
#endif
#if defined(HW1)
-# define ENABLE_OLED
+#define ENABLE_OLED
//#define ENABLE_CLOCKGEN
//#define OPTION_N64_FASTCRC
#endif
#if defined(SERIAL_MONITOR)
-# define ENABLE_SERIAL
+#define ENABLE_SERIAL
//#define ENABLE_CLOCKGEN
//#define OPTION_N64_FASTCRC
#endif
/* Firmware updater only works with HW3 and HW5 */
#if !(defined(HW5) || defined(HW3))
-# undef ENABLE_UPDATER
+#undef ENABLE_UPDATER
#endif
/* End of settings */
diff --git a/Cart_Reader/FAIRCHILD.ino b/Cart_Reader/FAIRCHILD.ino
index 03b7111..e665c45 100644
--- a/Cart_Reader/FAIRCHILD.ino
+++ b/Cart_Reader/FAIRCHILD.ino
@@ -496,7 +496,7 @@ void read16K_FAIRCHILD() { // Read 16K Bytes
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
void printRomSize_FAIRCHILD(int index) {
display_Clear();
- print_Msg(F("ROM Size: "));
+ print_Msg(FS(FSTRING_ROM_SIZE));
println_Msg(FAIRCHILD[index]);
}
#endif
diff --git a/Cart_Reader/FLASH.ino b/Cart_Reader/FLASH.ino
index 6cdcb7c..48568df 100644
--- a/Cart_Reader/FLASH.ino
+++ b/Cart_Reader/FLASH.ino
@@ -15,7 +15,7 @@ unsigned long time;
unsigned long blank;
unsigned long sectorSize;
uint16_t bufferSize;
-byte mapping = 1;
+byte mapping = 0;
/******************************************
Menu
@@ -31,15 +31,23 @@ static const char flashMenuItemPrint[] PROGMEM = "Print";
// 8bit Flash menu items
static const char* const menuOptionsFLASH8[] PROGMEM = { flashMenuItemBlankcheck, flashMenuItemErase, flashMenuItemRead, flashMenuItemWrite, flashMenuItemID, flashMenuItemPrint, FSTRING_RESET };
+#ifndef ENABLE_FLASH16
+// Flash mode menu
+static const char modeMenuItem1[] PROGMEM = "CFI Mode";
+static const char modeMenuItem2[] PROGMEM = "Standard Mode";
+static const char* const menuOptionsMode[] PROGMEM = { modeMenuItem1, modeMenuItem2, FSTRING_RESET };
+#endif
+
// Misc flash strings
const char PROGMEM ATTENTION_3_3V[] = "ATTENTION 3.3V";
#ifdef ENABLE_FLASH16
// Flash start menu
-static const char flashMenuItem1[] PROGMEM = "8bit Flash adapter";
-static const char flashMenuItem2[] PROGMEM = "Eprom adapter";
-static const char flashMenuItem3[] PROGMEM = "16bit Flash adapter";
-static const char* const menuOptionsFlash[] PROGMEM = { flashMenuItem1, flashMenuItem2, flashMenuItem3, FSTRING_RESET };
+static const char flashMenuItem1[] PROGMEM = "CFI";
+static const char flashMenuItem2[] PROGMEM = "8bit Flash";
+static const char flashMenuItem3[] PROGMEM = "Eprom";
+static const char flashMenuItem4[] PROGMEM = "16bit Flash";
+static const char* const menuOptionsFlash[] PROGMEM = { flashMenuItem1, flashMenuItem2, flashMenuItem3, flashMenuItem4, FSTRING_RESET };
// 16bit Flash menu items
static const char* const menuOptionsFLASH16[] PROGMEM = { flashMenuItemBlankcheck, flashMenuItemErase, flashMenuItemRead, flashMenuItemWrite, flashMenuItemID, flashMenuItemPrint, FSTRING_RESET };
@@ -49,41 +57,49 @@ static const char epromMenuItem4[] PROGMEM = "Verify";
static const char* const menuOptionsEprom[] PROGMEM = { flashMenuItemBlankcheck, flashMenuItemRead, flashMenuItemWrite, epromMenuItem4, flashMenuItemPrint, FSTRING_RESET };
void flashMenu() {
- // create menu with title and 3 options to choose from
+ display_Clear();
+ display_Update();
+ mapping = 0;
+
+ // create menu with title and 5 options to choose from
unsigned char flashSlot;
// Copy menuOptions out of progmem
- convertPgm(menuOptionsFlash, 4);
- flashSlot = question_box(F("Select adapter PCB"), menuOptions, 4, 0);
+ convertPgm(menuOptionsFlash, 5);
+ flashSlot = question_box(F("Select Mode"), menuOptions, 5, 0);
// wait for user choice to come back from the question box menu
switch (flashSlot) {
case 0:
- display_Clear();
+ setupCFI();
+ flashSize = 8388608;
+ writeCFI_Flash(0);
+ verifyFlash();
+ print_STR(press_button_STR, 0);
display_Update();
- mapping = 1;
+ wait();
+ resetArduino();
+ break;
+
+ case 1:
setup_Flash8();
id_Flash8();
wait();
mode = CORE_FLASH8;
break;
- case 1:
- display_Clear();
- display_Update();
+ case 2:
setup_Eprom();
mode = CORE_EPROM;
break;
- case 2:
- display_Clear();
- display_Update();
+ case 3:
setup_Flash16();
id_Flash16();
wait();
mode = CORE_FLASH16;
break;
- case 3:
+ case 4:
resetArduino();
break;
@@ -95,11 +111,34 @@ void flashMenu() {
void flashMenu() {
display_Clear();
display_Update();
- mapping = 1;
- setup_Flash8();
- id_Flash8();
- wait();
- mode = CORE_FLASH8;
+ mapping = 0;
+
+ // create menu with title and 3 options to choose from
+ unsigned char flashMode;
+ // Copy menuOptions out of progmem
+ convertPgm(menuOptionsMode, 3);
+ flashMode = question_box(F("Select Flash Mode"), menuOptions, 3, 0);
+
+ // wait for user choice to come back from the question box menu
+ switch (flashMode) {
+ case 0:
+ setupCFI();
+ flashSize = 8388608;
+ writeCFI_Flash(0);
+ verifyFlash();
+ print_STR(press_button_STR, 0);
+ display_Update();
+ wait();
+ resetArduino();
+ break;
+
+ case 1:
+ setup_Flash8();
+ id_Flash8();
+ wait();
+ mode = CORE_FLASH8;
+ break;
+ }
}
#endif
@@ -814,15 +853,15 @@ void writeByte_Flash(unsigned long myAddress, byte myData) {
// A0-A7
PORTF = myAddress & 0xFF;
- // standard for flash adapter and SNES HiRom
- if (mapping == 1) {
+ // flash adapter (without SRAM save chip)
+ if (mapping == 0) {
// A8-A15
PORTK = (myAddress >> 8) & 0xFF;
// A16-A23
PORTL = (myAddress >> 16) & 0xFF;
}
- // for SNES LoRom
- else if (mapping == 0) {
+ // SNES LoRom
+ else if (mapping == 1) {
// A8-A14
PORTK = (myAddress >> 8) & 0x7F;
// Set SNES A15(PK7) HIGH to disable SRAM
@@ -830,8 +869,39 @@ void writeByte_Flash(unsigned long myAddress, byte myData) {
// A15-A22
PORTL = (myAddress >> 15) & 0xFF;
}
- // for SNES ExLoRom repro
+ // SNES HiRom
else if (mapping == 2) {
+ // A8-A15
+ PORTK = (myAddress >> 8) & 0xFF;
+ // A16-A23
+ PORTL = (myAddress >> 16) & 0xFF;
+ // Switch SNES BA6(PL6) to HIGH to disable SRAM
+ PORTL |= (1 << 6);
+ }
+ // for SNES LoRom repro with 2x 2MB
+ else if (mapping == 11) {
+ // A8-A14
+ PORTK = (myAddress >> 8) & 0x7F;
+ // Set SNES A15(PK7) HIGH to disable SRAM
+ PORTK |= (1 << 7);
+ // A15-A22
+ PORTL = (myAddress >> 15) & 0xFF;
+ // Flip BA6(PL6) to address second rom chip
+ PORTL ^= (1 << 6);
+ }
+ // for SNES HiRom repro with 2x 2MB
+ else if (mapping == 22) {
+ // A8-A15
+ PORTK = (myAddress >> 8) & 0xFF;
+ // A16-A23
+ PORTL = (myAddress >> 16) & 0xFF;
+ // Flip BA5(PL5) to address second rom chip
+ PORTL ^= (1 << 5);
+ // Switch SNES BA6(PL6) to HIGH to disable SRAM
+ PORTL |= (1 << 6);
+ }
+ // for SNES ExLoRom repro with 2x 4MB
+ else if (mapping == 111) {
// A8-A14
PORTK = (myAddress >> 8) & 0x7F;
// Set SNES A15(PK7) HIGH to disable SRAM
@@ -839,10 +909,10 @@ 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) {
+ else if (mapping == 222) {
// A8-A15
PORTK = (myAddress >> 8) & 0xFF;
// A16-A22
@@ -898,15 +968,15 @@ byte readByte_Flash(unsigned long myAddress) {
// A0-A7
PORTF = myAddress & 0xFF;
- // standard for flash adapter and SNES HiRom
- if (mapping == 1) {
+ // flash adapter (without SRAM save chip)
+ if (mapping == 0) {
// A8-A15
PORTK = (myAddress >> 8) & 0xFF;
// A16-A23
PORTL = (myAddress >> 16) & 0xFF;
}
- // for SNES LoRom
- else if (mapping == 0) {
+ // SNES LoRom
+ else if (mapping == 1) {
// A8-A14
PORTK = (myAddress >> 8) & 0x7F;
// Set SNES A15(PK7) HIGH to disable SRAM
@@ -914,8 +984,39 @@ byte readByte_Flash(unsigned long myAddress) {
// A15-A22
PORTL = (myAddress >> 15) & 0xFF;
}
- // for SNES ExLoRom repro
+ // SNES HiRom
else if (mapping == 2) {
+ // A8-A15
+ PORTK = (myAddress >> 8) & 0xFF;
+ // A16-A23
+ PORTL = (myAddress >> 16) & 0xFF;
+ // Switch SNES BA6(PL6) to HIGH to disable SRAM
+ PORTL |= (1 << 6);
+ }
+ // for SNES LoRom repro with 2x 2MB
+ else if (mapping == 11) {
+ // A8-A14
+ PORTK = (myAddress >> 8) & 0x7F;
+ // Set SNES A15(PK7) HIGH to disable SRAM
+ PORTK |= (1 << 7);
+ // A15-A22
+ PORTL = (myAddress >> 15) & 0xFF;
+ // Flip BA6(PL6) to address second rom chip
+ PORTL ^= (1 << 6);
+ }
+ // for SNES HiRom repro with 2x 2MB
+ else if (mapping == 22) {
+ // A8-A15
+ PORTK = (myAddress >> 8) & 0xFF;
+ // A16-A23
+ PORTL = (myAddress >> 16) & 0xFF;
+ // Flip BA5(PL5) to address second rom chip
+ PORTL ^= (1 << 5);
+ // Switch SNES BA6(PL6) to HIGH to disable SRAM
+ PORTL |= (1 << 6);
+ }
+ // for SNES ExLoRom repro
+ else if (mapping == 111) {
// A8-A14
PORTK = (myAddress >> 8) & 0x7F;
// Set SNES A15(PK7) HIGH to disable SRAM
@@ -923,10 +1024,10 @@ 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) {
+ else if (mapping == 222) {
// A8-A15
PORTK = (myAddress >> 8) & 0xFF;
// A16-A22
@@ -1165,6 +1266,12 @@ void writeFlash29F032() {
// Retry writing, for when /RESET is not connected (floating)
int dq5failcnt = 0;
int noread = 0;
+
+ //Initialize progress bar
+ uint32_t processedProgressBar = 0;
+ uint32_t totalProgressBar = (uint32_t)fileSize;
+ draw_progressbar(0, totalProgressBar);
+
// Fill sdBuffer
for (unsigned long currByte = 0; currByte < fileSize; currByte += 512) {
// if (currByte >= 0) {
@@ -1213,6 +1320,9 @@ void writeFlash29F032() {
} else {
noread = 0;
}
+ // update progress bar
+ processedProgressBar += 512;
+ draw_progressbar(processedProgressBar, totalProgressBar);
}
// Set data pins to input again
dataIn8();
@@ -1283,6 +1393,11 @@ void writeFlash29F1610() {
// Set data pins to output
dataOut();
+ //Initialize progress bar
+ uint32_t processedProgressBar = 0;
+ uint32_t totalProgressBar = (uint32_t)fileSize;
+ draw_progressbar(0, totalProgressBar);
+
for (unsigned long currByte = 0; currByte < fileSize; currByte += 128) {
// Fill sdBuffer with 1 page at a time then write it repeat until all bytes are written
myFile.read(sdBuffer, 128);
@@ -1302,6 +1417,9 @@ void writeFlash29F1610() {
for (byte c = 0; c < 128; c++) {
writeByte_Flash(currByte + c, sdBuffer[c]);
}
+ // update progress bar
+ processedProgressBar += 128;
+ draw_progressbar(processedProgressBar, totalProgressBar);
}
// Check if write is complete
@@ -1321,6 +1439,11 @@ void writeFlash29F1601() {
// Set data pins to output
dataOut();
+ //Initialize progress bar
+ uint32_t processedProgressBar = 0;
+ uint32_t totalProgressBar = (uint32_t)fileSize;
+ draw_progressbar(0, totalProgressBar);
+
for (unsigned long currByte = 0; currByte < fileSize; currByte += 128) {
// Fill sdBuffer with 1 page at a time then write it repeat until all bytes are written
myFile.read(sdBuffer, 128);
@@ -1345,6 +1468,9 @@ void writeFlash29F1601() {
writeByte_Flash(currByte + c, sdBuffer[c]);
}
}
+ // update progress bar
+ processedProgressBar += 128;
+ draw_progressbar(processedProgressBar, totalProgressBar);
}
// Check if write is complete
@@ -1441,6 +1567,11 @@ void writeFlash29LV640() {
// Set data pins to output
dataOut();
+ //Initialize progress bar
+ uint32_t processedProgressBar = 0;
+ uint32_t totalProgressBar = (uint32_t)fileSize;
+ draw_progressbar(0, totalProgressBar);
+
for (unsigned long currByte = 0; currByte < fileSize; currByte += 512) {
// Fill sdBuffer
myFile.read(sdBuffer, 512);
@@ -1457,6 +1588,9 @@ void writeFlash29LV640() {
// Check if write is complete
busyCheck29LV640(currByte + c, sdBuffer[c]);
}
+ // update progress bar
+ processedProgressBar += 512;
+ draw_progressbar(processedProgressBar, totalProgressBar);
}
// Set data pins to input again
dataIn8();
@@ -1473,6 +1607,11 @@ void writeFlash29GL(unsigned long sectorSize, byte bufferSize) {
// Set data pins to output
dataOut();
+ //Initialize progress bar
+ uint32_t processedProgressBar = 0;
+ uint32_t totalProgressBar = (uint32_t)fileSize;
+ draw_progressbar(0, totalProgressBar);
+
for (unsigned long currSector = 0; currSector < fileSize; currSector += sectorSize) {
// Blink led
blinkLED();
@@ -1509,6 +1648,9 @@ void writeFlash29GL(unsigned long sectorSize, byte bufferSize) {
dataOut();
}
}
+ // update progress bar
+ processedProgressBar += sectorSize;
+ draw_progressbar(processedProgressBar, totalProgressBar);
}
// Set data pins to input again
dataIn8();
@@ -1525,6 +1667,11 @@ void writeFlash29F800() {
// Set data pins to output
dataOut();
+ //Initialize progress bar
+ uint32_t processedProgressBar = 0;
+ uint32_t totalProgressBar = (uint32_t)fileSize;
+ draw_progressbar(0, totalProgressBar);
+
// Fill sdBuffer
for (unsigned long currByte = 0; currByte < fileSize; currByte += 512) {
myFile.read(sdBuffer, 512);
@@ -1539,6 +1686,9 @@ void writeFlash29F800() {
writeByte_Flash(currByte + c, sdBuffer[c]);
busyCheck29F032(currByte + c, sdBuffer[c]);
}
+ // update progress bar
+ processedProgressBar += 512;
+ draw_progressbar(processedProgressBar, totalProgressBar);
}
// Set data pins to input again
@@ -1612,6 +1762,11 @@ void writeFlashE28FXXXJ3A() {
uint32_t block_addr;
uint32_t block_addr_mask = ~(sectorSize - 1);
+ //Initialize progress bar
+ uint32_t processedProgressBar = 0;
+ uint32_t totalProgressBar = (uint32_t)fileSize;
+ draw_progressbar(0, totalProgressBar);
+
// Fill sdBuffer
for (uint32_t currByte = 0; currByte < fileSize; currByte += 512) {
myFile.read(sdBuffer, 512);
@@ -1648,6 +1803,9 @@ void writeFlashE28FXXXJ3A() {
while ((readByte_Flash(block_addr) & 0x80) == 0x00)
;
}
+ // update progress bar
+ processedProgressBar += 512;
+ draw_progressbar(processedProgressBar, totalProgressBar);
}
dataIn8();
@@ -1655,6 +1813,11 @@ void writeFlashE28FXXXJ3A() {
void writeFlashLH28F0XX() {
+ //Initialize progress bar
+ uint32_t processedProgressBar = 0;
+ uint32_t totalProgressBar = (uint32_t)fileSize;
+ draw_progressbar(0, totalProgressBar);
+
// Fill sdBuffer
for (uint32_t currByte = 0; currByte < fileSize; currByte += 512) {
myFile.read(sdBuffer, 512);
@@ -1682,6 +1845,9 @@ void writeFlashLH28F0XX() {
while ((readByte_Flash(currByte + c) & 0x80) == 0x00)
;
}
+ // update progress bar
+ processedProgressBar += 512;
+ draw_progressbar(processedProgressBar, totalProgressBar);
}
dataIn8();
@@ -1711,8 +1877,27 @@ void blankcheck_Flash() {
}
void verifyFlash() {
+ verifyFlash(0);
+}
+
+void verifyFlash(byte romChips) {
if (openVerifyFlashFile()) {
blank = 0;
+
+ if (romChips == 1) {
+ myFile.seekCur(0);
+ // Truncate file to size of 1st flash chip
+ if (fileSize > flashSize / 2) {
+ fileSize = flashSize / 2;
+ }
+ } else if (romChips == 2) {
+ if (fileSize > flashSize / 2) {
+ myFile.seekCur(flashSize / 2);
+ fileSize = fileSize - (flashSize / 2);
+ } else
+ fileSize = 0;
+ }
+
for (unsigned long currByte = 0; currByte < fileSize; currByte += 512) {
//fill sdBuffer
myFile.read(sdBuffer, 512);
@@ -2367,7 +2552,7 @@ void print_Eprom(int numBytes) {
#endif
/******************************************
-CFI flashrom functions (copy&paste from GB.ino)
+CFI flashrom functions (modified from GB.ino)
*****************************************/
void sendCFICommand_Flash(byte cmd) {
writeByteCompensated_Flash(0xAAA, 0xaa);
@@ -2453,8 +2638,10 @@ void identifyCFI_Flash() {
flashSwitchLastBits = true;
} else {
println_Msg(F("CFI Query failed!"));
+ print_STR(press_button_STR, 0);
display_Update();
wait();
+ resetArduino();
return;
}
}
@@ -2469,13 +2656,13 @@ void identifyCFI_Flash() {
}
// Write flashrom
-void writeCFI_Flash() {
- filePath[0] = '\0';
- sd.chdir("/");
- fileBrowser(FS(FSTRING_SELECT_FILE));
- display_Clear();
-
- if (openFlashFile()) {
+void writeCFI_Flash(byte romChips) {
+ if (openFileOnSD()) {
+ // Print filepath
+ print_STR(flashing_file_STR, 0);
+ print_Msg(filePath);
+ println_Msg(F("..."));
+ display_Update();
// Reset flash
dataOut();
@@ -2510,7 +2697,30 @@ void writeCFI_Flash() {
statusReg = readByte_Flash(0);
}
- println_Msg(F("Writing flash"));
+ print_Msg(F("Writing flash"));
+ // If we have two ROM chips only write half the ROM file here and skip to second half of file on second write
+ if (romChips == 0) {
+ println_Msg(F(""));
+ }
+
+ else if (romChips == 1) {
+ println_Msg(F(" 1/2"));
+ myFile.seekCur(0);
+ // Truncate file to size of 1st flash chip
+ if (fileSize > flashSize / 2) {
+ fileSize = flashSize / 2;
+ }
+ }
+
+ else if (romChips == 2) {
+ println_Msg(F(" 2/2"));
+ if (fileSize > flashSize / 2) {
+ myFile.seekCur(flashSize / 2);
+ fileSize = fileSize - (flashSize / 2);
+ } else {
+ fileSize = 0;
+ }
+ }
display_Update();
//Initialize progress bar
diff --git a/Cart_Reader/GB.ino b/Cart_Reader/GB.ino
index 626de9a..b9529e5 100644
--- a/Cart_Reader/GB.ino
+++ b/Cart_Reader/GB.ino
@@ -558,10 +558,10 @@ void showCartInfo_GB() {
print_Msg(FS(FSTRING_NAME));
println_Msg(romName);
if (cartID[0] != 0) {
- print_Msg(F("Serial: "));
+ print_Msg(FS(FSTRING_SERIAL));
println_Msg(cartID);
}
- print_Msg(F("Revision: "));
+ print_Msg(FS(FSTRING_REVISION));
println_Msg(romVersion);
print_Msg(FS(FSTRING_MAPPER));
@@ -597,7 +597,7 @@ void showCartInfo_GB() {
print_Msg(F("M161"));
println_Msg(FS(FSTRING_EMPTY));
- print_Msg(F("ROM Size: "));
+ print_Msg(FS(FSTRING_ROM_SIZE));
switch (romSize) {
case 0:
print_Msg(F("32 KB"));
@@ -2486,7 +2486,8 @@ void readPelican_GB() {
if (flashid == 0xDA45 || flashid == 0xBF10) {
println_Msg(F("29EE020 / W29C020"));
println_Msg(F("Banks Used: 32/64"));
- println_Msg(F("Rom Size: 256 KB"));
+ print_Msg(FS(FSTRING_ROM_SIZE));
+ println_Msg(F("256 KB"));
romBanks = 32;
display_Update();
} else {
@@ -2514,7 +2515,8 @@ void readPelican_GB() {
if (flashid == 0xBF04) {
println_Msg(F("SST 28LF040"));
println_Msg(F("Banks Used: 64/64"));
- println_Msg(F("Rom Size: 512 KB"));
+ print_Msg(FS(FSTRING_ROM_SIZE));
+ println_Msg(F("512 KB"));
romBanks = 64;
display_Update();
}
@@ -3185,7 +3187,8 @@ void readGameshark_GB() {
if (flashid == 0xBFB5) {
display_Clear();
println_Msg(F("SST 39SF010"));
- println_Msg(F("Rom Size: 128 KB"));
+ print_Msg(FS(FSTRING_ROM_SIZE));
+ println_Msg(F("128 KB"));
display_Update();
} else {
display_Clear();
diff --git a/Cart_Reader/GBA.ino b/Cart_Reader/GBA.ino
index 94bf9ea..26e9f22 100644
--- a/Cart_Reader/GBA.ino
+++ b/Cart_Reader/GBA.ino
@@ -254,11 +254,11 @@ void setup_GBA() {
// Print start page
print_Msg(FS(FSTRING_NAME));
println_Msg(romName);
- print_Msg(F("Serial: "));
+ print_Msg(FS(FSTRING_SERIAL));
println_Msg(cartID);
- print_Msg(F("Revision: "));
+ print_Msg(FS(FSTRING_REVISION));
println_Msg(romVersion);
- print_Msg(F("ROM Size: "));
+ print_Msg(FS(FSTRING_ROM_SIZE));
if (cartSize == 0)
println_Msg(F("Unknown"));
else {
@@ -681,9 +681,9 @@ void getCartInfo_GBA() {
// Print current database entry
println_Msg(gamename);
- print_Msg(F("Serial: "));
+ print_Msg(FS(FSTRING_SERIAL));
println_Msg(tempStr);
- print_Msg(F("ROM Size: "));
+ print_Msg(FS(FSTRING_ROM_SIZE));
print_Msg(cartSize);
println_Msg(F(" MB"));
print_Msg(F("Save Lib: "));
diff --git a/Cart_Reader/INTV.ino b/Cart_Reader/INTV.ino
index 8c945fe..6580779 100644
--- a/Cart_Reader/INTV.ino
+++ b/Cart_Reader/INTV.ino
@@ -524,7 +524,7 @@ void checkMapperSize_INTV() {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
void printRomSize_INTV(int index) {
display_Clear();
- print_Msg(F("ROM Size: "));
+ print_Msg(FS(FSTRING_ROM_SIZE));
println_Msg(pgm_read_byte(&(INTV[index])));
}
#endif
diff --git a/Cart_Reader/MD.ino b/Cart_Reader/MD.ino
index 3cc3af0..4bed801 100644
--- a/Cart_Reader/MD.ino
+++ b/Cart_Reader/MD.ino
@@ -2888,7 +2888,7 @@ void readRealtec_MD() {
void printRomSize_MD(int index) {
display_Clear();
- print_Msg(F("ROM Size: "));
+ print_Msg(FS(FSTRING_ROM_SIZE));
print_Msg(pgm_read_byte(&(MDSize[index])));
println_Msg(F(" Mbit"));
}
diff --git a/Cart_Reader/MSX.ino b/Cart_Reader/MSX.ino
index 51dbe95..a361c51 100644
--- a/Cart_Reader/MSX.ino
+++ b/Cart_Reader/MSX.ino
@@ -889,7 +889,7 @@ void checkMapperSize_MSX() {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
void printRomSize_MSX(uint8_t index) {
display_Clear();
- print_Msg(F("ROM Size: "));
+ print_Msg(FS(FSTRING_ROM_SIZE));
println_Msg(MSX[index]);
}
#endif
diff --git a/Cart_Reader/N64.ino b/Cart_Reader/N64.ino
index 7031393..775ab7f 100644
--- a/Cart_Reader/N64.ino
+++ b/Cart_Reader/N64.ino
@@ -274,6 +274,10 @@ void n64CartMenu() {
println_Msg(F("Reading SRAM..."));
display_Update();
readSram(32768, 1);
+ } else if (saveType == 2) {
+ println_Msg(F("Reading Sram 768..."));
+ display_Update();
+ readSram(98304, 1);
} else if (saveType == 4) {
getFramType();
println_Msg(F("Reading FLASH..."));
@@ -312,6 +316,22 @@ void n64CartMenu() {
print_STR(_bytes_STR, 1);
print_Error(did_not_verify_STR);
}
+ } else if (saveType == 2) {
+ // Launch file browser
+ fileBrowser(F("Select Sram 768 file"));
+ display_Clear();
+
+ writeSram(98304);
+ writeErrors = verifySram(98304, 1);
+ if (writeErrors == 0) {
+ println_Msg(F("Sram verified OK"));
+ display_Update();
+ } else {
+ print_STR(error_STR, 0);
+ print_Msg(writeErrors);
+ print_STR(_bytes_STR, 1);
+ print_Error(did_not_verify_STR);
+ }
} else if (saveType == 4) {
// Launch file browser
fileBrowser(F("Select fla file"));
@@ -1925,11 +1945,11 @@ void printCartInfo_N64() {
display_Clear();
print_Msg(FS(FSTRING_NAME));
println_Msg(romName);
- print_Msg(F("Serial: "));
+ print_Msg(FS(FSTRING_SERIAL));
println_Msg(cartID);
- print_Msg(F("Revision: "));
+ print_Msg(FS(FSTRING_REVISION));
println_Msg(romVersion);
- print_Msg(F("ROM Size: "));
+ print_Msg(FS(FSTRING_ROM_SIZE));
print_Msg(cartSize);
println_Msg(F(" MB"));
print_Msg(F("Save Type: "));
@@ -1937,6 +1957,9 @@ void printCartInfo_N64() {
case 1:
println_Msg(F("SRAM"));
break;
+ case 2:
+ println_Msg(F("SRAM 768"));
+ break;
case 4:
println_Msg(F("FLASH"));
break;
@@ -1969,7 +1992,7 @@ void printCartInfo_N64() {
println_Msg("");
print_Msg(FS(FSTRING_NAME));
println_Msg(romName);
- print_Msg(F("Serial: "));
+ print_Msg(FS(FSTRING_SERIAL));
println_Msg(cartID);
print_Msg(F("CRC1: "));
println_Msg(checksumStr);
@@ -2346,7 +2369,7 @@ unsigned long verifyEeprom() {
*****************************************/
// Write sram to cartridge
void writeSram(unsigned long sramSize) {
- if (saveType == 1) {
+ if (saveType == 1 || saveType == 2) {
// Create filepath
sprintf(filePath, "%s/%s", filePath, fileName);
println_Msg(F("Writing..."));
@@ -2400,6 +2423,8 @@ void readSram(unsigned long sramSize, byte flashramType) {
suffix = "fla";
} else if (saveType == 1) {
suffix = "sra";
+ } else if (saveType == 2) {
+ suffix = "768";
} else {
print_FatalError(F("Savetype Error"));
}
@@ -4079,10 +4104,10 @@ void flashGameshark_N64() {
}
void unlockGSAddressRanges() {
- // This enables using the 0x1EEx_xxxx, 0x1EFx_xxxx, and 0x1ECx_xxxx address ranges, necessary for writing to all supported chips
- setAddress_N64(0x10400400);
- writeWord_N64(0x1E);
- writeWord_N64(0x1E);
+ // This enables using the 0x1EEx_xxxx, 0x1EFx_xxxx, and 0x1ECx_xxxx address ranges, necessary for writing to all supported chips
+ setAddress_N64(0x10400400);
+ writeWord_N64(0x1E);
+ writeWord_N64(0x1E);
}
//Test for SST 29LE010 or SST 28LF040 (0404) or AMTEL AT29LV010A (3535) or SST 29EE010 (0707)
@@ -4195,25 +4220,25 @@ void eraseGameshark_N64() {
}
void blankCheck_N64() {
- // Blankcheck
- println_Msg(F("Blankcheck..."));
- display_Update();
+ // Blankcheck
+ println_Msg(F("Blankcheck..."));
+ display_Update();
- for (unsigned long currSector = 0; currSector < flashSize; currSector += 131072) {
- // Blink led
- blinkLED();
- for (unsigned long currSdBuffer = 0; currSdBuffer < 131072; currSdBuffer += 512) {
- for (int currByte = 0; currByte < 512; currByte += 2) {
- // Read flash
- setAddress_N64(romBase + 0xEC00000 + currSector + currSdBuffer + currByte);
- // Compare both
- if (readWord_N64() != 0xFFFF) {
- println_Msg(F("Not empty"));
- print_FatalError(F("Erase failed"));
- }
+ for (unsigned long currSector = 0; currSector < flashSize; currSector += 131072) {
+ // Blink led
+ blinkLED();
+ for (unsigned long currSdBuffer = 0; currSdBuffer < 131072; currSdBuffer += 512) {
+ for (int currByte = 0; currByte < 512; currByte += 2) {
+ // Read flash
+ setAddress_N64(romBase + 0xEC00000 + currSector + currSdBuffer + currByte);
+ // Compare both
+ if (readWord_N64() != 0xFFFF) {
+ println_Msg(F("Not empty"));
+ print_FatalError(F("Erase failed"));
}
}
}
+ }
}
void writeGameshark_N64() {
@@ -4266,17 +4291,17 @@ void writeGameshark_N64() {
// Set address
setAddress_N64(romBase + 0xEC00000 + currSector + currSdBuffer + currByte);
-
+
// Join two bytes into one word
word currWord = ((sdBuffer[currByte] & 0xFF) << 8) | (sdBuffer[currByte + 1] & 0xFF);
-
+
// Send byte data
writeWord_N64(currWord);
delayMicroseconds(60);
}
- processedProgressBar += 256;
- draw_progressbar(processedProgressBar, totalProgressBar);
- blinkLED();
+ processedProgressBar += 256;
+ draw_progressbar(processedProgressBar, totalProgressBar);
+ blinkLED();
}
}
@@ -4412,7 +4437,8 @@ void flashXplorer_N64() {
println_Msg(FS(FSTRING_EMPTY));
println_Msg(F("Turn Cart Reader off now"));
display_Update();
- while (1);
+ while (1)
+ ;
} else {
display_Clear();
display_Update();
@@ -4448,25 +4474,25 @@ void idXplorer_N64() {
readWord_N64();
if (flashid != 0x0808) {
- println_Msg(F("Check cart connection"));
- println_Msg(F("Unknown Flash ID"));
- sprintf(flashid_str, "%04X", flashid);
- print_STR(press_button_STR, 1);
- display_Update();
- wait();
- mainMenu();
- }
+ println_Msg(F("Check cart connection"));
+ println_Msg(F("Unknown Flash ID"));
+ sprintf(flashid_str, "%04X", flashid);
+ print_STR(press_button_STR, 1);
+ display_Update();
+ wait();
+ mainMenu();
+ }
sprintf(flashid_str, "%04X", flashid);
// Reset flashrom
resetXplorer_N64();
}
void resetXplorer_N64() {
- // Send reset command for SST 29LE010
- sendFlashromXplorerCommand_N64(0xF0F0);
- delay(100);
+ // Send reset command for SST 29LE010
+ sendFlashromXplorerCommand_N64(0xF0F0);
+ delay(100);
}
-
+
// Read rom and save to the SD card
void backupXplorer_N64() {
// create a new folder
@@ -4498,26 +4524,16 @@ void backupXplorer_N64() {
}
unsigned long unscramble(unsigned long addr) {
- unsigned long result = (((addr >> 4) & 0x001) | ((addr >> 8) & 0x002) |
- ((~addr >> 9) & 0x004) | ((addr >> 3) & 0x008) |
- ((addr >> 6) & 0x010) | ((addr >> 2) & 0x020) |
- ((~addr << 5) & 0x0C0) | ((~addr << 8) & 0x100) |
- ((~addr << 6) & 0x200) | ((~addr << 2) & 0x400) |
- ((addr << 6) & 0x800) | (addr & 0x1F000));
-
- return result;
+ unsigned long result = (((addr >> 4) & 0x001) | ((addr >> 8) & 0x002) | ((~addr >> 9) & 0x004) | ((addr >> 3) & 0x008) | ((addr >> 6) & 0x010) | ((addr >> 2) & 0x020) | ((~addr << 5) & 0x0C0) | ((~addr << 8) & 0x100) | ((~addr << 6) & 0x200) | ((~addr << 2) & 0x400) | ((addr << 6) & 0x800) | (addr & 0x1F000));
+
+ return result;
}
unsigned long scramble(unsigned long addr) {
- unsigned long result = (((~addr >> 8) & 0x001) | ((~addr >> 5) & 0x006) |
- ((~addr >> 6) & 0x008) | ((addr << 4) & 0x010) |
- ((addr >> 6) & 0x020) | ((addr << 3) & 0x040) |
- ((addr << 2) & 0x080) | ((~addr >> 2) & 0x100) |
- ((addr << 8) & 0x200) | ((addr << 6) & 0x400) |
- ((~addr << 9) & 0x800) | (addr & 0x1F000));
-
- return result;
+ unsigned long result = (((~addr >> 8) & 0x001) | ((~addr >> 5) & 0x006) | ((~addr >> 6) & 0x008) | ((addr << 4) & 0x010) | ((addr >> 6) & 0x020) | ((addr << 3) & 0x040) | ((addr << 2) & 0x080) | ((~addr >> 2) & 0x100) | ((addr << 8) & 0x200) | ((addr << 6) & 0x400) | ((~addr << 9) & 0x800) | (addr & 0x1F000));
+
+ return result;
}
@@ -4532,7 +4548,6 @@ void oddXPaddrWrite(unsigned long addr, word data) {
setAddress_N64(0x10740000);
readWord_N64();
readWord_N64();
-
}
void evenXPaddrWrite(unsigned long addr, word data) {
@@ -4592,7 +4607,7 @@ void writeXplorer_N64() {
// Fill SD buffer with data in the order it will be expected by the CPLD
for (unsigned long i = 0; i < 256; i += 2) {
- unsigned long unscrambled_address = (unscramble(((currPage*2) + i) / 2) * 2);
+ unsigned long unscrambled_address = (unscramble(((currPage * 2) + i) / 2) * 2);
myFile.seek(unscrambled_address);
myFile.read(&sdBuffer[i], 1);
myFile.seek(unscrambled_address + 1);
@@ -4607,10 +4622,10 @@ void writeXplorer_N64() {
// Join two bytes into one word
word currWord = ((sdBuffer[currByte] & 0xFF) << 8) | (sdBuffer[currByte + 1] & 0xFF);
// Set address
- if ((((currByte/2) >> 4) & 0x1) == 0) {
- evenXPaddrWrite(0x10400000 + (currPage*2) + currByte, currWord);
+ if ((((currByte / 2) >> 4) & 0x1) == 0) {
+ evenXPaddrWrite(0x10400000 + (currPage * 2) + currByte, currWord);
} else {
- oddXPaddrWrite(0x10400000 + (currPage*2) + currByte, currWord);
+ oddXPaddrWrite(0x10400000 + (currPage * 2) + currByte, currWord);
}
}
processedProgressBar += 256;
diff --git a/Cart_Reader/NGP.ino b/Cart_Reader/NGP.ino
index 0771832..52ae22c 100644
--- a/Cart_Reader/NGP.ino
+++ b/Cart_Reader/NGP.ino
@@ -188,7 +188,7 @@ void printCartInfo_NGP() {
else
println_Msg(F("Unknown"));
- print_Msg(F("ROM Size: "));
+ print_Msg(FS(FSTRING_ROM_SIZE));
if (cartSize == 0) {
println_Msg(F("Unknown"));
} else {
diff --git a/Cart_Reader/ODY2.ino b/Cart_Reader/ODY2.ino
index aca0464..26cd1b1 100644
--- a/Cart_Reader/ODY2.ino
+++ b/Cart_Reader/ODY2.ino
@@ -257,7 +257,7 @@ void readROM_ODY2() {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
void printRomSize_ODY2(int index) {
display_Clear();
- print_Msg(F("ROM Size: "));
+ print_Msg(FS(FSTRING_ROM_SIZE));
println_Msg(ODY2[index]);
}
#endif
diff --git a/Cart_Reader/OSCR.cpp b/Cart_Reader/OSCR.cpp
index 1612c61..81963c5 100644
--- a/Cart_Reader/OSCR.cpp
+++ b/Cart_Reader/OSCR.cpp
@@ -49,7 +49,7 @@
* String Constants
**/
// Firmware Version
-constexpr char PROGMEM FSTRING_VERSION[] = "V13.2";
+constexpr char PROGMEM FSTRING_VERSION[] = "V13.5";
// Universal
constexpr char PROGMEM FSTRING_RESET[] = "Reset";
@@ -77,7 +77,9 @@ constexpr char PROGMEM FSTRING_MAPPER[] = "Mapper: ";
constexpr char PROGMEM FSTRING_SIZE[] = "Size: ";
constexpr char PROGMEM FSTRING_NAME[] = "Name: ";
constexpr char PROGMEM FSTRING_CHECKSUM[] = "Checksum: ";
-constexpr char PROGMEM FSTRING_ROM_SIZE[] ="ROM SIZE: ";
+constexpr char PROGMEM FSTRING_ROM_SIZE[] = "ROM Size: ";
+constexpr char PROGMEM FSTRING_REVISION[] = "Revision: ";
+constexpr char PROGMEM FSTRING_SERIAL[] = "Serial: ";
/*==== /CONSTANTS =================================================*/
diff --git a/Cart_Reader/OSCR.h b/Cart_Reader/OSCR.h
index 3cdeee1..2546352 100644
--- a/Cart_Reader/OSCR.h
+++ b/Cart_Reader/OSCR.h
@@ -102,6 +102,8 @@ extern const char PROGMEM FSTRING_SIZE[];
extern const char PROGMEM FSTRING_ROM_SIZE[];
extern const char PROGMEM FSTRING_NAME[];
extern const char PROGMEM FSTRING_CHECKSUM[];
+extern const char PROGMEM FSTRING_REVISION[];
+extern const char PROGMEM FSTRING_SERIAL[];
#define FS(pmem_string) (reinterpret_cast<const __FlashStringHelper *>(pmem_string))
diff --git a/Cart_Reader/PCE.ino b/Cart_Reader/PCE.ino
index 7e9aaff..a14f3dc 100644
--- a/Cart_Reader/PCE.ino
+++ b/Cart_Reader/PCE.ino
@@ -2,12 +2,14 @@
// PC Engine & TurboGrafx dump code by tamanegi_taro
// April 18th 2018 Revision 1.0.1 Initial version
// August 12th 2019 Revision 1.0.2 Added Tennokoe Bank support
+// June 29th 2024 Revision 1.0.3 Added repro HuCard flashing
//
// Special thanks
// sanni - Arduino cart reader
// skaman - ROM size detection
// NO-INTRO - CRC list for game name detection
// Chris Covell - Tennokoe bank support
+// partlyhuman - repro HuCard support
//
//******************************************
#ifdef ENABLE_PCE
@@ -15,14 +17,15 @@
/******************************************
Defines
*****************************************/
-#define HUCARD 0
-#define TURBOCHIP 1
-#define HUCARD_NOSWAP 2
#define DETECTION_SIZE 64
#define FORCED_SIZE 1024
#define CHKSUM_SKIP 0
#define CHKSUM_OK 1
#define CHKSUM_ERROR 2
+enum PCE_MODE_T : uint8_t { HUCARD,
+ TURBOCHIP,
+ HUCARD_NOSWAP,
+ PCE_FLASH };
/******************************************
Prototype Declarations
@@ -53,7 +56,8 @@ uint8_t tennokoe_bank_index = 0;
static const char pceMenuItem1[] PROGMEM = "HuCARD (swapped)";
static const char pceMenuItem2[] PROGMEM = "HuCARD(not swapped)";
static const char pceMenuItem3[] PROGMEM = "Turbochip";
-static const char *const menuOptionspce[] PROGMEM = { pceMenuItem1, pceMenuItem2, pceMenuItem3, FSTRING_RESET };
+static const char pceMenuItem4[] PROGMEM = "HuCARD Flash Repro";
+static const char *const menuOptionspce[] PROGMEM = { pceMenuItem1, pceMenuItem2, pceMenuItem3, pceMenuItem4, FSTRING_RESET };
// PCE card menu items
static const char menuOptionspceCart_1[] PROGMEM = "Read RAM Bank %d";
@@ -66,15 +70,18 @@ static const char menuOptionspceCart_5_fmt[] PROGMEM = "ROM size now %dK";
// Turbochip menu items
static const char *const menuOptionspceTC[] PROGMEM = { FSTRING_READ_ROM, FSTRING_RESET };
-// PCE start menu
+#ifdef ENABLE_FLASH
+// Flash repro menu items
+// static const char menuOptionspceFlash1[] PROGMEM = "Program";
+static const char *const menuOptionspceFlash[] PROGMEM = { flashMenuItemWrite, FSTRING_RESET };
+#endif
+
+// PCE start menu, first a device type is selected and set in pce_internal_mode
void pcsMenu(void) {
- // create menu with title and 3 options to choose from
unsigned char pceDev;
- // Copy menuOptions out of progmem
- convertPgm(menuOptionspce, 3);
- pceDev = question_box(F("Select device"), menuOptions, 3, 0);
+ convertPgm(menuOptionspce, 4);
+ pceDev = question_box(F("Select device"), menuOptions, 4, 0);
- // wait for user choice to come back from the question box menu
switch (pceDev) {
case 0:
//Hucard
@@ -103,9 +110,23 @@ void pcsMenu(void) {
mode = CORE_PCE;
break;
+#ifdef ENABLE_FLASH
case 3:
+ //Flash Repro
+ display_Clear();
+ display_Update();
+ pce_internal_mode = PCE_FLASH;
+ setup_cart_PCE();
+ mode = CORE_PCE;
+ break;
+#endif
+
+ case 4:
resetArduino();
break;
+
+ default:
+ print_MissingModule(); // does not return
}
}
@@ -228,7 +249,7 @@ uint8_t read_byte_PCE(uint32_t address) {
ret = PINC;
//Swap bit order for PC Engine HuCARD
- if (pce_internal_mode == HUCARD) {
+ if (pce_internal_mode == HUCARD || pce_internal_mode == PCE_FLASH) {
ret = ((ret & 0x01) << 7) | ((ret & 0x02) << 5) | ((ret & 0x04) << 3) | ((ret & 0x08) << 1) | ((ret & 0x10) >> 1) | ((ret & 0x20) >> 3) | ((ret & 0x40) >> 5) | ((ret & 0x80) >> 7);
}
@@ -273,7 +294,7 @@ void write_byte_PCE(uint32_t address, uint8_t data) {
"nop\n\t");
//Swap bit order for PC Engine HuCARD
- if (pce_internal_mode == HUCARD) {
+ if (pce_internal_mode == HUCARD || pce_internal_mode == PCE_FLASH) {
data = ((data & 0x01) << 7) | ((data & 0x02) << 5) | ((data & 0x04) << 3) | ((data & 0x08) << 1) | ((data & 0x10) >> 1) | ((data & 0x20) >> 3) | ((data & 0x40) >> 5) | ((data & 0x80) >> 7);
}
@@ -803,10 +824,161 @@ void read_rom_PCE(void) {
crc_search(fileName, folder, rom_size, crc);
println_Msg(FS(FSTRING_EMPTY));
- print_STR(press_button_STR, 1);
+ print_STR(press_button_STR, true);
+ display_Update();
+ wait();
+}
+
+#ifdef ENABLE_FLASH
+void flash_mode_PCE() {
+ pin_read_write_PCE();
+ data_output_PCE();
+ PORTH |= (1 << 3); // RD HIGH
+ // write_byte_PCE sets WR
+}
+
+// Implements data complement status checking
+// We only look at D7, or the highest bit of expected
+void flash_wait_status_PCE(uint8_t expected) {
+ set_cs_rd_low_PCE();
+ data_input_PCE();
+
+ uint8_t status;
+ do {
+ PORTH &= ~(1 << 3); // RD low
+ // one nop = 62.5ns
+ // tOE = 30-50ns depending on flash
+ NOP;
+ status = PINC;
+ PORTH |= (1 << 3); // RD high
+ // reversed, bit 0 is the MSB
+ } while ((status & 0x1) != (expected >> 7));
+
+ data_output_PCE();
+ // leave RD high on exit
+}
+
+// Flashes a reproduction HuCard that's directly wired to a flash chip
+// Supported flash: SST39SF0x0, MX29F0x0 1Mbit-8Mbit
+// Developed against Ichigobankai's design https://github.com/partlyhuman/HuCARD-repro
+void flash_PCE() {
+ println_Msg(F("Detecting..."));
+ display_Update();
+
+ // SOFTWARE ID PROGRAM
+ flash_mode_PCE();
+ write_byte_PCE(0x5555, 0xAA);
+ write_byte_PCE(0x2AAA, 0x55);
+ write_byte_PCE(0x5555, 0x90);
+ data_input_PCE();
+ // tIDA = 150ns
+ NOP;NOP;NOP;
+ // MFG,DEVICE
+ uint16_t deviceId = (read_byte_PCE(0x0) << 8) | read_byte_PCE(0x1);
+
+ // EXIT SOFTWARE ID PROGRAM
+ flash_mode_PCE();
+ write_byte_PCE(0x5555, 0xAA);
+ write_byte_PCE(0x2AAA, 0x55);
+ write_byte_PCE(0x5555, 0xF0);
+
+ flashSize = 0;
+ switch (deviceId) {
+ case 0xBFB5:
+ // SST39SF010 = 1Mbit
+ flashSize = 131072UL;
+ break;
+ case 0xBFB6:
+ // SST39SF020 = 2Mbit
+ flashSize = 262144UL;
+ break;
+ case 0xBFB7:
+ // SST39SF040 = 4Mbit
+ flashSize = 524288UL;
+ break;
+ case 0xC2A4:
+ // MX29F040 = 4Mbit
+ flashSize = 524288UL;
+ break;
+ case 0xC2D5:
+ // MX29F080 = 8Mbit
+ flashSize = 1048576UL;
+ break;
+ }
+
+ if (flashSize <= 0) {
+ print_Msg(F("UNKNOWN "));
+ println_Msg(deviceId);
+ display_Update();
+ wait();
+ resetArduino();
+ return;
+ } else {
+ print_Msg(FS(FSTRING_SIZE));
+ print_Msg(flashSize / 131072UL);
+ println_Msg(F("Mbit"));
+ display_Update();
+ wait();
+ }
+
+ filePath[0] = '\0';
+ sd.chdir("/");
+ fileBrowser(FS(FSTRING_SELECT_FILE));
+ display_Clear();
+
+ if (openFlashFile()) {
+
+ println_Msg(F("Erasing..."));
+ display_Update();
+
+ // CHIP ERASE PROGRAM
+ flash_mode_PCE();
+ write_byte_PCE(0x5555, 0xAA);
+ write_byte_PCE(0x2AAA, 0x55);
+ write_byte_PCE(0x5555, 0x80);
+ write_byte_PCE(0x5555, 0xAA);
+ write_byte_PCE(0x2AAA, 0x55);
+ write_byte_PCE(0x5555, 0x10);
+ // Data complement polling, wait until highest bit is 1
+ flash_wait_status_PCE(0xFF);
+
+ print_STR(flashing_file_STR, true);
+ display_Update();
+ uint32_t processedProgressBar = 0;
+ uint32_t totalProgressBar = (uint32_t)fileSize;
+ draw_progressbar(0, totalProgressBar);
+
+ flash_mode_PCE();
+ const size_t BUFSIZE = 512;
+ for (unsigned long currAddr = 0; currAddr < fileSize; currAddr += BUFSIZE) {
+ myFile.read(sdBuffer, BUFSIZE);
+
+ if (currAddr % 4096 == 0) {
+ blinkLED();
+ }
+
+ for (int currByte = 0; currByte < BUFSIZE; currByte++) {
+ // BYTE PROGRAM
+ byte b = sdBuffer[currByte];
+ write_byte_PCE(0x5555, 0xAA);
+ write_byte_PCE(0x2AAA, 0x55);
+ write_byte_PCE(0x5555, 0xA0);
+ write_byte_PCE(currAddr + currByte, b);
+ flash_wait_status_PCE(b);
+ }
+
+ // update progress bar
+ processedProgressBar += BUFSIZE;
+ draw_progressbar(processedProgressBar, totalProgressBar);
+ }
+ myFile.close();
+ pin_init_PCE();
+ print_STR(done_STR, true);
+ }
display_Update();
wait();
}
+#endif
// PC Engine Menu
void pceMenu() {
@@ -861,7 +1033,7 @@ void pceMenu() {
resetArduino();
break;
}
- } else {
+ } else if (pce_internal_mode == TURBOCHIP) {
// Copy menuOptions out of progmem
convertPgm(menuOptionspceTC, 2);
mainMenu = question_box(F("TG TurboChip menu"), menuOptions, 2, 0);
@@ -877,6 +1049,26 @@ void pceMenu() {
break;
}
}
+#ifdef ENABLE_FLASH
+ else if (pce_internal_mode == PCE_FLASH) {
+ const int max = 2;
+ convertPgm(menuOptionspceFlash, max);
+ mainMenu = question_box(F("Flash Repro menu"), menuOptions, max, 0);
+
+ switch (mainMenu) {
+ case 0:
+ flash_PCE();
+ break;
+
+ case 1:
+ resetArduino();
+ break;
+ }
+ }
+#endif
+ else {
+ print_MissingModule(); // does not return
+ }
}
#endif
diff --git a/Cart_Reader/PCW.ino b/Cart_Reader/PCW.ino
index ddcc370..f7f8329 100644
--- a/Cart_Reader/PCW.ino
+++ b/Cart_Reader/PCW.ino
@@ -101,7 +101,8 @@ byte bank1;
// SETUP
//******************************************
-void setup_PCW() {
+void setup_PCW()
+{
// Request 5V
setVoltage(VOLTS_SET_5V);
@@ -138,7 +139,8 @@ void setup_PCW() {
//******************************************
static const char* const menuOptionsPCW[] PROGMEM = { FSTRING_READ_ROM, FSTRING_READ_SAVE, FSTRING_WRITE_SAVE, FSTRING_RESET };
-void pcwMenu() {
+void pcwMenu()
+{
convertPgm(menuOptionsPCW, 4);
uint8_t mainMenu = question_box(F(" POCKET CHALLENGE W"), menuOptions, 4, 0);
@@ -201,7 +203,8 @@ void pcwMenu() {
// Max ROM Size 0x400000 (Highest Address = 0x3FFFFF) - 3F FFFF
// NAND 1A + 1B HIGH = LOW = ROM Output Enabled
-void read_setup_PCW() {
+void read_setup_PCW()
+{
NAND_1A_HIGH;
NAND_1B_HIGH;
OE_HIGH;
@@ -211,7 +214,8 @@ void read_setup_PCW() {
// READ ROM BYTE WITH ADDITIONAL DELAY
// NEEDED FOR PROBLEM CARTS TO SWITCH FROM ADDRESS TO DATA
-unsigned char read_rom_byte_PCW(unsigned long address) {
+unsigned char read_rom_byte_PCW(unsigned long address)
+{
PORTL = (address >> 16) & 0xFF;
PORTK = (address >> 8) & 0xFF;
// Latch Address on AD0-AD7
@@ -233,7 +237,8 @@ unsigned char read_rom_byte_PCW(unsigned long address) {
// SRAM Size 0x8000 (Highest Address = 0x7FFF)
// NAND 1A LOW = SRAM Enabled [ROM DISABLED]
-unsigned char read_ram_byte_1A_PCW(unsigned long address) {
+unsigned char read_ram_byte_1A_PCW(unsigned long address)
+{
NAND_1A_LOW;
PORTL = (address >> 16) & 0xFF;
PORTK = (address >> 8) & 0xFF;
@@ -278,7 +283,8 @@ unsigned char read_ram_byte_1A_PCW(unsigned long address) {
// TEST CODE TO READ THE CPU BUILT-IN RAM + I/O
// NAND 1B LOW = Built-In RAM + I/O Enabled [ROM DISABLED]
-unsigned char read_ram_byte_1B_PCW(unsigned long address) {
+unsigned char read_ram_byte_1B_PCW(unsigned long address)
+{
NAND_1B_LOW;
PORTL = (address >> 16) & 0xFF;
PORTK = (address >> 8) & 0xFF;
@@ -316,7 +322,8 @@ unsigned char read_ram_byte_1B_PCW(unsigned long address) {
}
// WRITE SRAM 32K
-void write_ram_byte_1A_PCW(unsigned long address, unsigned char data) {
+void write_ram_byte_1A_PCW(unsigned long address, unsigned char data)
+{
NAND_1A_LOW;
PORTL = (address >> 16) & 0xFF;
PORTK = (address >> 8) & 0xFF;
@@ -338,7 +345,8 @@ void write_ram_byte_1A_PCW(unsigned long address, unsigned char data) {
// WRITE CPU BUILT-IN RAM + I/O AREA
// MODIFIED TO MATCH WORKING BANK SWITCH ROUTINE
-void write_ram_byte_1B_PCW(unsigned long address, unsigned char data) {
+void write_ram_byte_1B_PCW(unsigned long address, unsigned char data)
+{
NAND_1A_LOW;
NAND_1A_HIGH;
NAND_1B_LOW;
@@ -370,7 +378,8 @@ void write_ram_byte_1B_PCW(unsigned long address, unsigned char data) {
// SINGLE-PACK FUNCTIONS
//******************************************
-uint32_t detect_rom_size_PCW(void) {
+uint32_t detect_rom_size_PCW(void)
+{
uint8_t read_byte;
uint8_t current_byte;
uint8_t detect_1m, detect_2m;
@@ -412,7 +421,8 @@ uint32_t detect_rom_size_PCW(void) {
return rom_size;
}
-void readSingleROM_PCW() {
+void readSingleROM_PCW()
+{
// Setup read mode
read_setup_PCW();
@@ -470,7 +480,7 @@ void readSingleROM_PCW() {
// 1BF400 [PZ]
// 8BD400 [CR]
// 8BF400 [LP]
-// 9BF400 [SLP] (Undumped)
+// 9BF400 [SLP]
// Per Overload, identify multi-pack cart by reading 0x3FFA-0x3FFE. Multi-Pack carts are non-zero.
// 0x3FFA - Current Cartridge Bank
@@ -486,7 +496,8 @@ void readSingleROM_PCW() {
// Write 0x20 to 0xFFFF to read 1st half of ROM
// Write 0x31 to 0xFFFF to read 2nd half of ROM
-void check_multi_PCW() {
+void check_multi_PCW()
+{
// init variables
read_setup_PCW();
multipack = 0;
@@ -515,7 +526,8 @@ void check_multi_PCW() {
}
}
-void write_bank_byte_PCW(unsigned char data) {
+void write_bank_byte_PCW(unsigned char data)
+{
NAND_1A_LOW;
NAND_1A_HIGH;
NAND_1B_LOW;
@@ -538,7 +550,8 @@ void write_bank_byte_PCW(unsigned char data) {
NAND_1B_HIGH;
}
-void switchBank_PCW(int bank) {
+void switchBank_PCW(int bank)
+{
if (bank == 1) { // Upper Half
write_bank_byte_PCW(bank1);
} else { // Lower Half (default)
@@ -546,7 +559,8 @@ void switchBank_PCW(int bank) {
}
}
-void readMultiROM_PCW() {
+void readMultiROM_PCW()
+{
print_Msg(F("READING "));
print_Msg(rom_size / 1024 / 1024);
print_Msg("MB MULTI-PACK");
@@ -610,7 +624,8 @@ void readMultiROM_PCW() {
// SRAM FUNCTIONS
//******************************************
-void readSRAM_PCW() { // readSRAM_1A()
+void readSRAM_PCW()
+{ // readSRAM_1A()
createFolder("PCW", "SAVE", romName, "srm");
foldern = foldern + 1;
@@ -637,7 +652,8 @@ void readSRAM_PCW() { // readSRAM_1A()
}
// SRAM
-void writeSRAM_PCW() {
+void writeSRAM_PCW()
+{
sprintf(filePath, "%s/%s", filePath, fileName);
println_Msg(F("Writing..."));
println_Msg(filePath);
@@ -672,7 +688,8 @@ void writeSRAM_PCW() {
display_Clear();
}
-unsigned long verifySRAM_PCW() {
+unsigned long verifySRAM_PCW()
+{
writeErrors = 0;
if (myFile.open(filePath, O_READ)) {
diff --git a/Cart_Reader/SFM.ino b/Cart_Reader/SFM.ino
index 276c51a..1b62bdb 100644
--- a/Cart_Reader/SFM.ino
+++ b/Cart_Reader/SFM.ino
@@ -58,14 +58,19 @@ void sfmMenu() {
case 0:
sfmGameMenu();
break;
+#ifdef ENABLE_FLASH
// Flash menu
case 1:
mode = CORE_SFM_FLASH;
break;
+#endif
// Reset
case 2:
resetArduino();
break;
+ default:
+ print_MissingModule();
+ break;
}
}
diff --git a/Cart_Reader/SNES.ino b/Cart_Reader/SNES.ino
index f7bdce2..1d5428c 100644
--- a/Cart_Reader/SNES.ino
+++ b/Cart_Reader/SNES.ino
@@ -23,7 +23,6 @@ byte romSizeExp = 0; // ROM-Size Exponent
boolean NP = false;
byte cx4Type = 0;
byte cx4Map = 0;
-boolean altconf = 0;
/******************************************
Menu
@@ -63,6 +62,89 @@ static const char reproMenuItem5[] PROGMEM = "ExLoROM (P1)";
static const char reproMenuItem6[] PROGMEM = "ExHiROM (P1)";
static const char* const menuOptionsRepro[] PROGMEM = { reproMenuItem1, reproMenuItem2, reproMenuItem3, reproMenuItem4, reproMenuItem5, reproMenuItem6, FSTRING_RESET };
+// CFI ROM config
+static const char reproCFIItem1[] PROGMEM = "1x 2MB";
+static const char reproCFIItem2[] PROGMEM = "2x 2MB";
+static const char reproCFIItem3[] PROGMEM = "1x 4MB";
+static const char* const menuOptionsReproCFI[] PROGMEM = { reproCFIItem1, reproCFIItem2, reproCFIItem3, FSTRING_RESET };
+
+void setupCFI() {
+#ifdef ENABLE_FLASH
+ display_Clear();
+ display_Update();
+ filePath[0] = '\0';
+ sd.chdir("/");
+ fileBrowser(F("Select file"));
+ display_Clear();
+ setup_Flash8();
+ identifyCFI_Flash();
+ sprintf(filePath, "%s/%s", filePath, fileName);
+ display_Clear();
+#endif
+}
+
+// Setup number of flashroms
+void reproCFIMenu() {
+ // create menu with title and 4 options to choose from
+ unsigned char snsReproCFI;
+ // Copy menuOptions out of progmem
+ convertPgm(menuOptionsReproCFI, 4);
+ snsReproCFI = question_box(F("Select Flash Config"), menuOptions, 4, 0);
+
+ // wait for user choice to come back from the question box menu
+ switch (snsReproCFI) {
+#ifdef ENABLE_FLASH
+ case 0:
+ setupCFI();
+ flashSize = 2097152;
+ writeCFI_Flash(0);
+ verifyFlash();
+ break;
+
+ case 1:
+ setupCFI();
+ flashSize = 4194304;
+ // Write first rom chip
+ writeCFI_Flash(1);
+ verifyFlash(1);
+ delay(300);
+
+ // Switch to second ROM chip, see flash.ino low level functions line 811
+ // LoROM
+ if (mapping == 1)
+ mapping = 11;
+ // HiROM
+ else if (mapping == 2)
+ mapping = 22;
+
+ // Write second rom chip
+ display_Clear();
+ writeCFI_Flash(2);
+ verifyFlash(2);
+ break;
+
+ case 2:
+ setupCFI();
+ flashSize = 4194304;
+ writeCFI_Flash(0);
+ verifyFlash();
+ break;
+#endif
+
+ case 3:
+ resetArduino();
+ break;
+ }
+
+#ifdef ENABLE_FLASH
+ // Prints string out of the common strings array either with or without newline
+ print_STR(press_button_STR, 0);
+ display_Update();
+ wait();
+ resetArduino();
+#endif
+}
+
// SNES repro menu
void reproMenu() {
// create menu with title and 7 options to choose from
@@ -76,43 +158,21 @@ void reproMenu() {
#ifdef ENABLE_FLASH
case 0:
// CFI LoROM
- display_Clear();
- display_Update();
- mapping = 0;
- flashSize = 4194304;
- setup_Flash8();
- identifyCFI_Flash();
- writeCFI_Flash();
- verifyFlash();
- // Prints string out of the common strings array either with or without newline
- print_STR(press_button_STR, 0);
- display_Update();
- wait();
- resetArduino();
+ mapping = 1;
+ reproCFIMenu();
break;
case 1:
// CFI HiROM
- display_Clear();
- display_Update();
- mapping = 1;
- flashSize = 4194304;
- setup_Flash8();
- identifyCFI_Flash();
- writeCFI_Flash();
- verifyFlash();
- // Prints string out of the common strings array either with or without newline
- print_STR(press_button_STR, 0);
- display_Update();
- wait();
- resetArduino();
+ mapping = 2;
+ reproCFIMenu();
break;
case 2:
// LoRom
display_Clear();
display_Update();
- mapping = 0;
+ mapping = 1;
setup_Flash8();
id_Flash8();
wait();
@@ -123,7 +183,7 @@ void reproMenu() {
// HiRom
display_Clear();
display_Update();
- mapping = 1;
+ mapping = 2;
setup_Flash8();
id_Flash8();
wait();
@@ -134,7 +194,7 @@ void reproMenu() {
// ExLoRom
display_Clear();
display_Update();
- mapping = 2;
+ mapping = 111;
setup_Flash8();
id_Flash8();
wait();
@@ -145,7 +205,7 @@ void reproMenu() {
// ExHiRom
display_Clear();
display_Update();
- mapping = 3;
+ mapping = 222;
setup_Flash8();
id_Flash8();
wait();
@@ -323,8 +383,8 @@ void snesMenu() {
// Change working dir to root
sd.chdir("/");
readSRAM();
- eraseSRAM(0x00);
- eraseSRAM(0xFF);
+ eraseSRAM(0x0F);
+ eraseSRAM(0xF0);
writeSRAM(0);
unsigned long wrErrors = verifySRAM();
if (wrErrors == 0) {
@@ -797,7 +857,7 @@ void getCartInfo_SNES() {
print_Msg(FS(FSTRING_NAME));
println_Msg(romName);
- print_Msg(F("Revision: "));
+ print_Msg(FS(FSTRING_REVISION));
println_Msg(romVersion);
print_Msg(F("Type: "));
@@ -860,10 +920,7 @@ void getCartInfo_SNES() {
println_Msg(FS(FSTRING_EMPTY));
- if (altconf)
- print_Msg(F("Rom Size: "));
- else
- print_Msg(F("ROM Size: "));
+ print_Msg(FS(FSTRING_ROM_SIZE));
if ((romSize >> 3) < 1) {
print_Msg(1024 * romSize >> 3);
print_Msg(F(" KB"));
@@ -906,7 +963,6 @@ void getCartInfo_SNES() {
void checkAltConf(char crcStr[9]) {
char tempStr2[5];
char tempStr3[9];
- altconf = 0;
if (myFile.open("snes.txt", O_READ)) {
// Get cart info
@@ -982,7 +1038,6 @@ void checkAltConf(char crcStr[9]) {
delay(1000);
romSize = romSize2;
numBanks = numBanks2;
- altconf = 1;
}
break;
}
@@ -1594,9 +1649,20 @@ void writeSRAM(boolean browseFile) {
// Writing SRAM on HiRom needs CS(PH3) to be high
PORTH |= (1 << 3);
// Sram size
- long lastByte = (long(sramSize) * 128) + 0x6000;
- for (long currByte = 0x6000; currByte < lastByte; currByte++) {
- writeBank_SNES(0xB0, currByte, myFile.read());
+ long lastByte = (long(sramSize) * 128);
+ if (lastByte > 0x2000) { // Large EX SRAM Fix
+ sramBanks = lastByte / 0x2000;
+ for (int currBank = 0xB0; currBank < sramBanks + 0xB0; currBank++) {
+ for (long currByte = 0x6000; currByte < 0x8000; currByte++) {
+ writeBank_SNES(currBank, currByte, myFile.read());
+ }
+ }
+ } else {
+ lastByte += 0x6000;
+ // Write to sram bank
+ for (long currByte = 0x6000; currByte < lastByte; currByte++) {
+ writeBank_SNES(0xB0, currByte, myFile.read());
+ }
}
}
// SA1
@@ -1748,9 +1814,19 @@ void readSRAM() {
// Dumping SRAM on HiRom needs CS(PH3) to be high
PORTH |= (1 << 3);
// Sram size
- long lastByte = (long(sramSize) * 128) + 0x6000;
- for (long currByte = 0x6000; currByte < lastByte; currByte++) {
- myFile.write(readBank_SNES(0xB0, currByte));
+ long lastByte = (long(sramSize) * 128);
+ if (lastByte > 0x2000) { // Large EX SRAM Fix
+ sramBanks = lastByte / 0x2000;
+ for (int currBank = 0xB0; currBank < sramBanks + 0xB0; currBank++) {
+ for (long currByte = 0x6000; currByte < 0x8000; currByte++) {
+ myFile.write(readBank_SNES(currBank, currByte));
+ }
+ }
+ } else {
+ lastByte += 0x6000;
+ for (long currByte = 0x6000; currByte < lastByte; currByte++) {
+ myFile.write(readBank_SNES(0xB0, currByte));
+ }
}
} else if (romType == SA) {
// Dumping SRAM on HiRom needs CS(PH3) to be high
@@ -1903,13 +1979,29 @@ unsigned long verifySRAM() {
// Dumping SRAM on HiRom needs CS(PH3) to be high
PORTH |= (1 << 3);
// Sram size
- long lastByte = (long(sramSize) * 128) + 0x6000;
- for (long currByte = 0x6000; currByte < lastByte; currByte += 512) {
- //fill sdBuffer
- myFile.read(sdBuffer, 512);
- for (int c = 0; c < 512; c++) {
- if ((readBank_SNES(0xB0, currByte + c)) != sdBuffer[c]) {
- writeErrors++;
+ long lastByte = (long(sramSize) * 128);
+ if (lastByte > 0x2000) { // Large EX SRAM Fix
+ sramBanks = lastByte / 0x2000;
+ for (int currBank = 0xB0; currBank < sramBanks + 0xB0; currBank++) {
+ for (long currByte = 0x6000; currByte < 0x8000; currByte += 512) {
+ //fill sdBuffer
+ myFile.read(sdBuffer, 512);
+ for (int c = 0; c < 512; c++) {
+ if ((readBank_SNES(currBank, currByte + c)) != sdBuffer[c]) {
+ writeErrors++;
+ }
+ }
+ }
+ }
+ } else {
+ lastByte += 0x6000;
+ for (long currByte = 0x6000; currByte < lastByte; currByte += 512) {
+ //fill sdBuffer
+ myFile.read(sdBuffer, 512);
+ for (int c = 0; c < 512; c++) {
+ if ((readBank_SNES(0xB0, currByte + c)) != sdBuffer[c]) {
+ writeErrors++;
+ }
}
}
}
@@ -2060,10 +2152,21 @@ boolean eraseSRAM(byte b) {
else if (romType == EX) {
// Writing SRAM on HiRom needs CS(PH3) to be high
PORTH |= (1 << 3);
- // Sram size
- long lastByte = (long(sramSize) * 128) + 0x6000;
- for (long currByte = 0x6000; currByte < lastByte; currByte++) {
- writeBank_SNES(0xB0, currByte, b);
+ /// Sram size
+ long lastByte = (long(sramSize) * 128);
+ if (lastByte > 0x2000) { // Large EX SRAM Fix
+ sramBanks = lastByte / 0x2000;
+ for (int currBank = 0xB0; currBank < sramBanks + 0xB0; currBank++) {
+ for (long currByte = 0x6000; currByte < 0x8000; currByte++) {
+ writeBank_SNES(currBank, currByte, b);
+ }
+ }
+ } else {
+ lastByte += 0x6000;
+ // Write to sram bank
+ for (long currByte = 0x6000; currByte < lastByte; currByte++) {
+ writeBank_SNES(0xB0, currByte, b);
+ }
}
}
// SA1
@@ -2220,11 +2323,25 @@ boolean eraseSRAM(byte b) {
// Dumping SRAM on HiRom needs CS(PH3) to be high
PORTH |= (1 << 3);
// Sram size
- long lastByte = (long(sramSize) * 128) + 0x6000;
- for (long currByte = 0x6000; currByte < lastByte; currByte += 512) {
- for (int c = 0; c < 512; c++) {
- if ((readBank_SNES(0xB0, currByte + c)) != b) {
- writeErrors++;
+ long lastByte = (long(sramSize) * 128);
+ if (lastByte > 0x2000) { // Large EX SRAM Fix
+ sramBanks = lastByte / 0x2000;
+ for (int currBank = 0xB0; currBank < sramBanks + 0xB0; currBank++) {
+ for (long currByte = 0x6000; currByte < 0x8000; currByte += 512) {
+ for (int c = 0; c < 512; c++) {
+ if ((readBank_SNES(currBank, currByte + c)) != b) {
+ writeErrors++;
+ }
+ }
+ }
+ }
+ } else {
+ lastByte += 0x6000;
+ for (long currByte = 0x6000; currByte < lastByte; currByte += 512) {
+ for (int c = 0; c < 512; c++) {
+ if ((readBank_SNES(0xB0, currByte + c)) != b) {
+ writeErrors++;
+ }
}
}
}
diff --git a/Cart_Reader/SUPRACAN.ino b/Cart_Reader/SUPRACAN.ino
index 956c2fe..910b931 100644
--- a/Cart_Reader/SUPRACAN.ino
+++ b/Cart_Reader/SUPRACAN.ino
@@ -416,7 +416,7 @@ static void checkRomExist_Acan() {
if (cartSize == 0)
print_Error(F("Unable to find rom signature..."));
else {
- print_Msg(F("ROM Size: "));
+ print_Msg(FS(FSTRING_ROM_SIZE));
print_Msg(romSize);
println_Msg(F(" Mb"));
}
diff --git a/Cart_Reader/VECTREX.ino b/Cart_Reader/VECTREX.ino
index f5dba3b..75edede 100644
--- a/Cart_Reader/VECTREX.ino
+++ b/Cart_Reader/VECTREX.ino
@@ -48,13 +48,16 @@
// R/W(PH6) - SNES /RD
//******************************************
-// Defines
+// DEFINES
//******************************************
#define CLK_ENABLE PORTH |= (1 << 1) // /E HIGH
#define CLK_DISABLE PORTH &= ~(1 << 1) // /E LOW
#define PB6_ENABLE PORTH |= (1 << 5) // PB6 HIGH
#define PB6_DISABLE PORTH &= ~(1 << 5) // PB6 LOW
+//******************************************
+// VARIABLES
+//******************************************
byte VECTREX[] = { 4, 8, 12, 16, 32, 64 };
byte vectrexlo = 0; // Lowest Entry
byte vectrexhi = 5; // Highest Entry
@@ -64,12 +67,48 @@ byte vectrexsize;
// 08 ROM SIZE
//******************************************
-// Menu
+// MENU
//******************************************
// Base Menu
static const char* const menuOptionsVECTREX[] PROGMEM = { FSTRING_SELECT_CART, FSTRING_READ_ROM, FSTRING_SET_SIZE, FSTRING_RESET };
-void setup_VECTREX() {
+void vectrexMenu()
+{
+ convertPgm(menuOptionsVECTREX, 4);
+ uint8_t mainMenu = question_box(F("VECTREX MENU"), menuOptions, 4, 0);
+
+ switch (mainMenu) {
+ case 0:
+ // Select Cart
+ setCart_VECTREX();
+ setup_VECTREX();
+ break;
+
+ case 1:
+ // Read ROM
+ sd.chdir("/");
+ readROM_VECTREX();
+ sd.chdir("/");
+ break;
+
+ case 2:
+ // Set Size
+ setROMSize_VECTREX();
+ break;
+
+ case 3:
+ // reset
+ resetArduino();
+ break;
+ }
+}
+
+//******************************************
+// SETUP
+//******************************************
+
+void setup_VECTREX()
+{
// Request 5V
setVoltage(VOLTS_SET_5V);
@@ -115,41 +154,11 @@ void setup_VECTREX() {
mode = CORE_VECTREX;
}
-void vectrexMenu() {
- convertPgm(menuOptionsVECTREX, 4);
- uint8_t mainMenu = question_box(F("VECTREX MENU"), menuOptions, 4, 0);
-
- switch (mainMenu) {
- case 0:
- // Select Cart
- setCart_VECTREX();
- setup_VECTREX();
- break;
-
- case 1:
- // Read ROM
- sd.chdir("/");
- readROM_VECTREX();
- sd.chdir("/");
- break;
-
- case 2:
- // Set Size
- setROMSize_VECTREX();
- break;
-
- case 3:
- // reset
- resetArduino();
- break;
- }
-}
-
//******************************************
// READ CODE
//******************************************
-uint8_t readData_VECTREX(uint16_t addr) // Add Input Pullup
+uint8_t readData_VECTREX(uint16_t addr) // Add Input Pullup
{
PORTF = addr & 0xFF; // A0-A7
PORTK = (addr >> 8) & 0xFF; // A8-A15
@@ -181,7 +190,8 @@ uint8_t readData_VECTREX(uint16_t addr) // Add Input Pullup
return ret;
}
-void readSegment_VECTREX(uint16_t startaddr, uint16_t endaddr) {
+void readSegment_VECTREX(uint16_t startaddr, uint16_t endaddr)
+{
for (uint16_t addr = startaddr; addr < endaddr; addr += 512) {
for (int w = 0; w < 512; w++) {
uint8_t temp = readData_VECTREX(addr + w);
@@ -195,7 +205,8 @@ void readSegment_VECTREX(uint16_t startaddr, uint16_t endaddr) {
// READ ROM
//******************************************
-void readROM_VECTREX() {
+void readROM_VECTREX()
+{
createFolderAndOpenFile("VECTREX", "ROM", romName, "vec");
PB6_DISABLE; // PB6 LOW - Switch Bank
@@ -236,14 +247,16 @@ void readROM_VECTREX() {
//******************************************
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
-void printRomSize_VECTREX(int index) {
+void printRomSize_VECTREX(int index)
+{
display_Clear();
- print_Msg(F("ROM Size: "));
+ print_Msg(FS(FSTRING_ROM_SIZE));
println_Msg(VECTREX[index]);
}
#endif
-void setROMSize_VECTREX() {
+void setROMSize_VECTREX()
+{
byte newvectrexsize;
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear();
@@ -291,9 +304,10 @@ setrom:
vectrexsize = newvectrexsize;
}
-void checkStatus_VECTREX() {
+void checkStatus_VECTREX()
+{
EEPROM_readAnything(8, vectrexsize);
- if (vectrexsize > 2) {
+ if (vectrexsize > vectrexhi) {
vectrexsize = 0; // default 4KB
EEPROM_writeAnything(8, vectrexsize);
}
@@ -319,7 +333,8 @@ void checkStatus_VECTREX() {
//******************************************
// CART SELECT CODE
//******************************************
-void setCart_VECTREX() {
+void setCart_VECTREX()
+{
//go to root
sd.chdir();
diff --git a/Cart_Reader/WS.ino b/Cart_Reader/WS.ino
index 77c0b3d..29b8450 100644
--- a/Cart_Reader/WS.ino
+++ b/Cart_Reader/WS.ino
@@ -376,7 +376,7 @@ static void showCartInfo_WS() {
print_Msg(F("Game: "));
println_Msg(romName);
- print_Msg(F("Rom Size: "));
+ print_Msg(FS(FSTRING_ROM_SIZE));
if (cartSize == 0x00)
println_Msg(romSize, HEX);
else {
diff --git a/Cart_Reader/WSV.ino b/Cart_Reader/WSV.ino
index 7360875..fbaf6b7 100644
--- a/Cart_Reader/WSV.ino
+++ b/Cart_Reader/WSV.ino
@@ -222,7 +222,7 @@ void readROM_WSV() {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
void printRomSize_WSV(int index) {
display_Clear();
- print_Msg(F("ROM Size: "));
+ print_Msg(FS(FSTRING_ROM_SIZE));
println_Msg(pgm_read_word(&(WSV[index])));
}
#endif
diff --git a/sd/7800.txt b/sd/7800.txt
index e66951b..4025100 100644
--- a/sd/7800.txt
+++ b/sd/7800.txt
@@ -46,6 +46,9 @@ Crack'ed
Crossbow
2,5
+Danger Zone
+0,2
+
Dark Chambers
1,4
diff --git a/sd/n64.txt b/sd/n64.txt
index 8244993..5cd51eb 100644
--- a/sd/n64.txt
+++ b/sd/n64.txt
@@ -530,7 +530,7 @@ Destruction Derby 64 (USA).z64
38F1B5D9,DEE584A2,16,0
Dezaemon 3D (Japan).z64
-9E978488,8979169C,16,0
+9E978488,8979169C,16,2
Diddy Kong Racing (Europe) (En,Fr,De) (Rev 1).z64
B1E87639,596E145B,12,5
diff --git a/sd/nes.txt b/sd/nes.txt
index c6e4698..5d5d82c 100755
--- a/sd/nes.txt
+++ b/sd/nes.txt
@@ -124,6 +124,9 @@ D8AB6288,BD7BC39F,4E45531A080021082000000700000002
8BIT MUSIC POWER (Japan) (En) (Aftermarket) (Unl).nes
00263E3C,119D1DE1,4E45531A202040080000000000000001
+8BIT MUSIC POWER ENCORE (Japan) (En) (Aftermarket) (Unl).nes
+D0A05E33,87B34AED,4E45531A202040080000000000000001
+
8BIT MUSIC POWER FINAL (Japan) (En) (Aftermarket) (Unl).nes
F53F83DD,119D1DE1,4E45531A202040080000000000000001
diff --git a/sd/pcw.txt b/sd/pcw.txt
index 1f9a94b..a39c037 100644
--- a/sd/pcw.txt
+++ b/sd/pcw.txt
@@ -58,7 +58,7 @@ Shinkenzemi Chuugaku Kouza - Chuu 1 Eigo (Japan) (7BB115OW).pcw
Shinkenzemi Chuugaku Kouza - Chuu 1 Suugaku (Japan) (1BM111).pcw
5DB9B999
-Shinkenzemi Chuugaku Kouza - Chuu 2 Eigo (Japan) (7BB211NH).pcw
+Shinkenzemi Chuugaku Kouza - Chuu 2 Eigo (Japan) (0BB211NH - 7BB211NH).pcw
5138519C
Shinkenzemi Chuugaku Kouza - Chuu 2 Eigo (Japan) (7BB212SS).pcw
@@ -172,7 +172,7 @@ Shinkenzemi Chuugaku Kouza - Chuugaku Rika Pack (Japan) (0BF400).pcw
Shinkenzemi Chuugaku Kouza - Chuugaku Rika Pack (Japan) (1BF400).pcw
6205144B
-Shinkenzemi Chuugaku Kouza - Chuugaku Rika Pack (Japan) (8BF400).pcw
+Shinkenzemi Chuugaku Kouza - Chuugaku Rika Pack (Japan) (8BF400 - 9BF400).pcw
D35A38DA
Shinkenzemi Chuugaku Kouza - Hinshutsu Sekaishi Kouryaku (Japan) (8BCD01).pcw