From e87de583287018540a05bdcaea4808bc0d305742 Mon Sep 17 00:00:00 2001 From: sanni Date: Sun, 17 Jul 2022 14:50:59 +0200 Subject: [PATCH] V9.0 --- Cart_Reader/Cart_Reader.ino | 62 ++++++++++++++++++++++++------------- Cart_Reader/FLASH.ino | 29 ++++++++++++----- Cart_Reader/SMS.ino | 2 +- 3 files changed, 62 insertions(+), 31 deletions(-) diff --git a/Cart_Reader/Cart_Reader.ino b/Cart_Reader/Cart_Reader.ino index ba561cd..5c71983 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: 08.07.2022 - Version: 9.0 BETA + Date: 17.07.2022 + Version: 9.0 SD lib: https://github.com/greiman/SdFat OLED lib: https://github.com/adafruit/Adafruit_SSD1306 @@ -36,6 +36,7 @@ insidegadgets - GBCartRead RobinTheHood - GameboyAdvanceRomDumper Gens-gs - Megadrive checksum + fceux - iNes header 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, @@ -58,7 +59,7 @@ **********************************************************************************/ -char ver[5] = "9.0B"; +char ver[5] = "9.0"; //****************************************** // !!! CHOOSE HARDWARE VERSION !!! @@ -75,6 +76,24 @@ char ver[5] = "9.0B"; # error !!! PLEASE CHOOSE HARDWARE VERSION !!! #endif +//****************************************** +// ENABLE MODULES +//****************************************** +// remove // before #define to enable a module +#define enable_SNES +#define enable_NP +#define enable_SV +#define enable_MD +#define enable_SMS +#define enable_N64 +#define enable_GBX +#define enable_NES +#define enable_FLASH +#define enable_FLASH16 +//#define enable_PCE +//#define enable_WS +//#define enable_NGP + //****************************************** // HW CONFIGS //****************************************** @@ -140,25 +159,6 @@ char ver[5] = "9.0B"; // saves a n64log.txt file with rom info in /N64/ROM // #define savesummarytotxt -//****************************************** -// DISABLE MODULES -//****************************************** -// add // before #define to disable a module -#define enable_SNES -#define enable_NP -#define enable_SV - -#define enable_MD -#define enable_SMS - -#define enable_N64 -#define enable_GBX -#define enable_NES -#define enable_FLASH -#define enable_PCE -#define enable_WS -#define enable_NGP - /****************************************** Libraries *****************************************/ @@ -795,13 +795,23 @@ void mainMenu() { #ifdef enable_FLASH case 9: +#ifdef enable_FLASH16 flashMenu(); +#else + flashromMenu8(); +#endif break; #endif case 10: aboutScreen(); break; + + default: + display_Clear(); + println_Msg(F("Please enable module")); + print_Error(F("in Cart_Reader.ino."), true); + break; } } @@ -943,6 +953,12 @@ void addonsMenu() { case 6: resetArduino(); break; + + default: + display_Clear(); + println_Msg(F("Please enable module")); + print_Error(F("in Cart_Reader.ino."), true); + break; } } #endif @@ -2904,6 +2920,7 @@ void loop() { else if (mode == mode_FLASH8) { flashromMenu8(); } +#ifdef enable_FLASH16 else if (mode == mode_FLASH16) { flashromMenu16(); } @@ -2911,6 +2928,7 @@ void loop() { epromMenu(); } #endif +#endif #ifdef enable_NP else if (mode == mode_SFM) { sfmMenu(); diff --git a/Cart_Reader/FLASH.ino b/Cart_Reader/FLASH.ino index b82dfe0..fe6db6b 100644 --- a/Cart_Reader/FLASH.ino +++ b/Cart_Reader/FLASH.ino @@ -20,13 +20,6 @@ byte mapping = 1; /****************************************** Menu *****************************************/ -// Flash start menu -static const char flashMenuItem1[] PROGMEM = "8bit Flash adapter"; -static const char flashMenuItem2[] PROGMEM = "Eprom adapter"; -static const char flashMenuItem3[] PROGMEM = "MX26L6420 adapter"; -static const char flashMenuItem4[] PROGMEM = "Reset"; -static const char* const menuOptionsFlash[] PROGMEM = {flashMenuItem1, flashMenuItem2, flashMenuItem3, flashMenuItem4}; - // 8bit Flash menu items static const char flash8MenuItem1[] PROGMEM = "Blankcheck"; static const char flash8MenuItem2[] PROGMEM = "Erase"; @@ -37,6 +30,14 @@ static const char flash8MenuItem6[] PROGMEM = "Print"; static const char flash8MenuItem7[] PROGMEM = "Reset"; static const char* const menuOptionsFLASH8[] PROGMEM = {flash8MenuItem1, flash8MenuItem2, flash8MenuItem3, flash8MenuItem4, flash8MenuItem5, flash8MenuItem6, flash8MenuItem7}; +#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 = "MX26L6420 adapter"; +static const char flashMenuItem4[] PROGMEM = "Reset"; +static const char* const menuOptionsFlash[] PROGMEM = {flashMenuItem1, flashMenuItem2, flashMenuItem3, flashMenuItem4}; + // 16bit Flash menu items static const char flash16MenuItem1[] PROGMEM = "Blankcheck"; static const char flash16MenuItem2[] PROGMEM = "Erase"; @@ -97,6 +98,7 @@ void flashMenu() { break; } } +#endif void flashromMenu8() { // create menu with title and 7 options to choose from @@ -231,6 +233,7 @@ void flashromMenu8() { wait(); } +#ifdef enable_FLASH16 void flashromMenu16() { // create menu with title "Flashrom Writer 16" and 7 options to choose from unsigned char mainMenu; @@ -393,6 +396,7 @@ void epromMenu() { } wait(); } +#endif /****************************************** Flash IDs @@ -605,6 +609,7 @@ idtheflash: resetFlash8(); } +#ifdef enable_FLASH16 void id_Flash16() { // ID flash idFlash16(); @@ -663,6 +668,7 @@ void id_Flash16() { println_Msg(F("Press Button...")); display_Update(); } +#endif /****************************************** Setup @@ -689,6 +695,7 @@ void setup_Flash8() { PORTC = 0x00; } +#ifdef enable_FLASH16 void setup_Flash16() { // Set Address Pins to Output //A0-A7 @@ -743,6 +750,7 @@ void setup_Eprom() { // 27C322 is a 4MB eprom flashSize = 4194304; } +#endif /****************************************** I/O Functions @@ -753,6 +761,7 @@ void dataIn8() { DDRC = 0x00; } +#ifdef enable_FLASH16 // Switch data pins to write void dataOut16() { DDRC = 0xFF; @@ -764,6 +773,7 @@ void dataIn16() { DDRC = 0x00; DDRA = 0x00; } +#endif /****************************************** Low level functions @@ -906,6 +916,7 @@ byte readByte_Flash(unsigned long myAddress) { return tempByte; } +#ifdef enable_FLASH16 void writeWord_Flash(unsigned long myAddress, word myData) { PORTF = myAddress & 0xFF; PORTK = (myAddress >> 8) & 0xFF; @@ -954,6 +965,7 @@ word readWord_Flash(unsigned long myAddress) { return tempWord; } +#endif /****************************************** 29F032 flashrom functions @@ -1801,6 +1813,7 @@ void resetFlash8() { } } +#ifdef enable_FLASH16 /****************************************** 29L3211 16bit flashrom functions *****************************************/ @@ -2535,7 +2548,7 @@ void print_Eprom(int numBytes) { } display_Update(); } - +#endif #endif //****************************************** diff --git a/Cart_Reader/SMS.ino b/Cart_Reader/SMS.ino index 7c11f15..6a5e3b9 100644 --- a/Cart_Reader/SMS.ino +++ b/Cart_Reader/SMS.ino @@ -1,7 +1,7 @@ //******************************************************** // SEGA MASTER SYSTEM/Mark III/SG-1000/GAME GEAR MODULE //******************************************************** -#ifdef enable_MD +#ifdef enable_SMS /****************************************** Variables