Compare commits

...

4 Commits

21 changed files with 3009 additions and 1954 deletions

View File

@ -554,15 +554,7 @@ void readROM_2600() {
} }
myFile.close(); myFile.close();
unsigned long crcsize = a2600[a2600size] * 0x400; printCRC(fileName, NULL, 0);
// Correct E7 Size for 8K/12K ROMs
if (a2600mapper == 0xE7) {
if (e7size == 0)
crcsize = a2600[a2600size] * 0x200;
else if (e7size == 1)
crcsize = a2600[a2600size] * 0x300;
}
calcCRC(fileName, crcsize, NULL, 0);
println_Msg(FS(FSTRING_EMPTY)); println_Msg(FS(FSTRING_EMPTY));
print_STR(press_button_STR, 1); print_STR(press_button_STR, 1);
@ -826,7 +818,7 @@ void setCart_2600() {
} }
} }
} else { } else {
print_FatalError(F("Database file not found")); print_FatalError(FS(FSTRING_DATABASE_FILE_NOT_FOUND));
} }
} }
#endif #endif

View File

@ -327,8 +327,7 @@ void readROM_5200() {
} }
myFile.close(); myFile.close();
unsigned long crcsize = a5200[a5200size] * 0x400; printCRC(fileName, NULL, 0);
calcCRC(fileName, crcsize, NULL, 0);
println_Msg(FS(FSTRING_EMPTY)); println_Msg(FS(FSTRING_EMPTY));
// Prints string out of the common strings array either with or without newline // Prints string out of the common strings array either with or without newline
@ -668,7 +667,7 @@ void setCart_5200() {
EEPROM_writeAnything(8, entry.gameSize); EEPROM_writeAnything(8, entry.gameSize);
} }
} else { } else {
print_FatalError(F("Database file not found")); print_FatalError(FS(FSTRING_DATABASE_FILE_NOT_FOUND));
} }
} }
#endif #endif

View File

@ -424,8 +424,7 @@ void readROM_7800() {
} }
myFile.close(); myFile.close();
unsigned long crcsize = a7800[a7800size] * 0x400; printCRC(fileName, NULL, 0);
calcCRC(fileName, crcsize, NULL, 0);
println_Msg(FS(FSTRING_EMPTY)); println_Msg(FS(FSTRING_EMPTY));
// Prints string out of the common strings array either with or without newline // Prints string out of the common strings array either with or without newline
@ -818,7 +817,7 @@ void setCart_7800() {
EEPROM_writeAnything(8, entry.gameSize); EEPROM_writeAnything(8, entry.gameSize);
} }
} else { } else {
print_FatalError(F("Database file not found")); print_FatalError(FS(FSTRING_DATABASE_FILE_NOT_FOUND));
} }
} }
#endif #endif

View File

@ -186,8 +186,7 @@ void readROM_ARC() {
} }
myFile.close(); myFile.close();
unsigned long crcsize = ARC[arcsize] * 0x400; printCRC(fileName, NULL, 0);
calcCRC(fileName, crcsize, NULL, 0);
println_Msg(FS(FSTRING_EMPTY)); println_Msg(FS(FSTRING_EMPTY));
print_STR(press_button_STR, 1); print_STR(press_button_STR, 1);
@ -360,7 +359,7 @@ void setCart_ARC() {
EEPROM_writeAnything(8, gameSize); EEPROM_writeAnything(8, gameSize);
} }
} else { } else {
print_FatalError(F("Database file not found")); print_FatalError(FS(FSTRING_DATABASE_FILE_NOT_FOUND));
} }
} }
#endif #endif

View File

@ -640,8 +640,7 @@ void readROM_C64() {
} }
myFile.close(); myFile.close();
unsigned long crcsize = C64[c64size] * 0x400; printCRC(fileName, NULL, 0);
calcCRC(fileName, crcsize, NULL, 0);
println_Msg(FS(FSTRING_EMPTY)); println_Msg(FS(FSTRING_EMPTY));
// Prints string out of the common strings array either with or without newline // Prints string out of the common strings array either with or without newline
@ -1066,7 +1065,7 @@ void setCart_C64() {
EEPROM_writeAnything(8, entry.gameSize); EEPROM_writeAnything(8, entry.gameSize);
} }
} else { } else {
print_FatalError(F("Database file not found")); print_FatalError(FS(FSTRING_DATABASE_FILE_NOT_FOUND));
} }
} }
#endif #endif

View File

@ -448,7 +448,7 @@ void setCart_COL() {
EEPROM_writeAnything(8, colsize); EEPROM_writeAnything(8, colsize);
} }
} else { } else {
print_FatalError(F("Database file not found")); print_FatalError(FS(FSTRING_DATABASE_FILE_NOT_FOUND));
} }
} }
#endif #endif

View File

@ -455,43 +455,22 @@ uint32_t calculateCRC(char* fileName, char* folder, int offset) {
/****************************************** /******************************************
CRC Functions for Atari, Fairchild, Ody2, Arc, etc. modules CRC Functions for Atari, Fairchild, Ody2, Arc, etc. modules
*****************************************/ *****************************************/
#if (defined(ENABLE_ODY2) || defined(ENABLE_ARC) || defined(ENABLE_FAIRCHILD) || defined(ENABLE_MSX) || defined(ENABLE_POKE) || defined(ENABLE_2600) || defined(ENABLE_5200) || defined(ENABLE_7800) || defined(ENABLE_C64) || defined(ENABLE_VECTREX)) #if (defined(ENABLE_ODY2) || defined(ENABLE_ARC) || defined(ENABLE_FAIRCHILD) || defined(ENABLE_MSX) || defined(ENABLE_POKE) || defined(ENABLE_2600) || defined(ENABLE_5200) || defined(ENABLE_7800) || defined(ENABLE_C64) || defined(ENABLE_VECTREX) || defined(ENABLE_NES))
inline uint32_t updateCRC(uint8_t ch, uint32_t crc) { void printCRC(char* checkFile, uint32_t* crcCopy, unsigned long offset) {
uint32_t idx = ((crc) ^ (ch)) & 0xff;
uint32_t tab_value = pgm_read_dword(crc_32_tab + idx);
return tab_value ^ ((crc) >> 8);
}
FsFile crcFile;
char tempCRC[9];
uint32_t crc32(FsFile& file, uint32_t& charcnt) {
uint32_t oldcrc32 = 0xFFFFFFFF;
charcnt = 0;
while (file.available()) {
crcFile.read(sdBuffer, 512);
for (int x = 0; x < 512; x++) {
uint8_t c = sdBuffer[x];
charcnt++;
oldcrc32 = updateCRC(c, oldcrc32);
}
}
return ~oldcrc32;
}
void calcCRC(char* checkFile, unsigned long filesize, uint32_t* crcCopy, unsigned long offset) {
uint32_t crc; uint32_t crc;
crcFile = sd.open(checkFile); char tempCRC[9];
FsFile crcFile = sd.open(checkFile);
crcFile.seek(offset); crcFile.seek(offset);
crc = crc32(crcFile, filesize); crc = calculateCRC(crcFile);
crcFile.close(); crcFile.close();
sprintf(tempCRC, "%08lX", crc);
if (crcCopy != NULL) { if (crcCopy != NULL) {
*crcCopy = crc; *crcCopy = crc;
} }
sprintf(tempCRC, "%08lX", crc);
print_Msg(F("CRC: ")); print_Msg(F("CRC: "));
println_Msg(tempCRC); println_Msg(tempCRC);
display_Update(); display_Update();

View File

@ -70,7 +70,6 @@ byte fairchildlo = 0; // Lowest Entry
byte fairchildhi = 3; // Highest Entry byte fairchildhi = 3; // Highest Entry
byte fairchildsize; byte fairchildsize;
byte newfairchildsize;
// EEPROM MAPPING // EEPROM MAPPING
// 08 ROM SIZE // 08 ROM SIZE
@ -472,7 +471,7 @@ void readROM_FAIRCHILD() {
} }
myFile.close(); myFile.close();
calcCRC(fileName, cartsize, NULL, 0); printCRC(fileName, NULL, 0);
println_Msg(FS(FSTRING_EMPTY)); println_Msg(FS(FSTRING_EMPTY));
print_STR(press_button_STR, 1); print_STR(press_button_STR, 1);
@ -527,7 +526,7 @@ void read16K_FAIRCHILD() // Read 16K Bytes
} }
myFile.close(); myFile.close();
calcCRC(fileName, 0x4000, NULL, 0); printCRC(fileName, NULL, 0);
println_Msg(FS(FSTRING_EMPTY)); println_Msg(FS(FSTRING_EMPTY));
print_STR(press_button_STR, 1); print_STR(press_button_STR, 1);
@ -540,6 +539,7 @@ void read16K_FAIRCHILD() // Read 16K Bytes
//****************************************** //******************************************
void setROMSize_FAIRCHILD() { void setROMSize_FAIRCHILD() {
byte newfairchildsize;
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD)) #if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear(); display_Clear();
if (fairchildlo == fairchildhi) if (fairchildlo == fairchildhi)
@ -672,239 +672,33 @@ void checkStatus_FAIRCHILD() {
//****************************************** //******************************************
// CART SELECT CODE // CART SELECT CODE
//****************************************** //******************************************
void readDataLine_FAIRCHILD(FsFile& database, byte* gameSize) {
// Read rom size
(*gameSize) = database.read() - 48;
FsFile fairchildcsvFile; // Skip rest of line
char fairchildgame[33]; // title database.seekCur(2);
char fairchildrr[3]; // romsize
char fairchildll[4]; // linelength (previous line)
unsigned long fairchildcsvpos; // CSV File Position
char fairchildcartCSV[] = "fairchildcart.txt"; // CSV List
char fairchildcsvEND[] = "EOF"; // CSV End Marker for scrolling
bool readLine_FAIRCHILD(FsFile& f, char* line, size_t maxLen) {
for (size_t n = 0; n < maxLen; n++) {
int c = f.read();
if (c < 0 && n == 0) return false; // EOF
if (c < 0 || c == '\n') {
line[n] = 0;
return true;
}
line[n] = c;
}
return false; // line too long
}
bool readVals_FAIRCHILD(char* fairchildgame, char* fairchildrr, char* fairchildll) {
char line[39];
fairchildcsvpos = fairchildcsvFile.position();
if (!readLine_FAIRCHILD(fairchildcsvFile, line, sizeof(line))) {
return false; // EOF or too long
}
char* comma = strtok(line, ",");
int x = 0;
while (comma != NULL) {
if (x == 0)
strcpy(fairchildgame, comma);
else if (x == 1)
strcpy(fairchildrr, comma);
else if (x == 2)
strcpy(fairchildll, comma);
comma = strtok(NULL, ",");
x += 1;
}
return true;
}
bool getCartListInfo_FAIRCHILD() {
bool buttonreleased = 0;
bool cartselected = 0;
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear();
println_Msg(F(" HOLD TO FAST CYCLE"));
display_Update();
#else
Serial.println(F("HOLD BUTTON TO FAST CYCLE"));
#endif
delay(2000);
#if defined(ENABLE_OLED)
buttonVal1 = (PIND & (1 << 7)); // PD7
#elif defined(ENABLE_LCD)
boolean buttonVal1 = (PING & (1 << 2)); //PG2
#endif
if (buttonVal1 == LOW) { // Button Held - Fast Cycle
while (1) { // Scroll Game List
while (readVals_FAIRCHILD(fairchildgame, fairchildrr, fairchildll)) {
if (strcmp(fairchildcsvEND, fairchildgame) == 0) {
fairchildcsvFile.seek(0); // Restart
} else {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear();
println_Msg(F("CART TITLE:"));
println_Msg(FS(FSTRING_EMPTY));
println_Msg(fairchildgame);
display_Update();
#else
Serial.print(F("CART TITLE:"));
Serial.println(fairchildgame);
#endif
#if defined(ENABLE_OLED)
buttonVal1 = (PIND & (1 << 7)); // PD7
#elif defined(ENABLE_LCD)
buttonVal1 = (PING & (1 << 2)); //PG2
#endif
if (buttonVal1 == HIGH) { // Button Released
buttonreleased = 1;
break;
}
if (buttonreleased) {
buttonreleased = 0; // Reset Flag
break;
}
}
}
#if defined(ENABLE_OLED)
buttonVal1 = (PIND & (1 << 7)); // PD7
#elif defined(ENABLE_LCD)
buttonVal1 = (PING & (1 << 2)); //PG2
#endif
if (buttonVal1 == HIGH) // Button Released
break;
}
}
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display.setCursor(0, 56);
println_Msg(F("FAST CYCLE OFF"));
display_Update();
#else
Serial.println(FS(FSTRING_EMPTY));
Serial.println(F("FAST CYCLE OFF"));
Serial.println(F("PRESS BUTTON TO STEP FORWARD"));
Serial.println(F("DOUBLE CLICK TO STEP BACK"));
Serial.println(F("HOLD TO SELECT"));
Serial.println(FS(FSTRING_EMPTY));
#endif
while (readVals_FAIRCHILD(fairchildgame, fairchildrr, fairchildll)) {
if (strcmp(fairchildcsvEND, fairchildgame) == 0) {
fairchildcsvFile.seek(0); // Restart
} else {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear();
println_Msg(F("CART TITLE:"));
println_Msg(FS(FSTRING_EMPTY));
println_Msg(fairchildgame);
display.setCursor(0, 48);
#if defined(ENABLE_OLED)
print_STR(press_to_change_STR, 1);
print_STR(right_to_select_STR, 1);
#elif defined(ENABLE_LCD)
print_STR(rotate_to_change_STR, 1);
print_STR(press_to_select_STR, 1);
#endif
display_Update();
#else
Serial.print(F("CART TITLE:"));
Serial.println(fairchildgame);
#endif
while (1) { // Single Step
uint8_t b = checkButton();
if (b == 1) { // Continue (press)
break;
}
if (b == 2) { // Reset to Start of List (doubleclick)
byte prevline = strtol(fairchildll, NULL, 10);
fairchildcsvpos -= prevline;
fairchildcsvFile.seek(fairchildcsvpos);
break;
}
if (b == 3) { // Long Press - Select Cart (hold)
newfairchildsize = strtol(fairchildrr, NULL, 10);
EEPROM_writeAnything(8, newfairchildsize);
cartselected = 1; // SELECTION MADE
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
println_Msg(F("SELECTION MADE"));
display_Update();
#else
Serial.println(F("SELECTION MADE"));
#endif
break;
}
}
if (cartselected) {
cartselected = 0; // Reset Flag
return true;
}
}
}
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
println_Msg(FS(FSTRING_EMPTY));
println_Msg(FS(FSTRING_END_OF_FILE));
display_Update();
#else
Serial.println(FS(FSTRING_END_OF_FILE));
#endif
return false;
}
void checkCSV_FAIRCHILD() {
if (getCartListInfo_FAIRCHILD()) {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear();
println_Msg(FS(FSTRING_CART_SELECTED));
println_Msg(FS(FSTRING_EMPTY));
println_Msg(fairchildgame);
display_Update();
// Display Settings
display.setCursor(0, 56);
print_Msg(F("CODE: R"));
println_Msg(newfairchildsize);
display_Update();
#else
Serial.println(FS(FSTRING_EMPTY));
Serial.println(FS(FSTRING_CART_SELECTED));
Serial.println(fairchildgame);
// Display Settings
Serial.print(F("CODE: R"));
Serial.println(newfairchildsize);
Serial.println(FS(FSTRING_EMPTY));
#endif
} else {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display.setCursor(0, 56);
println_Msg(FS(FSTRING_NO_SELECTION));
display_Update();
#else
Serial.println(FS(FSTRING_NO_SELECTION));
#endif
}
} }
void setCart_FAIRCHILD() { void setCart_FAIRCHILD() {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD)) //go to root
display_Clear();
println_Msg(fairchildcartCSV);
display_Update();
#endif
sd.chdir(); sd.chdir();
sprintf(folder, "FAIRCHILD/CSV");
sd.chdir(folder); // Switch Folder
fairchildcsvFile = sd.open(fairchildcartCSV, O_READ);
if (!fairchildcsvFile) {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear();
println_Msg(F("CSV FILE NOT FOUND!"));
display_Update();
#else
Serial.println(F("CSV FILE NOT FOUND!"));
#endif
while (1) {
if (checkButton() != 0)
setup_FAIRCHILD();
}
}
checkCSV_FAIRCHILD();
fairchildcsvFile.close(); byte gameSize;
// Select starting letter
//byte myLetter = starting_letter();
// Open database
if (myFile.open("fairchildcart.txt", O_READ)) {
// seek_first_letter_in_database(myFile, myLetter);
if(checkCartSelection(myFile, &readDataLine_ARC, &gameSize)) {
EEPROM_writeAnything(8, gameSize);
}
} else {
print_FatalError(FS(FSTRING_DATABASE_FILE_NOT_FOUND));
}
} }
#endif #endif
//****************************************** //******************************************

View File

@ -857,7 +857,7 @@ void setCart_INTV() {
EEPROM_writeAnything(8, intvsize); EEPROM_writeAnything(8, intvsize);
} }
} else { } else {
print_FatalError(F("Database file not found")); print_FatalError(FS(FSTRING_DATABASE_FILE_NOT_FOUND));
} }
} }
#endif #endif

View File

@ -105,11 +105,8 @@ byte msxmapselect;
int msxindex; int msxindex;
byte msxmapper; byte msxmapper;
byte newmsxmapper;
byte msxsize; byte msxsize;
byte newmsxsize;
byte msxramsize; byte msxramsize;
byte newmsxramsize;
uint8_t msxbanks; uint8_t msxbanks;
byte chipselect; byte chipselect;
@ -139,7 +136,6 @@ void msxMenu() {
case 0: case 0:
// Select Cart // Select Cart
setCart_MSX(); setCart_MSX();
wait();
setup_MSX(); setup_MSX();
break; break;
@ -559,8 +555,7 @@ void readROM_MSX() {
} }
myFile.close(); myFile.close();
unsigned long crcsize = MSX[msxsize] * 0x400; printCRC(fileName, NULL, 0);
calcCRC(fileName, crcsize, NULL, 0);
println_Msg(FS(FSTRING_EMPTY)); println_Msg(FS(FSTRING_EMPTY));
// Prints string out of the common strings array either with or without newline // Prints string out of the common strings array either with or without newline
@ -719,8 +714,7 @@ void readRAM_MSX() {
} }
myFile.close(); myFile.close();
unsigned long crcsize = MSX[msxramsize] * 0x400; printCRC(fileName, NULL, 0);
calcCRC(fileName, crcsize, NULL, 0);
println_Msg(FS(FSTRING_EMPTY)); println_Msg(FS(FSTRING_EMPTY));
// Prints string out of the common strings array either with or without newline // Prints string out of the common strings array either with or without newline
@ -862,6 +856,7 @@ void writeRAM_MSX() {
// MAPPER CODE // MAPPER CODE
//****************************************** //******************************************
void setMapper_MSX() { void setMapper_MSX() {
byte newmsxmapper;
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD)) #if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
uint8_t b = 0; uint8_t b = 0;
int i = 0; int i = 0;
@ -1021,6 +1016,7 @@ void checkMapperSize_MSX() {
// SET ROM SIZE // SET ROM SIZE
//****************************************** //******************************************
void setROMSize_MSX() { void setROMSize_MSX() {
byte newmsxsize;
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD)) #if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear(); display_Clear();
if (msxlo == msxhi) if (msxlo == msxhi)
@ -1162,6 +1158,7 @@ setrom:
// SET RAM SIZE // SET RAM SIZE
//****************************************** //******************************************
void setRAMSize_MSX() { void setRAMSize_MSX() {
byte newmsxramsize;
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD)) #if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear(); display_Clear();
if (msxramlo == msxramhi) if (msxramlo == msxramhi)
@ -1412,255 +1409,52 @@ void printMapper(byte msxmaplabel) {
//****************************************** //******************************************
// CART SELECT CODE // CART SELECT CODE
//****************************************** //******************************************
FsFile msxcsvFile; struct database_entry_MSX {
char msxgame[31]; // title byte gameMapper;
char msxmm[3]; // mapper byte gameSize;
char msxrr[3]; // romsize byte ramSize;
char msxss[3]; // ramsize };
char msxll[4]; // linelength (previous line)
unsigned long msxcsvpos; // CSV File Position
char msxcartCSV[] = "msxcart.txt"; // CSV List
char msxcsvEND[] = "EOF"; // CSV End Marker for scrolling
bool readLine_MSX(FsFile& f, char* line, size_t maxLen) { void readDataLine_MSX(FsFile& database, struct database_entry_MSX* entry) {
for (size_t n = 0; n < maxLen; n++) { // Read mapper
int c = f.read(); entry->gameMapper = ((database.read() - 48) * 10) + (database.read() - 48);
if (c < 0 && n == 0) return false; // EOF
if (c < 0 || c == '\n') {
line[n] = 0;
return true;
}
line[n] = c;
}
return false; // line too long
}
bool readVals_MSX(char* msxgame, char* msxmm, char* msxrr, char* msxss, char* msxll) { // Skip over semicolon
char line[41]; database.seekCur(1);
msxcsvpos = msxcsvFile.position();
if (!readLine_MSX(msxcsvFile, line, sizeof(line))) {
return false; // EOF or too long
}
char* comma = strtok(line, ",");
int x = 0;
while (comma != NULL) {
if (x == 0)
strcpy(msxgame, comma);
else if (x == 1)
strcpy(msxmm, comma);
else if (x == 2)
strcpy(msxrr, comma);
else if (x == 3)
strcpy(msxss, comma);
else if (x == 4)
strcpy(msxll, comma);
comma = strtok(NULL, ",");
x += 1;
}
return true;
}
bool getCartListInfo_MSX() { // Read rom size
bool buttonreleased = 0; entry->gameSize = database.read() - 48;
bool cartselected = 0;
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear();
println_Msg(F(" HOLD TO FAST CYCLE"));
display_Update();
#else
Serial.println(F("HOLD BUTTON TO FAST CYCLE"));
#endif
delay(2000);
#if defined(ENABLE_OLED)
buttonVal1 = (PIND & (1 << 7)); // PD7
#elif defined(ENABLE_LCD)
boolean buttonVal1 = (PING & (1 << 2)); //PG2
#endif
if (buttonVal1 == LOW) { // Button Held - Fast Cycle
while (1) { // Scroll Game List
while (readVals_MSX(msxgame, msxmm, msxrr, msxss, msxll)) {
if (strcmp(msxcsvEND, msxgame) == 0) {
msxcsvFile.seek(0); // Restart
} else {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear();
println_Msg(F("CART TITLE:"));
println_Msg(FS(FSTRING_EMPTY));
println_Msg(msxgame);
display_Update();
#else
Serial.print(F("CART TITLE:"));
Serial.println(msxgame);
#endif
#if defined(ENABLE_OLED)
buttonVal1 = (PIND & (1 << 7)); // PD7
#elif defined(ENABLE_LCD)
buttonVal1 = (PING & (1 << 2)); //PG2
#endif
if (buttonVal1 == HIGH) { // Button Released
buttonreleased = 1;
break;
}
if (buttonreleased) {
buttonreleased = 0; // Reset Flag
break;
}
}
}
#if defined(ENABLE_OLED)
buttonVal1 = (PIND & (1 << 7)); // PD7
#elif defined(ENABLE_LCD)
buttonVal1 = (PING & (1 << 2)); //PG2
#endif
if (buttonVal1 == HIGH) // Button Released
break;
}
}
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display.setCursor(0, 56);
println_Msg(F("FAST CYCLE OFF"));
display_Update();
#else
Serial.println(FS(FSTRING_EMPTY));
Serial.println(F("FAST CYCLE OFF"));
Serial.println(F("PRESS BUTTON TO STEP FORWARD"));
Serial.println(F("DOUBLE CLICK TO STEP BACK"));
Serial.println(F("HOLD TO SELECT"));
Serial.println(FS(FSTRING_EMPTY));
#endif
while (readVals_MSX(msxgame, msxmm, msxrr, msxss, msxll)) {
if (strcmp(msxcsvEND, msxgame) == 0) {
msxcsvFile.seek(0); // Restart
} else {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear();
println_Msg(F("CART TITLE:"));
println_Msg(FS(FSTRING_EMPTY));
println_Msg(msxgame);
display.setCursor(0, 48);
#if defined(ENABLE_OLED)
print_STR(press_to_change_STR, 1);
print_STR(right_to_select_STR, 1);
#elif defined(ENABLE_LCD)
print_STR(rotate_to_change_STR, 1);
print_STR(press_to_select_STR, 1);
#endif
display_Update();
#else
Serial.print(F("CART TITLE:"));
Serial.println(msxgame);
#endif
while (1) { // Single Step
uint8_t b = checkButton();
if (b == 1) { // Continue (press)
break;
}
if (b == 2) { // Reset to Start of List (doubleclick)
byte prevline = strtol(msxll, NULL, 10);
msxcsvpos -= prevline;
msxcsvFile.seek(msxcsvpos);
break;
}
if (b == 3) { // Long Press - Select Cart (hold)
newmsxmapper = strtol(msxmm, NULL, 10);
newmsxsize = strtol(msxrr, NULL, 10);
newmsxramsize = strtol(msxss, NULL, 10);
EEPROM_writeAnything(7, newmsxmapper);
EEPROM_writeAnything(8, newmsxsize);
EEPROM_writeAnything(10, newmsxramsize);
cartselected = 1; // SELECTION MADE
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
println_Msg(F("SELECTION MADE"));
display_Update();
#else
Serial.println(F("SELECTION MADE"));
#endif
break;
}
}
if (cartselected) {
cartselected = 0; // Reset Flag
return true;
}
}
}
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
println_Msg(FS(FSTRING_EMPTY));
println_Msg(FS(FSTRING_END_OF_FILE));
display_Update();
#else
Serial.println(FS(FSTRING_END_OF_FILE));
#endif
return false; // Skip over semicolon
} database.seekCur(1);
void checkCSV_MSX() { // Read ram size
if (getCartListInfo_MSX()) { entry->ramSize = database.read() - 48;
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear(); // Skip rest of line
println_Msg(FS(FSTRING_CART_SELECTED)); database.seekCur(2);
println_Msg(FS(FSTRING_EMPTY));
println_Msg(msxgame);
display_Update();
// Display Settings
display.setCursor(0, 56);
print_Msg(F("CODE: M"));
print_Msg(newmsxmapper);
print_Msg(F("/R"));
print_Msg(newmsxsize);
print_Msg(F("/S"));
println_Msg(newmsxramsize);
display_Update();
#else
Serial.println(FS(FSTRING_EMPTY));
Serial.println(FS(FSTRING_CART_SELECTED));
Serial.println(msxgame);
// Display Settings
Serial.print(F("CODE: M"));
Serial.print(newmsxmapper);
Serial.print(F("/R"));
Serial.print(newmsxsize);
Serial.print(F("/S"));
Serial.println(newmsxramsize);
Serial.println(FS(FSTRING_EMPTY));
#endif
} else {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display.setCursor(0, 56);
println_Msg(FS(FSTRING_NO_SELECTION));
display_Update();
#else
Serial.println(FS(FSTRING_NO_SELECTION));
#endif
}
} }
void setCart_MSX() { void setCart_MSX() {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD)) //go to root
display_Clear();
println_Msg(msxcartCSV);
display_Update();
#endif
sd.chdir(); sd.chdir();
sprintf(folder, "MSX/CSV");
sd.chdir(folder); // Switch Folder
msxcsvFile = sd.open(msxcartCSV, O_READ);
if (!msxcsvFile) {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear();
println_Msg(F("CSV FILE NOT FOUND!"));
display_Update();
#else
Serial.println(F("CSV FILE NOT FOUND!"));
#endif
while (1) {
if (checkButton() != 0)
setup_MSX();
}
}
checkCSV_MSX();
msxcsvFile.close(); struct database_entry_MSX entry;
// Select starting letter
byte myLetter = starting_letter();
// Open database
if (myFile.open("msxcart.txt", O_READ)) {
seek_first_letter_in_database(myFile, myLetter);
if(checkCartSelection(myFile, &readDataLine_MSX, &entry)) {
EEPROM_writeAnything(7, entry.gameMapper);
EEPROM_writeAnything(8, entry.gameSize);
EEPROM_writeAnything(10, entry.ramSize);
}
} else {
print_FatalError(FS(FSTRING_DATABASE_FILE_NOT_FOUND));
}
} }
#endif #endif

View File

@ -587,7 +587,7 @@ void getMapping() {
sd.chdir(); sd.chdir();
if (!database.open("nes.txt", O_READ)) { if (!database.open("nes.txt", O_READ)) {
print_FatalError(F("Database file not found")); print_FatalError(FS(FSTRING_DATABASE_FILE_NOT_FOUND));
// never reached // never reached
} }
@ -1002,28 +1002,6 @@ int int_pow(int base, int exp) { // Power for int
return result; return result;
} }
/******************************************
CRC Functions
*****************************************/
void printCRC(char* checkFile, uint32_t* crcCopy, unsigned long offset) {
uint32_t crc;
char tempCRC[9];
FsFile crcFile = sd.open(checkFile);
crcFile.seek(offset);
crc = calculateCRC(crcFile);
crcFile.close();
if (crcCopy != NULL) {
*crcCopy = crc;
}
sprintf(tempCRC, "%08lX", crc);
print_Msg(F("CRC: "));
println_Msg(tempCRC);
display_Update();
}
/****************************************** /******************************************
File Functions File Functions
*****************************************/ *****************************************/

View File

@ -50,9 +50,7 @@ byte ody2lo = 0; // Lowest Entry
byte ody2hi = 4; // Highest Entry byte ody2hi = 4; // Highest Entry
byte ody2mapper; byte ody2mapper;
byte newody2mapper;
byte ody2size; byte ody2size;
byte newody2size;
// EEPROM MAPPING // EEPROM MAPPING
// 07 MAPPER // 07 MAPPER
@ -116,7 +114,6 @@ void ody2Menu() {
case 0: case 0:
// Select Cart // Select Cart
setCart_ODY2(); setCart_ODY2();
wait();
setup_ODY2(); setup_ODY2();
break; break;
@ -267,8 +264,7 @@ void readROM_ODY2() {
} }
myFile.close(); myFile.close();
unsigned long crcsize = ODY2[ody2size] * 0x400; printCRC(fileName, NULL, 0);
calcCRC(fileName, crcsize, NULL, 0);
println_Msg(FS(FSTRING_EMPTY)); println_Msg(FS(FSTRING_EMPTY));
print_STR(press_button_STR, 1); print_STR(press_button_STR, 1);
@ -281,6 +277,7 @@ void readROM_ODY2() {
//****************************************** //******************************************
void setROMSize_ODY2() { void setROMSize_ODY2() {
byte newody2size;
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD)) #if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear(); display_Clear();
if (ody2lo == ody2hi) if (ody2lo == ody2hi)
@ -425,248 +422,45 @@ void checkStatus_ODY2() {
//****************************************** //******************************************
// CART SELECT CODE // CART SELECT CODE
//****************************************** //******************************************
struct database_entry_ODY2 {
byte gameMapper;
byte gameSize;
};
FsFile ody2csvFile; void readDataLine_ODY2(FsFile& database, struct database_entry_ODY2* entry) {
char ody2game[51]; // title // Read mapper
char ody2mm[3]; // mapper (A10) entry->gameMapper = database.read() - 48;
char ody2rr[3]; // romsize
char ody2ll[4]; // linelength (previous line)
unsigned long ody2csvpos; // CSV File Position
char ody2cartCSV[] = "ody2cart.txt"; // CSV List
char ody2csvEND[] = "EOF"; // CSV End Marker for scrolling
bool readLine_ODY2(FsFile& f, char* line, size_t maxLen) { // Skip over semicolon
for (size_t n = 0; n < maxLen; n++) { database.seekCur(1);
int c = f.read();
if (c < 0 && n == 0) return false; // EOF
if (c < 0 || c == '\n') {
line[n] = 0;
return true;
}
line[n] = c;
}
return false; // line too long
}
bool readVals_ODY2(char* ody2game, char* ody2mm, char* ody2rr, char* ody2ll) { // Read rom size
char line[59]; entry->gameSize = database.read() - 48;
ody2csvpos = ody2csvFile.position();
if (!readLine_ODY2(ody2csvFile, line, sizeof(line))) {
return false; // EOF or too long
}
char* comma = strtok(line, ",");
int x = 0;
while (comma != NULL) {
if (x == 0)
strcpy(ody2game, comma);
else if (x == 1)
strcpy(ody2mm, comma);
else if (x == 2)
strcpy(ody2rr, comma);
else if (x == 3)
strcpy(ody2ll, comma);
comma = strtok(NULL, ",");
x += 1;
}
return true;
}
bool getCartListInfo_ODY2() { // Skip rest of line
bool buttonreleased = 0; database.seekCur(2);
bool cartselected = 0;
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear();
println_Msg(F(" HOLD TO FAST CYCLE"));
display_Update();
#else
Serial.println(F("HOLD BUTTON TO FAST CYCLE"));
#endif
delay(2000);
#if defined(ENABLE_OLED)
buttonVal1 = (PIND & (1 << 7)); // PD7
#elif defined(ENABLE_LCD)
boolean buttonVal1 = (PING & (1 << 2)); //PG2
#endif
if (buttonVal1 == LOW) { // Button Held - Fast Cycle
while (1) { // Scroll Game List
while (readVals_ODY2(ody2game, ody2mm, ody2rr, ody2ll)) {
if (strcmp(ody2csvEND, ody2game) == 0) {
ody2csvFile.seek(0); // Restart
} else {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear();
println_Msg(F("CART TITLE:"));
println_Msg(FS(FSTRING_EMPTY));
println_Msg(ody2game);
display_Update();
#else
Serial.print(F("CART TITLE:"));
Serial.println(ody2game);
#endif
#if defined(ENABLE_OLED)
buttonVal1 = (PIND & (1 << 7)); // PD7
#elif defined(ENABLE_LCD)
buttonVal1 = (PING & (1 << 2)); //PG2
#endif
if (buttonVal1 == HIGH) { // Button Released
buttonreleased = 1;
break;
}
if (buttonreleased) {
buttonreleased = 0; // Reset Flag
break;
}
}
}
#if defined(ENABLE_OLED)
buttonVal1 = (PIND & (1 << 7)); // PD7
#elif defined(ENABLE_LCD)
buttonVal1 = (PING & (1 << 2)); //PG2
#endif
if (buttonVal1 == HIGH) // Button Released
break;
}
}
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display.setCursor(0, 56);
println_Msg(F("FAST CYCLE OFF"));
display_Update();
#else
Serial.println(FS(FSTRING_EMPTY));
Serial.println(F("FAST CYCLE OFF"));
Serial.println(F("PRESS BUTTON TO STEP FORWARD"));
Serial.println(F("DOUBLE CLICK TO STEP BACK"));
Serial.println(F("HOLD TO SELECT"));
Serial.println(FS(FSTRING_EMPTY));
#endif
while (readVals_ODY2(ody2game, ody2mm, ody2rr, ody2ll)) {
if (strcmp(ody2csvEND, ody2game) == 0) {
ody2csvFile.seek(0); // Restart
} else {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear();
println_Msg(F("CART TITLE:"));
println_Msg(FS(FSTRING_EMPTY));
println_Msg(ody2game);
display.setCursor(0, 48);
#if defined(ENABLE_OLED)
print_STR(press_to_change_STR, 1);
print_STR(right_to_select_STR, 1);
#elif defined(ENABLE_LCD)
print_STR(rotate_to_change_STR, 1);
print_STR(press_to_select_STR, 1);
#endif
display_Update();
#else
Serial.print(F("CART TITLE:"));
Serial.println(ody2game);
#endif
while (1) { // Single Step
uint8_t b = checkButton();
if (b == 1) { // Continue (press)
break;
}
if (b == 2) { // Reset to Start of List (doubleclick)
byte prevline = strtol(ody2ll, NULL, 10);
ody2csvpos -= prevline;
ody2csvFile.seek(ody2csvpos);
break;
}
if (b == 3) { // Long Press - Select Cart (hold)
newody2mapper = strtol(ody2mm, NULL, 10);
newody2size = strtol(ody2rr, NULL, 10);
EEPROM_writeAnything(7, newody2mapper);
EEPROM_writeAnything(8, newody2size);
cartselected = 1; // SELECTION MADE
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
println_Msg(F("SELECTION MADE"));
display_Update();
#else
Serial.println(F("SELECTION MADE"));
#endif
break;
}
}
if (cartselected) {
cartselected = 0; // Reset Flag
return true;
}
}
}
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
println_Msg(FS(FSTRING_EMPTY));
println_Msg(FS(FSTRING_END_OF_FILE));
display_Update();
#else
Serial.println(FS(FSTRING_END_OF_FILE));
#endif
return false;
}
void checkCSV_ODY2() {
if (getCartListInfo_ODY2()) {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear();
println_Msg(FS(FSTRING_CART_SELECTED));
println_Msg(FS(FSTRING_EMPTY));
println_Msg(ody2game);
display_Update();
// Display Settings
display.setCursor(0, 56);
print_Msg(F("CODE: M"));
print_Msg(newody2mapper);
print_Msg(F("/R"));
println_Msg(newody2size);
display_Update();
#else
Serial.println(FS(FSTRING_EMPTY));
Serial.println(FS(FSTRING_CART_SELECTED));
Serial.println(ody2game);
// Display Settings
Serial.print(F("CODE: M"));
Serial.print(newody2mapper);
Serial.print(F("/R"));
Serial.println(newody2size);
Serial.println(FS(FSTRING_EMPTY));
#endif
} else {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display.setCursor(0, 56);
println_Msg(FS(FSTRING_NO_SELECTION));
display_Update();
#else
Serial.println(FS(FSTRING_NO_SELECTION));
#endif
}
} }
void setCart_ODY2() { void setCart_ODY2() {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD)) //go to root
display_Clear();
println_Msg(ody2cartCSV);
display_Update();
#endif
sd.chdir(); sd.chdir();
sprintf(folder, "ODY2/CSV");
sd.chdir(folder); // Switch Folder
ody2csvFile = sd.open(ody2cartCSV, O_READ);
if (!ody2csvFile) {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear();
println_Msg(F("CSV FILE NOT FOUND!"));
display_Update();
#else
Serial.println(F("CSV FILE NOT FOUND!"));
#endif
while (1) {
if (checkButton() != 0)
setup_ODY2();
}
}
checkCSV_ODY2();
ody2csvFile.close(); struct database_entry_ODY2 entry;
// Select starting letter
byte myLetter = starting_letter();
// Open database
if (myFile.open("ody2cart.txt", O_READ)) {
seek_first_letter_in_database(myFile, myLetter);
if(checkCartSelection(myFile, &readDataLine_ODY2, &entry)) {
EEPROM_writeAnything(7, entry.gameMapper);
EEPROM_writeAnything(8, entry.gameSize);
}
} else {
print_FatalError(FS(FSTRING_DATABASE_FILE_NOT_FOUND));
}
} }
#endif #endif
//****************************************** //******************************************

View File

@ -57,12 +57,11 @@ constexpr char PROGMEM FSTRING_OK[] = "OK";
constexpr char PROGMEM FSTRING_EMPTY[] = ""; constexpr char PROGMEM FSTRING_EMPTY[] = "";
constexpr char PROGMEM FSTRING_SPACE[] = " "; constexpr char PROGMEM FSTRING_SPACE[] = " ";
constexpr char PROGMEM FSTRING_CURRENT_SETTINGS[] = "CURRENT SETTINGS"; constexpr char PROGMEM FSTRING_CURRENT_SETTINGS[] = "CURRENT SETTINGS";
constexpr char PROGMEM FSTRING_NO_SELECTION[] = "NO SELECTION";
constexpr char PROGMEM FSTRING_END_OF_FILE[] = "END OF FILE";
// Messages // Messages
constexpr char PROGMEM FSTRING_OSCR[] = "OSCR"; constexpr char PROGMEM FSTRING_OSCR[] = "OSCR";
constexpr char PROGMEM FSTRING_MODULE_NOT_ENABLED[] = "Module is not enabled."; constexpr char PROGMEM FSTRING_MODULE_NOT_ENABLED[] = "Module is not enabled.";
constexpr char PROGMEM FSTRING_DATABASE_FILE_NOT_FOUND[] = "Database file not found";
// Cart // Cart
constexpr char PROGMEM FSTRING_READ_ROM[] = "Read ROM"; constexpr char PROGMEM FSTRING_READ_ROM[] = "Read ROM";
@ -72,7 +71,6 @@ constexpr char PROGMEM FSTRING_SELECT_CART[] = "Select Cart";
constexpr char PROGMEM FSTRING_SELECT_CART_TYPE[] = "Select Cart Type"; constexpr char PROGMEM FSTRING_SELECT_CART_TYPE[] = "Select Cart Type";
constexpr char PROGMEM FSTRING_SET_SIZE[] = "Set Size"; constexpr char PROGMEM FSTRING_SET_SIZE[] = "Set Size";
constexpr char PROGMEM FSTRING_REFRESH_CART[] = "Refresh Cart"; constexpr char PROGMEM FSTRING_REFRESH_CART[] = "Refresh Cart";
constexpr char PROGMEM FSTRING_CART_SELECTED[] = "CART SELECTED";
/*==== /CONSTANTS =================================================*/ /*==== /CONSTANTS =================================================*/

View File

@ -37,12 +37,11 @@ extern const char PROGMEM FSTRING_EMPTY[];
extern const char PROGMEM FSTRING_SPACE[]; extern const char PROGMEM FSTRING_SPACE[];
extern const char PROGMEM FSTRING_RESET[]; extern const char PROGMEM FSTRING_RESET[];
extern const char PROGMEM FSTRING_CURRENT_SETTINGS[]; extern const char PROGMEM FSTRING_CURRENT_SETTINGS[];
extern const char PROGMEM FSTRING_NO_SELECTION[];
extern const char PROGMEM FSTRING_END_OF_FILE[];
// Messages // Messages
extern const char PROGMEM FSTRING_OSCR[]; extern const char PROGMEM FSTRING_OSCR[];
extern const char PROGMEM FSTRING_MODULE_NOT_ENABLED[]; extern const char PROGMEM FSTRING_MODULE_NOT_ENABLED[];
extern const char FSTRING_DATABASE_FILE_NOT_FOUND[];
// Cart // Cart
extern const char PROGMEM FSTRING_READ_ROM[]; extern const char PROGMEM FSTRING_READ_ROM[];
@ -52,7 +51,6 @@ extern const char PROGMEM FSTRING_SELECT_CART[];
extern const char PROGMEM FSTRING_SELECT_CART_TYPE[]; extern const char PROGMEM FSTRING_SELECT_CART_TYPE[];
extern const char PROGMEM FSTRING_SET_SIZE[]; extern const char PROGMEM FSTRING_SET_SIZE[];
extern const char PROGMEM FSTRING_REFRESH_CART[]; extern const char PROGMEM FSTRING_REFRESH_CART[];
extern const char PROGMEM FSTRING_CART_SELECTED[];
#define FS(pmem_string) (reinterpret_cast<const __FlashStringHelper *>(pmem_string)) #define FS(pmem_string) (reinterpret_cast<const __FlashStringHelper *>(pmem_string))

View File

@ -59,7 +59,6 @@ byte VECTREX[] = { 4, 8, 12, 16, 32, 64 };
byte vectrexlo = 0; // Lowest Entry byte vectrexlo = 0; // Lowest Entry
byte vectrexhi = 5; // Highest Entry byte vectrexhi = 5; // Highest Entry
byte vectrexsize; byte vectrexsize;
byte newvectrexsize;
// EEPROM MAPPING // EEPROM MAPPING
// 08 ROM SIZE // 08 ROM SIZE
@ -124,7 +123,6 @@ void vectrexMenu() {
case 0: case 0:
// Select Cart // Select Cart
setCart_VECTREX(); setCart_VECTREX();
wait();
setup_VECTREX(); setup_VECTREX();
break; break;
@ -245,8 +243,7 @@ void readROM_VECTREX() {
} }
myFile.close(); myFile.close();
unsigned long crcsize = VECTREX[vectrexsize] * 0x400; printCRC(fileName, NULL, 0);
calcCRC(fileName, crcsize, NULL, 0);
println_Msg(FS(FSTRING_EMPTY)); println_Msg(FS(FSTRING_EMPTY));
// Prints string out of the common strings array either with or without newline // Prints string out of the common strings array either with or without newline
@ -260,6 +257,7 @@ void readROM_VECTREX() {
//****************************************** //******************************************
void setROMSize_VECTREX() { void setROMSize_VECTREX() {
byte newvectrexsize;
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD)) #if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear(); display_Clear();
if (vectrexlo == vectrexhi) if (vectrexlo == vectrexhi)
@ -393,237 +391,32 @@ void checkStatus_VECTREX() {
//****************************************** //******************************************
// CART SELECT CODE // CART SELECT CODE
//****************************************** //******************************************
void readDataLine_VECTREX(FsFile& database, byte* gameSize) {
// Read rom size
(*gameSize) = database.read() - 48;
FsFile vectrexcsvFile; // Skip rest of line
char vectrexgame[25]; // title database.seekCur(2);
char vectrexrr[4]; // romsize
char vectrexll[4]; // linelength (previous line)
unsigned long vectrexcsvpos; // CSV File Position
char vectrexcartCSV[] = "vectrexcart.txt"; // CSV List
char vectrexcsvEND[] = "EOF"; // CSV End Marker for scrolling
bool readLine_VECTREX(FsFile& f, char* line, size_t maxLen) {
for (size_t n = 0; n < maxLen; n++) {
int c = f.read();
if (c < 0 && n == 0) return false; // EOF
if (c < 0 || c == '\n') {
line[n] = 0;
return true;
}
line[n] = c;
}
return false; // line too long
}
bool readVals_VECTREX(char* vectrexgame, char* vectrexrr, char* vectrexll) {
char line[31];
vectrexcsvpos = vectrexcsvFile.position();
if (!readLine_VECTREX(vectrexcsvFile, line, sizeof(line))) {
return false; // EOF or too long
}
char* comma = strtok(line, ",");
int x = 0;
while (comma != NULL) {
if (x == 0)
strcpy(vectrexgame, comma);
else if (x == 1)
strcpy(vectrexrr, comma);
else if (x == 2)
strcpy(vectrexll, comma);
comma = strtok(NULL, ",");
x += 1;
}
return true;
}
bool getCartListInfo_VECTREX() {
bool buttonreleased = 0;
bool cartselected = 0;
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear();
println_Msg(F(" HOLD TO FAST CYCLE"));
display_Update();
#else
Serial.println(F("HOLD BUTTON TO FAST CYCLE"));
#endif
delay(2000);
#if defined(ENABLE_OLED)
buttonVal1 = (PIND & (1 << 7)); // PD7
#elif defined(ENABLE_LCD)
boolean buttonVal1 = (PING & (1 << 2)); //PG2
#endif
if (buttonVal1 == LOW) { // Button Held - Fast Cycle
while (1) { // Scroll Game List
while (readVals_VECTREX(vectrexgame, vectrexrr, vectrexll)) {
if (strcmp(vectrexcsvEND, vectrexgame) == 0) {
vectrexcsvFile.seek(0); // Restart
} else {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear();
println_Msg(F("CART TITLE:"));
println_Msg(FS(FSTRING_EMPTY));
println_Msg(vectrexgame);
display_Update();
#else
Serial.print(F("CART TITLE:"));
Serial.println(vectrexgame);
#endif
#if defined(ENABLE_OLED)
buttonVal1 = (PIND & (1 << 7)); // PD7
#elif defined(ENABLE_LCD)
boolean buttonVal1 = (PING & (1 << 2)); //PG2
#endif
if (buttonVal1 == HIGH) { // Button Released
buttonreleased = 1;
break;
}
if (buttonreleased) {
buttonreleased = 0; // Reset Flag
break;
}
}
}
#if defined(ENABLE_OLED)
buttonVal1 = (PIND & (1 << 7)); // PD7
#elif defined(ENABLE_LCD)
boolean buttonVal1 = (PING & (1 << 2)); //PG2
#endif
if (buttonVal1 == HIGH) // Button Released
break;
}
}
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display.setCursor(0, 56);
println_Msg(F("FAST CYCLE OFF"));
display_Update();
#else
Serial.println(FS(FSTRING_EMPTY));
Serial.println(F("FAST CYCLE OFF"));
Serial.println(F("PRESS BUTTON TO STEP FORWARD"));
Serial.println(F("DOUBLE CLICK TO STEP BACK"));
Serial.println(F("HOLD TO SELECT"));
Serial.println(FS(FSTRING_EMPTY));
#endif
while (readVals_VECTREX(vectrexgame, vectrexrr, vectrexll)) {
if (strcmp(vectrexcsvEND, vectrexgame) == 0) {
vectrexcsvFile.seek(0); // Restart
} else {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear();
println_Msg(F("CART TITLE:"));
println_Msg(FS(FSTRING_EMPTY));
println_Msg(vectrexgame);
display.setCursor(0, 48);
#if defined(ENABLE_OLED)
print_STR(press_to_change_STR, 1);
print_STR(right_to_select_STR, 1);
#elif defined(ENABLE_LCD)
print_STR(rotate_to_change_STR, 1);
print_STR(press_to_select_STR, 1);
#endif
display_Update();
#else
Serial.print(F("CART TITLE:"));
Serial.println(vectrexgame);
#endif
while (1) { // Single Step
uint8_t b = checkButton();
if (b == 1) { // Continue (press)
break;
}
if (b == 2) { // Reset to Start of List (doubleclick)
byte prevline = strtol(vectrexll, NULL, 10);
vectrexcsvpos -= prevline;
vectrexcsvFile.seek(vectrexcsvpos);
break;
}
if (b == 3) { // Long Press - Select Cart (hold)
newvectrexsize = strtol(vectrexrr, NULL, 10);
EEPROM_writeAnything(8, newvectrexsize);
cartselected = 1; // SELECTION MADE
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
println_Msg(F("SELECTION MADE"));
display_Update();
#else
Serial.println(F("SELECTION MADE"));
#endif
break;
}
}
if (cartselected) {
cartselected = 0; // Reset Flag
return true;
}
}
}
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
println_Msg(FS(FSTRING_EMPTY));
println_Msg(FS(FSTRING_END_OF_FILE));
display_Update();
#else
Serial.println(FS(FSTRING_END_OF_FILE));
#endif
return false;
}
void checkCSV_VECTREX() {
if (getCartListInfo_VECTREX()) {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display_Clear();
println_Msg(FS(FSTRING_CART_SELECTED));
println_Msg(FS(FSTRING_EMPTY));
println_Msg(vectrexgame);
display_Update();
// Display Settings
display.setCursor(0, 56);
print_Msg(F("CODE: R"));
println_Msg(newvectrexsize);
display_Update();
#else
Serial.println(FS(FSTRING_EMPTY));
Serial.println(FS(FSTRING_CART_SELECTED));
Serial.println(vectrexgame);
// Display Settings
Serial.print(F("CODE: R"));
Serial.println(newvectrexsize);
Serial.println(FS(FSTRING_EMPTY));
#endif
} else {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display.setCursor(0, 56);
println_Msg(FS(FSTRING_NO_SELECTION));
display_Update();
#else
Serial.println(FS(FSTRING_NO_SELECTION));
#endif
}
} }
void setCart_VECTREX() { void setCart_VECTREX() {
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD)) //go to root
display_Clear();
println_Msg(vectrexcartCSV);
display_Update();
#endif
sd.chdir(); sd.chdir();
sprintf(folder, "VECTREX/CSV");
sd.chdir(folder); // Switch Folder byte gameSize;
vectrexcsvFile = sd.open(vectrexcartCSV, O_READ);
if (!vectrexcsvFile) { // Select starting letter
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD)) //byte myLetter = starting_letter();
display_Clear();
println_Msg(F("CSV FILE NOT FOUND!")); // Open database
display_Update(); if (myFile.open("vectrexcart.txt", O_READ)) {
#else // seek_first_letter_in_database(myFile, myLetter);
Serial.println(F("CSV FILE NOT FOUND!"));
#endif if(checkCartSelection(myFile, &readDataLine_ARC, &gameSize)) {
while (1) { EEPROM_writeAnything(8, gameSize);
if (checkButton() != 0)
setup_VECTREX();
} }
} else {
print_FatalError(FS(FSTRING_DATABASE_FILE_NOT_FOUND));
} }
checkCSV_VECTREX();
vectrexcsvFile.close();
} }
#endif #endif

View File

@ -449,7 +449,7 @@ void setCart_WSV() {
EEPROM_writeAnything(8, wsvsize); EEPROM_writeAnything(8, wsvsize);
} }
} else { } else {
print_FatalError(F("Database file not found")); print_FatalError(FS(FSTRING_DATABASE_FILE_NOT_FOUND));
} }
} }
#endif #endif

View File

@ -182,7 +182,6 @@ cart size:
## arccart.txt ## arccart.txt
This file stores known Emerson Arcadia 2001 games with the required cart size. This file stores known Emerson Arcadia 2001 games with the required cart size.
Example: Example:
American Football American Football
2 2
@ -241,3 +240,102 @@ cart size:
7 = 128K 7 = 128K
8 = 256K 8 = 256K
9 = 512K 9 = 512K
## fairchildcart.txt
This file stores known Fairchild Channel F games with the required cart size.
Example:
Hangman
1
Name
cart size
cart size:
0 = 2K
1 = 3K
2 = 4K
3 = 6K
## msxcart.txt
This file stores known MSX games with the required mapper, cart size and ram size.
Example:
Aoki Ookami - Genchou Hishi
07,8,4
Name
mapper, cart size, ram size
mapper:
00 = NONE
01 = ASCII8
02 = ASCII16
03 = CROSS BLAIM
04 = GAME MASTER 2
05 = HAL NOTE
06 = HARRY FOX YUKI
07 = KOEI
08 = KONAMI
09 = KONAMI SSC
10 = MSX-DOS2
11 = PAC/FM-PAC
12 = R-TYPE
13 = SUPER LODE RUNNER
cart size:
0 = 0K
1 = 8K
2 = 16K
3 = 32K
4 = 64K
5 = 128K
6 = 256K
7 = 512K
8 = 1024K
ram size:
0 = 0K
1 = 2K
2 = 8K
3 = 16K
4 = 32K
## ody2cart.txt
This file stores known Magnavox Odyssey 2 games with the required mapper and cart size.
Example:
Baseball
0,0
Name
mapper, cart size
mapper:
0 = STANDARD
1 = A10
cart size:
0 = 2K
1 = 4K
2 = 8K
3 = 12K
4 = 16K
## vectrexcart.txt
This file stores known Vectrex games with the required cart size.
Example:
Mine Storm II
0
Name
cart size
cart size:
0 = 4K
1 = 8K
2 = 12K
3 = 16K
4 = 32K
5 = 64K

View File

@ -1,33 +1,96 @@
Alien Invasion,2,0 Alien Invasion
Backgammon/Acey-Deucey,0,20 2
Baseball,0,29
Bowling,0,15 Backgammon/Acey-Deucey
Casino Poker,2,14 0
Checkers,0,19
Demonstration Cartridge,0,15 Baseball
Demonstration Cartridge 2,0,30 0
Desert Fox/Shooting Gallery,0,32
Dodge It,0,34 Bowling
Drag Race,0,15 0
Galactic Space Wars/Lunar Lander,0,16
Hangman,1,39 Casino Poker
Magic Numbers,0,14 2
Math Quiz I,0,20
Math Quiz II,0,18 Checkers
Maze (Multi),0,19 0
Memory Match 1 & 2,0,19
Muehle (Multi),0,25 Demonstration Cartridge
Ordtaevling,1,21 0
Pinball Challenge,0,18
Pro Football,2,24 Demonstration Cartridge 2
Rat' Mal,1,19 0
Robot War/Torpedo Alley,0,15
Schach,3,30 Desert Fox/Shooting Gallery
Slot Machine,0,13 0
Sonar Search,0,19
Space War,0,19 Dodge It
Spitfire,0,16 0
Tic-Tac-Toe (Multi),0,15
Video Blackjack,0,26 Drag Race
Video Whizball,1,22 0
EOF,0,0
Galactic Space Wars/Lunar Lander
0
Hangman
1
Magic Numbers
0
Math Quiz I
0
Math Quiz II
0
Maze (Multi)
0
Memory Match 1 & 2
0
Muehle (Multi)
0
Ordtaevling
1
Pinball Challenge
0
Pro Football
2
Rat' Mal
1
Robot War/Torpedo Alley
0
Schach
3
Slot Machine
0
Sonar Search
0
Space War
0
Spitfire
0
Tic-Tac-Toe (Multi)
0
Video Blackjack
0
Video Whizball
1

File diff suppressed because it is too large Load Diff

View File

@ -1,134 +1,399 @@
4 en 1 Ligne,1,1,0 4 en 1 Ligne
4 in 1 Row,1,1,20 1,1
Air Battle (V+),0,3,19
Alien Invaders - Plus,0,0,24 4 in 1 Row
Alpine Skiing,0,0,30 1,1
Armored Encounter + Sub Chase,0,0,22
Atlantis,0,1,38 Air Battle (V+)
Attack of the Timelord,0,1,17 0,3
Baseball,0,0,31
Billard Americain,0,0,17 Alien Invaders - Plus
Billard Americain (V+),0,2,26 0,0
Billard Electrique,0,0,31
Billard Electrique (V+),0,2,27 Alpine Skiing
Blackjack,0,0,32 0,0
Blobbers,0,2,18
Blockout + Breakdown,0,0,17 Armored Encounter + Sub Chase
Bombardeio Submarino + Tiro ao Alvo,0,0,29 0,0
Bowling + Basketball,0,0,44
Buraco Negro,0,2,29 Atlantis
Casino Slot Machine,0,0,21 0,1
Catch the Ball + Noughts and Crosses,0,0,28
Chat et Souris,0,1,45 Attack of the Timelord
Chess,0,0,23 0,1
Chez Maxime (V+),0,1,14
Chinese Logic,0,0,25 Baseball
Clay Pigeon,0,1,22 0,0
Comando Noturno,0,2,20
Computer Golf,0,0,24 Billard Americain
Computer Intro,0,0,22 0,0
Computer Programmer,0,0,23
Conflit Cosmique,0,0,28 Billard Americain (V+)
Conquest of the World,0,1,25 0,2
Cosmic Conflict,0,0,30
Cosmic Conflict (V+),0,2,24 Billard Electrique
Course de Voitures + Autodrome + Cryptogramme,0,0,29 0,0
Course de Voitures + Autodrome + Cryptogramme (V+),0,2,54
Demon Attack,0,1,59 Billard Electrique (V+)
Demon Attack (V+),0,2,21 0,2
Depth Charge + Marksman,0,0,26
Desafio Chines,0,0,32 Blackjack
Dynasty,0,0,23 0,0
Electronic Table Soccer,0,0,16
Exojet (V+),0,2,32 Blobbers
Football,0,0,20 0,2
Football Electronique + Hockey Electronique,0,0,17
Freedom Fighters,0,1,52 Blockout + Breakdown
Freedom Fighters (V+),0,2,25 0,0
Frogger,0,2,30
Golf,0,0,16 Bombardeio Submarino + Tiro ao Alvo
Great Wall Street Fortune Hunt,0,1,13 0,0
Guerre de l'Espace (V+),0,2,39
Guerre Laser,0,0,32 Bowling + Basketball
Gunfighter,0,0,21 0,0
Helicopter Rescue (V+),0,4,19
Hockey + Soccer,0,0,31 Buraco Negro
I've Got Your Number,0,0,24 0,2
Invaders from Hyperspace,0,0,29
Jeu de Quilles + Basketball,0,0,33 Casino Slot Machine
Jeu de Quilles + Basketball (V+),0,2,36 0,0
Jumping Acrobats,0,0,41
K.C. Munchkin,0,1,25 Catch the Ball + Noughts and Crosses
K.C.'s Krazy Chase,0,1,22 0,0
Keyboard Creations,0,0,27
Killer Bees,0,2,27 Chat et Souris
Killer Bees (V+),0,2,20 0,1
Kinder im Verkehr 1,0,0,25
La Quete des Anneaux,0,1,28 Chess
La Ruche Infernale (V+),0,2,29 0,0
Labyrinth Game + Supermind,0,0,32
Las Vegas,0,0,35 Chez Maxime (V+)
Las Vegas Blackjack,0,0,18 0,1
Laser War,0,0,28
Le Mur Magique,0,0,18 Chinese Logic
Le Tresor Englouti (V+),0,2,23 0,0
Loony Balloon (V+),0,2,32
Matchmaker + Logix + Buzzword,0,0,27 Clay Pigeon
Math-A-Magic + Echo,0,0,38 0,1
Mathematicien + Echo,0,0,28
Monkeyshines,0,1,29 Comando Noturno
Morse,0,0,21 0,2
Moto-Crash (V+),0,2,14
Mousing Cat,0,1,24 Computer Golf
Munchkin,0,1,20 0,0
Musician,1,1,17
Neutron Star (V+),0,3,17 Computer Intro
Newscaster,0,0,26 0,0
Nightmare,0,2,19
Nightmare (V+),0,2,18 Computer Programmer
Nimble Numbers Ned,0,1,23 0,0
Norseman (V+),0,2,27
O Malabarista + Jogo da Velha,0,0,22 Conflit Cosmique
O Segredo do Farao,0,1,38 0,0
Out of this World + Helicopter Rescue,0,0,27
P.T. Barnum's Acrobats,0,1,46 Conquest of the World
Pachinko,0,0,31 0,1
Pairs + Space Rendezvous + Logic,0,0,17
Pick Axe Pete,0,1,41 Cosmic Conflict
Pickaxe Pete (V+),0,2,22 0,0
Pocket Billiards,0,0,26
Popeye,0,2,25 Cosmic Conflict (V+)
Power Lords,0,1,15 0,2
Power Lords (Alt),0,2,20
Prendre l'Argent et Fuir,0,0,26 Course de Voitures + Autodrome + Cryptogramme
Q-Bert,0,2,33 0,0
Quest for the Rings,0,1,15
Race + Spin-out + Cryptogram (V+),0,2,28 Course de Voitures + Autodrome + Cryptogramme (V+)
Samurai,0,0,42 0,2
Satellite Attack,0,0,16
Satellite Attack (V+),0,2,25 Demon Attack
Secret of the Pharaohs,0,0,30 0,1
Showdown in 2100 A.D.,0,0,31
Sid the Spellbinder,0,1,30 Demon Attack (V+)
Skiing,0,0,28 0,2
Smithereens,0,1,15
Speedway + Spin-out + Crypto-logic,0,0,20 Depth Charge + Marksman
Stone Sling,0,0,43 0,0
Stone Sling (V+),0,2,20
Super Bee,0,1,25 Desafio Chines
Super Cobra,0,2,18 0,0
Syracuse (V+),0,1,20
Take the Money and Run,0,0,22 Dynasty
Terrahawks (V+),0,2,31 0,0
Thunderball,0,0,24
Trans American Rally (V+),0,4,20 Electronic Table Soccer
Turtles,0,2,34 0,0
Type & Tell,0,1,16
UFO,0,0,20 Exojet (V+)
Verkehrsspiele 1,0,0,12 0,2
Verkehrsspiele 2,0,0,25
Volleyball,0,0,25 Football
Volleyball Electronique,0,0,19 0,0
Wall Street,0,1,32
War of Nerves,0,0,20 Football Electronique + Hockey Electronique
EOF,0,0,22 0,0
Freedom Fighters
0,1
Freedom Fighters (V+)
0,2
Frogger
0,2
Golf
0,0
Great Wall Street Fortune Hunt
0,1
Guerre de l'Espace (V+)
0,2
Guerre Laser
0,0
Gunfighter
0,0
Helicopter Rescue (V+)
0,4
Hockey + Soccer
0,0
I've Got Your Number
0,0
Invaders from Hyperspace
0,0
Jeu de Quilles + Basketball
0,0
Jeu de Quilles + Basketball (V+)
0,2
Jumping Acrobats
0,0
K.C. Munchkin
0,1
K.C.'s Krazy Chase
0,1
Keyboard Creations
0,0
Killer Bees
0,2
Killer Bees (V+)
0,2
Kinder im Verkehr 1
0,0
La Quete des Anneaux
0,1
La Ruche Infernale (V+)
0,2
Labyrinth Game + Supermind
0,0
Las Vegas
0,0
Las Vegas Blackjack
0,0
Laser War
0,0
Le Mur Magique
0,0
Le Tresor Englouti (V+)
0,2
Loony Balloon (V+)
0,2
Matchmaker + Logix + Buzzword
0,0
Math-A-Magic + Echo
0,0
Mathematicien + Echo
0,0
Monkeyshines
0,1
Morse
0,0
Moto-Crash (V+)
0,2
Mousing Cat
0,1
Munchkin
0,1
Musician
1,1
Neutron Star (V+)
0,3
Newscaster
0,0
Nightmare
0,2
Nightmare (V+)
0,2
Nimble Numbers Ned
0,1
Norseman (V+)
0,2
O Malabarista + Jogo da Velha
0,0
O Segredo do Farao
0,1
Out of this World + Helicopter Rescue
0,0
P.T. Barnum's Acrobats
0,1
Pachinko
0,0
Pairs + Space Rendezvous + Logic
0,0
Pick Axe Pete
0,1
Pickaxe Pete (V+)
0,2
Pocket Billiards
0,0
Popeye
0,2
Power Lords
0,1
Power Lords (Alt)
0,2
Prendre l'Argent et Fuir
0,0
Q-Bert
0,2
Quest for the Rings
0,1
Race + Spin-out + Cryptogram (V+)
0,2
Samurai
0,0
Satellite Attack
0,0
Satellite Attack (V+)
0,2
Secret of the Pharaohs
0,0
Showdown in 2100 A.D.
0,0
Sid the Spellbinder
0,1
Skiing
0,0
Smithereens
0,1
Speedway + Spin-out + Crypto-logic
0,0
Stone Sling
0,0
Stone Sling (V+)
0,2
Super Bee
0,1
Super Cobra
0,2
Syracuse (V+)
0,1
Take the Money and Run
0,0
Terrahawks (V+)
0,2
Thunderball
0,0
Trans American Rally (V+)
0,4
Turtles
0,2
Type & Tell
0,1
UFO
0,0
Verkehrsspiele 1
0,0
Verkehrsspiele 2
0,0
Volleyball
0,0
Volleyball Electronique
0,0
Wall Street
0,1
War of Nerves
0,0

View File

@ -1,32 +1,94 @@
3D Crazy Coaster,1,0 3D Crazy Coaster
3D Mine Storm,1,22 1
3D Narrow Escape,1,20
AnimAction,1,23 3D Mine Storm
Armor..Attack,0,17 1
Art Master,0,20
Bedlam,0,17 3D Narrow Escape
Berzerk,0,13 1
Blitz!,1,14
Clean Sweep,0,13 AnimAction
Cosmic Chasm,0,18 1
Fortress of Narzod,1,19
Heads-Up,1,25 Armor..Attack
HyperChase,0,15 0
Melody Master,1,17
Mine Storm,0,20 Art Master
Mine Storm II,0,17 0
Polar Rescue,1,20
Pole Position,1,19 Bedlam
Rip Off,0,20 0
Scramble,0,14
Solar Quest,0,15 Berzerk
Space Wars,0,18 0
Spike,1,17
Spin ball,1,12 Blitz!
Star Castle,0,16 1
Star Ship,0,18
Star Trek,0,16 Clean Sweep
StarHawk,0,16 0
WebWarp,1,15
WebWars,1,14 Cosmic Chasm
EOF,0,0 0
Fortress of Narzod
1
Heads-Up
1
HyperChase
0
Melody Master
1
Mine Storm
0
Mine Storm II
0
Polar Rescue
1
Pole Position
1
Rip Off
0
Scramble
0
Solar Quest
0
Space Wars
0
Spike
1
Spin ball
1
Star Castle
0
Star Ship
0
Star Trek
0
StarHawk
0
WebWarp
1
WebWars
1