Move automatic voltage selection from menu to setup functions

This commit is contained in:
sanni 2023-06-26 12:04:00 +02:00
parent 4a5c4a5fca
commit dee54dd30e
29 changed files with 266 additions and 134 deletions

View File

@ -56,6 +56,11 @@ static const char arcMenuItem4[] PROGMEM = "Reset";
static const char* const menuOptionsARC[] PROGMEM = { arcMenuItem1, arcMenuItem2, arcMenuItem3, arcMenuItem4 };
void setup_ARC() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 5V
setVoltage(VOLTS_SET_5V);
#endif
// Set Address Pins to Output
// Arcadia 2001 uses A0-A13 [A14-A23 UNUSED]
//A0-A7
@ -94,7 +99,6 @@ void setup_ARC() {
}
void arcMenu() {
setVoltage(VOLTS_SET_5V);
convertPgm(menuOptionsARC, 4);
uint8_t mainMenu = question_box(F("ARCADIA 2001 MENU"), menuOptions, 4, 0);

View File

@ -63,6 +63,11 @@ static const char atariMenuItem4[] PROGMEM = "Reset";
static const char* const menuOptionsATARI[] PROGMEM = { atariMenuItem1, atariMenuItem2, atariMenuItem3, atariMenuItem4 };
void setup_ATARI() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 5V
setVoltage(VOLTS_SET_5V);
#endif
// Set Address Pins to Output
// Atari 2600 uses A0-A12 [A13-A23 UNUSED]
//A0-A7
@ -101,7 +106,6 @@ void setup_ATARI() {
}
void atariMenu() {
setVoltage(VOLTS_SET_5V);
convertPgm(menuOptionsATARI, 4);
uint8_t mainMenu = question_box(F("ATARI 2600 MENU"), menuOptions, 4, 0);

View File

@ -55,6 +55,11 @@ static const char colMenuItem3[] PROGMEM = "Set Size";
static const char* const menuOptionsCOL[] PROGMEM = { colMenuItem1, colMenuItem2, colMenuItem3, string_reset2 };
void setup_COL() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 5V
setVoltage(VOLTS_SET_5V);
#endif
// Set Address Pins to Output
// Colecovision uses A0-A14 [A15-A23 UNUSED]
//A0-A7
@ -93,7 +98,6 @@ void setup_COL() {
}
void colMenu() {
setVoltage(VOLTS_SET_5V);
convertPgm(menuOptionsCOL, 4);
uint8_t mainMenu = question_box(F("COLECOVISION MENU"), menuOptions, 4, 0);

View File

@ -4,7 +4,7 @@
This project represents a community-driven effort to provide
an easy to build and easy to modify cartridge dumper.
Date: 2023-06-25
Date: 2023-06-26
Version: 12.6
SD lib: https://github.com/greiman/SdFat
@ -837,7 +837,7 @@ static const char modeItem9[] PROGMEM = "NeoGeo Pocket (3V)";
static const char modeItem10[] PROGMEM = "Intellivision";
static const char modeItem11[] PROGMEM = "Colecovision";
static const char modeItem12[] PROGMEM = "Virtual Boy";
static const char modeItem13[] PROGMEM = "Watara Supervision";
static const char modeItem13[] PROGMEM = "Watara Supervision (3V)";
static const char modeItem14[] PROGMEM = "Pocket Challenge W";
static const char modeItem15[] PROGMEM = "Atari 2600";
static const char modeItem16[] PROGMEM = "Magnavox Odyssey 2";
@ -847,7 +847,7 @@ static const char modeItem19[] PROGMEM = "Super A'can";
static const char modeItem20[] PROGMEM = "MSX";
static const char modeItem21[] PROGMEM = "Pokemon Mini (3V)";
static const char modeItem22[] PROGMEM = "Flashrom Programmer";
static const char modeItem23[] PROGMEM = "Self Test";
static const char modeItem23[] PROGMEM = "Self Test (3V)";
static const char modeItem24[] PROGMEM = "About";
//static const char modeItem25[] PROGMEM = "Reset"; (stored in common strings array)
static const char* const modeOptions[] PROGMEM = { modeItem1, modeItem2, modeItem3, modeItem4, modeItem5, modeItem6, modeItem7, modeItem8, modeItem9, modeItem10, modeItem11, modeItem12, modeItem13, modeItem14, modeItem15, modeItem16, modeItem17, modeItem18, modeItem19, modeItem20, modeItem21, modeItem22, modeItem23, modeItem24, string_reset2 };
@ -1046,6 +1046,9 @@ void mainMenu() {
#ifdef enable_FLASH
case 21:
#ifdef ENABLE_VSELECT
setup_FlashVoltage();
#endif
flashMenu();
break;
#endif
@ -1123,7 +1126,7 @@ static const char* const consoles90Options[] PROGMEM = { consoles90Item1, string
static const char handheldsItem1[] PROGMEM = "Virtual Boy";
static const char handheldsItem2[] PROGMEM = "WonderSwan (3V)";
static const char handheldsItem3[] PROGMEM = "NeoGeo Pocket (3V)";
static const char handheldsItem4[] PROGMEM = "Watara Supervision";
static const char handheldsItem4[] PROGMEM = "Watara Supervision (3V)";
static const char handheldsItem5[] PROGMEM = "Pocket Challenge W";
static const char handheldsItem6[] PROGMEM = "Pokemon Mini (3V)";
//static const char handheldsItem6[] PROGMEM = "Reset"; (stored in common strings array)
@ -1211,6 +1214,9 @@ void addonMenu() {
#ifdef enable_FLASH
case 4:
#ifdef ENABLE_VSELECT
setup_FlashVoltage();
#endif
flashMenu();
break;
#endif
@ -1439,6 +1445,11 @@ void handheldMenu() {
#ifdef enable_selftest
void selfTest() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 3V
setVoltage(VOLTS_SET_3V3);
#endif
display_Clear();
println_Msg(F("Self Test"));
println_Msg(F(""));
@ -2134,7 +2145,7 @@ void setup() {
statusLED(true);
// Start menu system
startMenu();
mainMenu();
}
/******************************************

View File

@ -279,19 +279,6 @@
/****/
/* [ Start Menu --------------------------------------------------- ]
* Change this when using a single slot cart reader to always start
* in that menu.
*
* OPTIONS :
* mainMenu, snsMenu, mdMenu, n64Menu, gbxMenu, pcsMenu,
* flashMenu, nesMenu, smsMenu
*/
#define startMenu mainMenu
/****/
/* [ Logging ------------------------------------------------------ ]
* Write all info to OSCR_LOG.txt in root dir
*/

View File

@ -87,6 +87,11 @@ static const char fairchildMenuItem5[] PROGMEM = "Reset";
static const char* const menuOptionsFAIRCHILD[] PROGMEM = { fairchildMenuItem1, fairchildMenuItem2, fairchildMenuItem3, fairchildMenuItem4, fairchildMenuItem5 };
void setup_FAIRCHILD() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 5V
setVoltage(VOLTS_SET_5V);
#endif
// Set Address Pins to Output
// Channel F uses A0-A4 [A5-A23 UNUSED]
//A0-A7
@ -126,7 +131,6 @@ void setup_FAIRCHILD() {
}
void fairchildMenu() {
setVoltage(VOLTS_SET_5V);
convertPgm(menuOptionsFAIRCHILD, 5);
uint8_t mainMenu = question_box(F("CHANNEL F MENU"), menuOptions, 5, 0);

View File

@ -680,6 +680,38 @@ void id_Flash16() {
/******************************************
Setup
*****************************************/
#ifdef ENABLE_VSELECT
static const char flashvoltItem1[] PROGMEM = "3.3V";
static const char flashvoltItem2[] PROGMEM = "5V";
//static const char flashvoltItem3[] PROGMEM = "Reset"; (stored in common strings array)
static const char* const flashvoltOptions[] PROGMEM = { flashvoltItem1, flashvoltItem2, string_reset2 };
void setup_FlashVoltage() {
// create menu with title and 3 options to choose from
unsigned char flashvolt;
// Copy menuOptions out of progmem
convertPgm(flashvoltOptions, 3);
flashvolt = question_box(F("Select Flash Voltage"), menuOptions, 3, 0);
// wait for user choice to come back from the question box menu
switch (flashvolt) {
case 0:
// Set Automatic Voltage Selection to 3V
setVoltage(VOLTS_SET_3V3);
break;
case 1:
// Set Automatic Voltage Selection to 5V
setVoltage(VOLTS_SET_5V);
break;
case 2:
resetArduino();
break;
}
}
#endif
void setup_Flash8() {
// Set Address Pins to Output
//A0-A7

View File

@ -41,8 +41,7 @@ static const char* const menuOptionsGBFlash[] PROGMEM = { GBFlashItem1, GBFlashI
// Start menu for both GB and GBA
void gbxMenu() {
setVoltage(VOLTS_SET_3V3);
// create menu with title and 4 options to choose from
// create menu with title and 5 options to choose from
unsigned char gbType;
// Copy menuOptions out of progmem
convertPgm(menuOptionsGBx, 5);
@ -51,7 +50,6 @@ void gbxMenu() {
// wait for user choice to come back from the question box menu
switch (gbType) {
case 0:
setVoltage(VOLTS_SET_5V);
display_Clear();
display_Update();
setup_GB();
@ -59,7 +57,6 @@ void gbxMenu() {
break;
case 1:
setVoltage(VOLTS_SET_3V3);
display_Clear();
display_Update();
setup_GBA();
@ -69,7 +66,6 @@ void gbxMenu() {
case 2:
// create submenu with title and 7 options to choose from
unsigned char gbFlash;
setVoltage(VOLTS_SET_5V);
// Copy menuOptions out of progmem
convertPgm(menuOptionsGBFlash, 7);
gbFlash = question_box(F("Select type"), menuOptions, 7, 0);
@ -97,7 +93,6 @@ void gbxMenu() {
case 1:
//Flash MBC5
setVoltage(VOLTS_SET_5V);
display_Clear();
display_Update();
setup_GB();
@ -291,7 +286,7 @@ void gbxMenu() {
}
void gbMenu() {
// create menu with title and 3 options to choose from
// create menu with title and 4 options to choose from
unsigned char mainMenu;
// Copy menuOptions out of progmem
convertPgm(menuOptionsGB, 4);
@ -375,6 +370,11 @@ void gbMenu() {
Setup
*****************************************/
void setup_GB() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 5V
setVoltage(VOLTS_SET_5V);
#endif
// Set Address Pins to Output
//A0-A7
DDRF = 0xFF;
@ -876,7 +876,7 @@ void getCartInfo_GB() {
if (romType == 32) {
sramBanks = 8;
lastByte = 0xAFFF;
} else if (romType == 34) { // MBC7
} else if (romType == 34) { // MBC7
lastByte = (*((uint16_t*)(eepbit + 6)) == 0xa5be ? 512 : 256); // Only "Command Master" use LC66 EEPROM
}

View File

@ -34,7 +34,6 @@ static const char GBASaveItem6[] PROGMEM = "1M FLASH";
static const char* const saveOptionsGBA[] PROGMEM = { GBASaveItem1, GBASaveItem2, GBASaveItem3, GBASaveItem4, GBASaveItem5, GBASaveItem6 };
void gbaMenu() {
setVoltage(VOLTS_SET_3V3);
// create menu with title and 4 options to choose from
unsigned char mainMenu;
// Copy menuOptions out of progmem
@ -247,6 +246,11 @@ void gbaMenu() {
Setup
*****************************************/
void setup_GBA() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 3V
setVoltage(VOLTS_SET_3V3);
#endif
setROM_GBA();
// Get cart info
@ -893,17 +897,17 @@ void readROM_GBA() {
processedProgressBar += 512;
draw_progressbar(processedProgressBar, totalProgressBar);
}
// Fix unmapped ROM area of cartridges with 32 MB ROM + EEPROM save type
if ((cartSize == 0x2000000) && ((saveType == 1) || (saveType == 2))) {
byte padding_byte[256];
char tempStr[32];
myFile.seek(0x1FFFEFF);
myFile.read(padding_byte, 1);
sprintf(tempStr, "Fixing ROM padding (0x%02X)", padding_byte[0]);
println_Msg(tempStr);
memset(padding_byte+1, padding_byte[0], 255);
myFile.write(padding_byte, 256);
char tempStr[32];
myFile.seek(0x1FFFEFF);
myFile.read(padding_byte, 1);
sprintf(tempStr, "Fixing ROM padding (0x%02X)", padding_byte[0]);
println_Msg(tempStr);
memset(padding_byte + 1, padding_byte[0], 255);
myFile.write(padding_byte, 256);
}
// Close the file:

View File

@ -17,7 +17,6 @@ static const char gbmMenuItem7[] PROGMEM = "Write Mapping";
static const char* const menuOptionsGBM[] PROGMEM = { gbmMenuItem1, gbmMenuItem2, gbmMenuItem3, gbmMenuItem4, gbmMenuItem5, gbmMenuItem6, gbmMenuItem7 };
void gbmMenu() {
setVoltage(VOLTS_SET_5V);
// create menu with title and 7 options to choose from
unsigned char mainMenu;
// Copy menuOptions out of progmem
@ -185,6 +184,11 @@ void gbmMenu() {
Setup
*****************************************/
void setup_GBM() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 5V
setVoltage(VOLTS_SET_5V);
#endif
// Set RST(PH0) to Input
DDRH &= ~(1 << 0);
// Activate Internal Pullup Resistors

View File

@ -109,6 +109,11 @@ byte readByte_GBS(word myAddress) {
}
void setup_GBSmart() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 5V
setVoltage(VOLTS_SET_5V);
#endif
// take from setup_GB
// Set RST(PH0) to Input
DDRH &= ~(1 << 0);
@ -145,7 +150,6 @@ void setup_GBSmart() {
}
void gbSmartMenu() {
setVoltage(VOLTS_SET_5V);
uint8_t mainMenu;
// Copy menuOptions out of progmem

View File

@ -99,6 +99,11 @@ static const char intvMenuItem3[] PROGMEM = "Set Mapper + Size";
static const char* const menuOptionsINTV[] PROGMEM = { intvMenuItem1, intvMenuItem2, intvMenuItem3, string_reset2 };
void setup_INTV() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 5V
setVoltage(VOLTS_SET_5V);
#endif
// Set Address Pins to Output (UNUSED)
//A0-A7
DDRF = 0xFF;
@ -135,7 +140,6 @@ void setup_INTV() {
}
void intvMenu() {
setVoltage(VOLTS_SET_5V);
convertPgm(menuOptionsINTV, 4);
uint8_t mainMenu = question_box(F("INTELLIVISION MENU"), menuOptions, 4, 0);

View File

@ -87,7 +87,7 @@ unsigned long bramSize = 0;
boolean realtec = 0;
#ifndef DEFAULT_VALUE_segaSram16bit
#define DEFAULT_VALUE_segaSram16bit 0
#define DEFAULT_VALUE_segaSram16bit 0
#endif
int segaSram16bit = DEFAULT_VALUE_segaSram16bit;
@ -185,7 +185,7 @@ void mdLoadConf() {
#endif
void pulse_clock(int n) {
for (int i=0; i<n; i++)
for (int i = 0; i < n; i++)
PORTH ^= (1 << 1);
}
@ -217,7 +217,6 @@ static const char* const menuOptionsSCD[] PROGMEM = { SCDMenuItem1, SCDMenuItem2
// Sega start menu
void mdMenu() {
setVoltage(VOLTS_SET_5V);
// create menu with title and 4 options to choose from
unsigned char mdDev;
// Copy menuOptions out of progmem
@ -464,6 +463,11 @@ void segaCDMenu() {
Setup
*****************************************/
void setup_MD() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 5V
setVoltage(VOLTS_SET_5V);
#endif
#ifdef use_md_conf
mdLoadConf();
#endif
@ -743,7 +747,7 @@ void getCartInfo_MD() {
}
//Identify games using SVP chip
if (!strncmp("GM MK-1229 ", id, 11) || !strncmp("GM G-7001 ", id, 11)) // Virtua Racing (E/U/J)
if (!strncmp("GM MK-1229 ", id, 11) || !strncmp("GM G-7001 ", id, 11)) // Virtua Racing (E/U/J)
isSVP = 1;
else
isSVP = 0;
@ -1449,7 +1453,7 @@ void readROM_MD() {
// Setting ASEL(PG5) LOW
PORTG &= ~(1 << 5);
// Pulse CLK(PH1)
if(isSVP)
if (isSVP)
pulse_clock(10);
// most MD ROMs are 200ns, comparable to SNES > use similar access delay of 6 x 62.5 = 375ns
@ -1473,7 +1477,7 @@ void readROM_MD() {
// Setting ASEL(PG5) HIGH
PORTG |= (1 << 5);
// Pulse CLK(PH1)
if(isSVP)
if (isSVP)
pulse_clock(10);
// Skip first 256 words
@ -1513,7 +1517,7 @@ void readROM_MD() {
// Setting ASEL(PG5) LOW
PORTG &= ~(1 << 5);
// Pulse CLK(PH1)
if(isSVP)
if (isSVP)
pulse_clock(10);
// most MD ROMs are 200ns, comparable to SNES > use similar access delay of 6 x 62.5 = 375ns
@ -1537,7 +1541,7 @@ void readROM_MD() {
// Setting ASEL(PG5) HIGH
PORTG |= (1 << 5);
// Pulse CLK(PH1)
if(isSVP)
if (isSVP)
pulse_clock(10);
// Skip first 256 words
@ -1578,7 +1582,7 @@ void readROM_MD() {
// Setting ASEL(PG5) LOW
PORTG &= ~(1 << 5);
// Pulse CLK(PH1)
if(isSVP)
if (isSVP)
PORTH ^= (1 << 1);
// most MD ROMs are 200ns, comparable to SNES > use similar access delay of 6 x 62.5 = 375ns
@ -1602,7 +1606,7 @@ void readROM_MD() {
// Setting ASEL(PG5) HIGH
PORTG |= (1 << 5);
// Pulse CLK(PH1)
if(isSVP)
if (isSVP)
PORTH ^= (1 << 1);
calcCKSSonic2 += ((buffer[d] << 8) | buffer[d + 1]);
@ -2081,12 +2085,12 @@ void busyCheck_MD() {
//******************************************
// EEPROM Functions
//******************************************
void EepromInit(byte eepmode) { // Acclaim Type 2
PORTF = 0x00; // ADDR A0-A7
PORTK = 0x00; // ADDR A8-A15
PORTL = 0x10; // ADDR A16-A23
PORTA = 0x00; // DATA D8-D15
PORTH |= (1 << 0); // /RES HIGH
void EepromInit(byte eepmode) { // Acclaim Type 2
PORTF = 0x00; // ADDR A0-A7
PORTK = 0x00; // ADDR A8-A15
PORTL = 0x10; // ADDR A16-A23
PORTA = 0x00; // DATA D8-D15
PORTH |= (1 << 0); // /RES HIGH
PORTC = eepmode; // EEPROM Switch: 0 = Enable (Read EEPROM), 1 = Disable (Read ROM)
PORTH &= ~(1 << 3); // CE LOW
PORTH &= ~(1 << 4) & ~(1 << 5); // /UDSW + /LDSW LOW

View File

@ -133,7 +133,6 @@ static const char msxMenuItem4[] PROGMEM = "Write SRAM";
static const char* const menuOptionsMSX[] PROGMEM = { msxMenuItem1, msxMenuItem2, msxMenuItem3, msxMenuItem4, string_reset2 };
void msxMenu() {
setVoltage(VOLTS_SET_5V);
convertPgm(menuOptionsMSX, 5);
uint8_t mainMenu = question_box(F("MSX MENU"), menuOptions, 5, 0);
@ -182,6 +181,11 @@ void msxMenu() {
// SETUP
//******************************************
void setup_MSX() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 5V
setVoltage(VOLTS_SET_5V);
#endif
// Set Address Pins to Output
// MSX uses A0-A15
//A0-A7

View File

@ -114,7 +114,6 @@ static const char* const sectorOptionsN64[] PROGMEM = { N64SectorItem1, N64Secto
// N64 start menu
void n64Menu() {
setVoltage(VOLTS_SET_3V3);
// create menu with title and 5 options to choose from
unsigned char n64Dev;
// Copy menuOptions out of progmem
@ -400,6 +399,11 @@ void n64CartMenu() {
Setup
*****************************************/
void setup_N64_Controller() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 3V
setVoltage(VOLTS_SET_3V3);
#endif
// Output a low signal
PORTH &= ~(1 << 4);
// Set Controller Data Pin(PH4) to Input
@ -407,6 +411,11 @@ void setup_N64_Controller() {
}
void setup_N64_Cart() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 3V
setVoltage(VOLTS_SET_3V3);
#endif
// Set Address Pins to Output and set them low
//A0-A7
DDRF = 0xFF;

View File

@ -211,11 +211,11 @@ byte mapcount = (sizeof(mapsize) / sizeof(mapsize[0])) / 7;
byte mapselect;
const int PRG[] PROGMEM = { 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 };
byte prglo = 0; // Lowest Entry
byte prglo = 0; // Lowest Entry
byte prghi = 11; // Highest Entry
const int CHR[] PROGMEM = { 0, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096 };
byte chrlo = 0; // Lowest Entry
byte chrlo = 0; // Lowest Entry
byte chrhi = 10; // Highest Entry
const byte RAM[] PROGMEM = { 0, 8, 16, 32 };
@ -273,7 +273,6 @@ static const char* const menuOptionsNESChips[] PROGMEM = { nesChipsMenuItem1, ne
// NES start menu
void nesMenu() {
setVoltage(VOLTS_SET_5V);
unsigned char answer;
// create menu with title "NES CART READER" and 7 options to choose from
@ -448,6 +447,11 @@ void nesChipMenu() {
Setup
*****************************************/
void setup_NES() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 5V
setVoltage(VOLTS_SET_5V);
#endif
// CPU R/W, IRQ, PPU /RD, PPU /A13, CIRAM /CE, PPU /WR, /ROMSEL, PHI2
DDRF = 0b10110111;
// CPU R/W, IRQ, PPU /RD, PPU /A13, CIRAM /CE, PPU /WR, /ROMSEL, PHI2
@ -2551,8 +2555,8 @@ void readPRG(bool readrom) {
}
break;
case 2: // bus conflicts - fixed last bank
case 30: // bus conflicts in non-flashable configuration
case 2: // bus conflicts - fixed last bank
case 30: // bus conflicts in non-flashable configuration
banks = int_pow(2, prgsize);
busConflict = true;
for (int i = 0; i < banks - 1; i++) {
@ -2827,7 +2831,7 @@ void readPRG(bool readrom) {
}
}
break;
case 34: // BxROM/NINA
banks = int_pow(2, prgsize) / 2;
for (int i = 0; i < banks; i++) {
@ -2894,7 +2898,7 @@ void readPRG(bool readrom) {
dumpPRG(base, address);
}
break;
case 38:
banks = int_pow(2, prgsize) / 2;
for (int i = 0; i < banks; i++) {
@ -3324,7 +3328,7 @@ void readPRG(bool readrom) {
}
}
break;
case 114: // Submapper 0
banks = int_pow(2, prgsize) * 2;
write_prg_byte(0x6000, 0);
@ -3385,7 +3389,7 @@ void readPRG(bool readrom) {
}
}
break;
case 148: // Sachen SA-008-A and Tengen 800008 -- Bus conflicts
banks = int_pow(2, prgsize) / 2;
busConflict = true;
@ -3770,7 +3774,7 @@ void readCHR(bool readrom) {
}
break;
case 3: // 8K/16K/32K - bus conflicts
case 3: // 8K/16K/32K - bus conflicts
banks = int_pow(2, chrsize) / 2;
for (int i = 0; i < banks; i++) {
for (int x = 0; x < 0x2000; x++) {
@ -4018,12 +4022,12 @@ void readCHR(bool readrom) {
}
}
break;
case 34: // NINA
banks = int_pow(2, chrsize);
for (int i = 0; i < banks; i += 2) {
write_prg_byte(0x7FFE, i); // Select 4 KB CHR bank at $0000
write_prg_byte(0x7FFF, i + 1); // Select 4 KB CHR bank at $1000
write_prg_byte(0x7FFE, i); // Select 4 KB CHR bank at $0000
write_prg_byte(0x7FFF, i + 1); // Select 4 KB CHR bank at $1000
for (word address = 0x0; address < 0x2000; address += 512) {
dumpCHR(address);
}
@ -4073,7 +4077,7 @@ void readCHR(bool readrom) {
}
}
break;
case 38:
banks = int_pow(2, chrsize) / 2;
for (int i = 0; i < banks; i++) {
@ -4206,7 +4210,7 @@ void readCHR(bool readrom) {
}
}
break;
case 66: // 16K/32K
case 70:
case 152: // 128K
@ -4449,7 +4453,7 @@ void readCHR(bool readrom) {
}
}
break;
case 114: // Submapper 0
banks = int_pow(2, chrsize) * 4;
for (int i = 0; i < banks; i++) {
@ -4502,7 +4506,7 @@ void readCHR(bool readrom) {
}
}
break;
case 148: // Sachen SA-008-A and Tengen 800008 -- Bus conflicts
banks = int_pow(2, chrsize);
busConflict = true;

View File

@ -21,6 +21,11 @@ uint8_t manufacturerID;
uint8_t deviceID;
void setup_NGP() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 3V
setVoltage(VOLTS_SET_3V3);
#endif
// A0 - A7
DDRF = 0xff;
// A8 - A15
@ -52,7 +57,6 @@ void setup_NGP() {
}
void ngpMenu() {
setVoltage(VOLTS_SET_3V3);
uint8_t mainMenu;
convertPgm(menuOptionsNGP, 4);

View File

@ -69,6 +69,11 @@ static const char ody2MenuItem4[] PROGMEM = "Reset";
static const char* const menuOptionsODY2[] PROGMEM = { ody2MenuItem1, ody2MenuItem2, ody2MenuItem3, ody2MenuItem4 };
void setup_ODY2() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 5V
setVoltage(VOLTS_SET_5V);
#endif
// Set Address Pins to Output
// Odyssey 2 uses A0-A13 [A14-A23 UNUSED]
//A0-A7
@ -110,7 +115,6 @@ void setup_ODY2() {
}
void ody2Menu() {
setVoltage(VOLTS_SET_5V);
convertPgm(menuOptionsODY2, 4);
uint8_t mainMenu = question_box(F("ODYSSEY 2 MENU"), menuOptions, 4, 0);

View File

@ -70,7 +70,6 @@ static const char *const menuOptionspceTC[] PROGMEM = { pceTCMenuItem1, string_r
// PCE start menu
void pcsMenu(void) {
setVoltage(VOLTS_SET_5V);
// create menu with title and 3 options to choose from
unsigned char pceDev;
// Copy menuOptions out of progmem
@ -171,6 +170,11 @@ void pin_init_PCE(void) {
}
void setup_cart_PCE(void) {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 5V
setVoltage(VOLTS_SET_5V);
#endif
// Set cicrstPin(PG1) to Output
DDRG |= (1 << 1);
// Output a high to disable CIC

View File

@ -101,6 +101,11 @@ byte bank1;
//******************************************
void setup_PCW() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 5V
setVoltage(VOLTS_SET_5V);
#endif
// Set Address Pins to Output
//A8-A15
DDRK = 0xFF;
@ -141,7 +146,6 @@ static const char pcwmenuItem3[] PROGMEM = "Write SRAM";
static const char* const menuOptionsPCW[] PROGMEM = { pcwmenuItem1, pcwmenuItem2, pcwmenuItem3, string_reset2 };
void pcwMenu() {
setVoltage(VOLTS_SET_5V);
convertPgm(menuOptionsPCW, 4);
uint8_t mainMenu = question_box(F(" POCKET CHALLENGE W"), menuOptions, 4, 0);
@ -629,7 +633,7 @@ uint32_t detect_rom_size_PCW(void) {
} else if (detect_2m == DETECTION_SIZE) {
rom_size = 0x200000;
} else {
rom_size = 0x400000;
rom_size = 0x400000;
}
return rom_size;

View File

@ -83,7 +83,6 @@ static const char pokeMenuItem1[] PROGMEM = "Read ROM";
static const char* const menuOptionsPOKE[] PROGMEM = { pokeMenuItem1, string_reset2 };
void pokeMenu() {
setVoltage(VOLTS_SET_3V3);
convertPgm(menuOptionsPOKE, 2);
uint8_t mainMenu = question_box(F("POKEMON MINI MENU"), menuOptions, 2, 0);
@ -106,6 +105,11 @@ void pokeMenu() {
// SETUP
//******************************************
void setup_POKE() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 3V
setVoltage(VOLTS_SET_3V3);
#endif
// Set Address Pins to Output
// Pokemon Mini uses A0-A9 (DUAL A10-A19) + A20 (CONNECT TO SNES A10) [A11-A23 UNUSED]
//A0-A7

View File

@ -50,7 +50,6 @@ static const char sfmGameMenuItem4[] PROGMEM = "Switch Game";
static const char* const menuOptionsSFMGame[] PROGMEM = { sfmGameMenuItem1, sfmGameMenuItem2, sfmGameMenuItem3, sfmGameMenuItem4, string_reset2 };
void sfmMenu() {
setVoltage(VOLTS_SET_5V);
// create menu with title and 3 options to choose from
unsigned char mainMenu;
// Copy menuOptions out of progmem
@ -525,6 +524,11 @@ void getGames(char gameCode[8][20], boolean* hasMenu, byte* numGames) {
Setup
*****************************************/
void setup_SFM() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 5V
setVoltage(VOLTS_SET_5V);
#endif
// Set cicrstPin(PG1) to Output
DDRG |= (1 << 1);
// Output a high signal to disable snesCIC

View File

@ -26,31 +26,30 @@ static const char SMSRomSizeItem1[] PROGMEM = "8 KB";
static const char SMSRomSizeItem2[] PROGMEM = "16 KB";
static const char SMSRomSizeItem3[] PROGMEM = "24 KB";
static const char SMSRomSizeItem4[] PROGMEM = "32 KB";
static const char SMSRomSizeItem5[] PROGMEM = "40 KB"; //SG-1000 40k mapping not yet supported
static const char SMSRomSizeItem6[] PROGMEM = "48 KB"; //SG-1000 40k mapping not yet supported
static const char SMSRomSizeItem5[] PROGMEM = "40 KB"; //SG-1000 40k mapping not yet supported
static const char SMSRomSizeItem6[] PROGMEM = "48 KB"; //SG-1000 40k mapping not yet supported
static const char SMSRomSizeItem7[] PROGMEM = "64 KB";
static const char SMSRomSizeItem8[] PROGMEM = "128 KB";
static const char SMSRomSizeItem9[] PROGMEM = "256 KB";
static const char SMSRomSizeItem10[] PROGMEM = "512 KB";
static const char SMSRomSizeItem11[] PROGMEM = "1024 KB";
static const char* const SG1RomSizeMenu[] PROGMEM = { SMSRomSizeItem1, SMSRomSizeItem2, SMSRomSizeItem3, SMSRomSizeItem4}; // Rom sizes for SG-1000
static const char* const SMSRomSizeMenu[] PROGMEM = { SMSRomSizeItem4, SMSRomSizeItem7, SMSRomSizeItem8, SMSRomSizeItem9, SMSRomSizeItem10, SMSRomSizeItem11}; // Rom sizes for SMS and GG
static const char* const SG1RomSizeMenu[] PROGMEM = { SMSRomSizeItem1, SMSRomSizeItem2, SMSRomSizeItem3, SMSRomSizeItem4 }; // Rom sizes for SG-1000
static const char* const SMSRomSizeMenu[] PROGMEM = { SMSRomSizeItem4, SMSRomSizeItem7, SMSRomSizeItem8, SMSRomSizeItem9, SMSRomSizeItem10, SMSRomSizeItem11 }; // Rom sizes for SMS and GG
// Init systems
static bool system_sms = false; // SMS or MarkIII
static bool system_gg = false; // GameGear
static bool system_sg1000 = false; // SG-1000
static bool system_sms = false; // SMS or MarkIII
static bool system_gg = false; // GameGear
static bool system_sg1000 = false; // SG-1000
// Init adapters
static bool adapter_raphnet = false; // raphet adapater (SMS-to-MD or MIII-to-MD)
static bool adapter_retrode = false; // Retrode adapter (SMS-to-MD or GG-to-MD)
static bool adapter_retron = false; // Retron 3in1 adapter (SMS-to-MD or GG-to-MD)
static bool adapter_raphnet = false; // raphet adapater (SMS-to-MD or MIII-to-MD)
static bool adapter_retrode = false; // Retrode adapter (SMS-to-MD or GG-to-MD)
static bool adapter_retron = false; // Retron 3in1 adapter (SMS-to-MD or GG-to-MD)
//*********************************************************
// Main menu with systems/adapters setups to choose from
//*********************************************************
void smsMenu() {
setVoltage(VOLTS_SET_5V);
unsigned char SMSSetup;
convertPgm(SMSAdapterMenu, 6);
SMSSetup = question_box(F("Select your setup"), menuOptions, 6, 0);
@ -62,7 +61,7 @@ void smsMenu() {
adapter_raphnet = true;
break;
case 1:
case 1:
// SMS with Retrode adapter
system_sms = true;
adapter_retrode = true;
@ -156,6 +155,11 @@ void smsOperations() {
// Setup I/O
//********************************
void setup_SMS() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 5V
setVoltage(VOLTS_SET_5V);
#endif
// Set Address Pins to Output
//A0-A7
DDRF = 0xFF;
@ -178,7 +182,7 @@ void setup_SMS() {
PORTH |= (1 << 6);
// Setting WR(PL5) and RD(PL6) HIGH
PORTL |= (1 << 5) | (1 << 6);
}
}
// For Raphnet and Retron adapters
else {
@ -215,7 +219,7 @@ void setup_SMS() {
}
//*****************************************
// Low level functions
// Low level functions
//*****************************************
void writeByte_SMS(word myAddress, byte myData) {
if (adapter_retrode && system_gg) {
@ -354,7 +358,7 @@ byte readNibble(byte data, byte number) {
//*****************************************
// Cartridges functions
//*****************************************
void getCartInfo_SMS() {
void getCartInfo_SMS() {
// Get rom size
switch (readNibble(readByte_SMS(0x7FFF), 0)) {
// Adding UL gets rid of integer overflow compiler warning
@ -450,7 +454,7 @@ void getCartInfo_SMS() {
}
// If "TMR SEGA" header is not found
if (strcmp(romName, "TMR SEGA") != 0) {
if (strcmp(romName, "TMR SEGA") != 0) {
// Set rom size manually
unsigned char SMSRomSize;
@ -460,23 +464,23 @@ void getCartInfo_SMS() {
SMSRomSize = question_box(F("Select ROM size"), menuOptions, 4, 0);
switch (SMSRomSize) {
case 0:
cartSize = 8 * 1024UL; // 8KB
cartSize = 8 * 1024UL; // 8KB
break;
case 1:
cartSize = 16 * 1024UL; // 16KB
cartSize = 16 * 1024UL; // 16KB
break;
case 2:
cartSize = 24 * 1024UL; // 24KB
cartSize = 24 * 1024UL; // 24KB
break;
case 3:
cartSize = 32 * 1024UL; // 32KB
cartSize = 32 * 1024UL; // 32KB
break;
//case 4:
// cartSize = 40 * 1024UL; // 40KB
// break;
//case 5:
// cartSize = 48 * 1024UL; // 48KB
// break;
//case 4:
// cartSize = 40 * 1024UL; // 40KB
// break;
//case 5:
// cartSize = 48 * 1024UL; // 48KB
// break;
}
} else {
// Rom sizes for SMS and GG
@ -484,22 +488,22 @@ void getCartInfo_SMS() {
SMSRomSize = question_box(F("Select ROM size"), menuOptions, 6, 0);
switch (SMSRomSize) {
case 0:
cartSize = 32 * 1024UL; // 32KB
cartSize = 32 * 1024UL; // 32KB
break;
case 1:
cartSize = 64 * 1024UL; // 64KB
cartSize = 64 * 1024UL; // 64KB
break;
case 2:
cartSize = 128 * 1024UL; // 128KB
cartSize = 128 * 1024UL; // 128KB
break;
case 3:
cartSize = 256 * 1024UL; // 256KB
cartSize = 256 * 1024UL; // 256KB
break;
case 4:
cartSize = 512 * 1024UL; // 512KB
cartSize = 512 * 1024UL; // 512KB
break;
case 5:
cartSize = 1024 * 1024UL; // 1MB
cartSize = 1024 * 1024UL; // 1MB
break;
}
}
@ -534,13 +538,13 @@ void getCartInfo_SMS() {
println_Msg(F(" "));
}
// Wait for user input
#if (defined(enable_LCD) || defined(enable_OLED))
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
#endif
// Wait for user input
#if (defined(enable_LCD) || defined(enable_OLED))
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
#endif
// Turn off LED
setColor_RGB(0, 0, 0);
@ -647,9 +651,9 @@ void readROM_SMS() {
compareCRC("sg1000.txt", 0, 1, 0);
}
#ifdef global_log
save_log();
#endif
#ifdef global_log
save_log();
#endif
print_STR(press_button_STR, 1);
}
@ -709,7 +713,7 @@ void readSRAM_SMS() {
print_STR(press_button_STR, 1);
display_Update();
} else {
print_FatalError(sd_error_STR);
print_FatalError(sd_error_STR);
}
}

View File

@ -70,7 +70,6 @@ static const char* const menuOptionsRepro[] PROGMEM = { reproMenuItem1, reproMen
// SNES repro menu
void reproMenu() {
setVoltage(VOLTS_SET_5V);
// create menu with title and 6 options to choose from
unsigned char snsRepro;
// Copy menuOptions out of progmem
@ -133,7 +132,6 @@ void reproMenu() {
// SNES start menu
void snsMenu() {
setVoltage(VOLTS_SET_5V);
// create menu with title and 6 options to choose from
unsigned char snsCart;
// Copy menuOptions out of progmem
@ -192,7 +190,6 @@ void snsMenu() {
// SNES Menu
void snesMenu() {
setVoltage(VOLTS_SET_5V);
// create menu with title and 7 options to choose from
unsigned char mainMenu;
// Copy menuOptions out of progmem
@ -388,6 +385,11 @@ void stopSnesClocks_resetCic_resetCart() {
Setup
*****************************************/
void setup_Snes() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 5V
setVoltage(VOLTS_SET_5V);
#endif
// Set cicrstPin(PG1) to Output
DDRG |= (1 << 1);
// Output a high signal until we're ready to start

View File

@ -17,7 +17,10 @@ static const char acanMenuItem6[] PROGMEM = "Flash repro";
static const char *const menuOptionsAcan[] PROGMEM = { acanMenuItem1, acanMenuItem2, acanMenuItem3, acanMenuItem4, acanMenuItem5, string_reset2, acanMenuItem6 };
void setup_SuprAcan() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 5V
setVoltage(VOLTS_SET_5V);
#endif
// addr as output
DDRF = 0xff; // A0 - A7

View File

@ -42,7 +42,6 @@ static const char* const menuOptionsSVFlash[] PROGMEM = { svFlashMenuItem1, svFl
void svMenu() {
setVoltage(VOLTS_SET_5V);
// create menu with title and 3 options to choose from
unsigned char mainMenu;
// Copy menuOptions out of progmem
@ -102,6 +101,11 @@ void svMenu() {
Setup
*****************************************/
void setup_SV() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 5V
setVoltage(VOLTS_SET_5V);
#endif
// Set cicrstPin(PG1) to Output
DDRG |= (1 << 1);
// Output a high signal until we're ready to start

View File

@ -56,6 +56,11 @@
//******************************************
void setup_VBOY() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 5V
setVoltage(VOLTS_SET_5V);
#endif
// Set Address Pins to Output
//A0-A7
DDRF = 0xFF;
@ -101,7 +106,6 @@ static const char vboyMenuItem3[] PROGMEM = "Write SRAM";
static const char* const menuOptionsVBOY[] PROGMEM = { vboyMenuItem1, vboyMenuItem2, vboyMenuItem3, string_reset2 };
void vboyMenu() {
setVoltage(VOLTS_SET_5V);
convertPgm(menuOptionsVBOY, 4);
uint8_t mainMenu = question_box(F("VIRTUALBOY MENU"), menuOptions, 4, 0);

View File

@ -46,6 +46,11 @@ static uint8_t wsEepromShiftReg[2];
static boolean wsWitch = false;
void setup_WS() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 3V
setVoltage(VOLTS_SET_3V3);
#endif
// A-1 - A6
DDRF = 0xff;
// A7 - A14
@ -117,7 +122,6 @@ static boolean headerCheck() {
}
void wsMenu() {
setVoltage(VOLTS_SET_3V3);
uint8_t mainMenu = (wsWitch ? 5 : 4);
convertPgm(menuOptionsWS, mainMenu);

View File

@ -53,6 +53,11 @@ byte newwsvsize;
//******************************************
void setup_WSV() {
#ifdef ENABLE_VSELECT
// Set Automatic Voltage Selection to 3V
setVoltage(VOLTS_SET_3V3);
#endif
// Set Address Pins to Output
//A0-A7
DDRF = 0xFF;
@ -106,7 +111,6 @@ static const char wsvMenuItem3[] PROGMEM = "Set Size";
static const char* const menuOptionsSV[] PROGMEM = { wsvMenuItem1, wsvMenuItem2, wsvMenuItem3, string_reset2 };
void wsvMenu() {
setVoltage(VOLTS_SET_3V3);
convertPgm(menuOptionsSV, 4);
uint8_t mainMenu = question_box(F("SUPERVISION MENU"), menuOptions, 4, 0);