mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-27 23:14:14 +01:00
V25C: Changed ID'ing of 32MB N64 Repros
This commit is contained in:
parent
abf99f9e1f
commit
876190b17e
@ -2,15 +2,15 @@
|
|||||||
Cartridge Reader for Arduino Mega2560
|
Cartridge Reader for Arduino Mega2560
|
||||||
|
|
||||||
Author: sanni
|
Author: sanni
|
||||||
Date: 2017-06-03
|
Date: 2017-06-06
|
||||||
Version: V25B
|
Version: V25C
|
||||||
|
|
||||||
SD lib: https://github.com/greiman/SdFat
|
SD lib: https://github.com/greiman/SdFat
|
||||||
LCD lib: https://github.com/adafruit/Adafruit_SSD1306
|
LCD lib: https://github.com/adafruit/Adafruit_SSD1306
|
||||||
Clockgen: https://github.com/etherkit/Si5351Arduino
|
Clockgen: https://github.com/etherkit/Si5351Arduino
|
||||||
RGB Tools lib: https://github.com/joushx/Arduino-RGB-Tools
|
RGB Tools lib: https://github.com/joushx/Arduino-RGB-Tools
|
||||||
|
|
||||||
Compiled with Arduino 1.8.2
|
Compiled with Arduino 1.8.3
|
||||||
|
|
||||||
Thanks to:
|
Thanks to:
|
||||||
MichlK - ROM-Reader for Super Nintendo
|
MichlK - ROM-Reader for Super Nintendo
|
||||||
@ -34,7 +34,7 @@
|
|||||||
YamaArashi - GBA flashrom bank switch command
|
YamaArashi - GBA flashrom bank switch command
|
||||||
|
|
||||||
**********************************************************************************/
|
**********************************************************************************/
|
||||||
char ver[5] = "V25B";
|
char ver[5] = "V25C";
|
||||||
|
|
||||||
/******************************************
|
/******************************************
|
||||||
Define Output
|
Define Output
|
||||||
@ -165,7 +165,7 @@ int incomingByte;
|
|||||||
int choice = 0;
|
int choice = 0;
|
||||||
// Temporary array that holds the menu option read out of progmem
|
// Temporary array that holds the menu option read out of progmem
|
||||||
char menuOptions[7][20];
|
char menuOptions[7][20];
|
||||||
boolean ignoreError;
|
boolean ignoreError = 0;
|
||||||
|
|
||||||
// File browser
|
// File browser
|
||||||
char fileName[26];
|
char fileName[26];
|
||||||
@ -962,7 +962,8 @@ void wait_btn() {
|
|||||||
// if the cart readers input button is pressed long
|
// if the cart readers input button is pressed long
|
||||||
if (b == 3) {
|
if (b == 3) {
|
||||||
if (errorLvl) {
|
if (errorLvl) {
|
||||||
ignoreError = 1;
|
// Debug
|
||||||
|
//ignoreError = 1;
|
||||||
errorLvl = 0;
|
errorLvl = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2165,7 +2165,7 @@ void resetFlashrom_N64(unsigned long flashBase) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void idFlashrom_N64() {
|
void idFlashrom_N64() {
|
||||||
// Size of repro cartridge
|
// Size of repro cartridge if no ID is found
|
||||||
cartSize = 0;
|
cartSize = 0;
|
||||||
|
|
||||||
// Send ID command to first flashrom
|
// Send ID command to first flashrom
|
||||||
@ -2182,16 +2182,18 @@ void idFlashrom_N64() {
|
|||||||
// Read flashrom ID
|
// Read flashrom ID
|
||||||
sprintf(flashid, "%04X", readWord_N64());
|
sprintf(flashid, "%04X", readWord_N64());
|
||||||
|
|
||||||
|
// Check for known ID
|
||||||
|
if ((strcmp(flashid, "227E") == 0) || (strcmp(flashid, "8816") == 0)) {
|
||||||
// Reset flashrom to read mode
|
// Reset flashrom to read mode
|
||||||
if (strcmp(flashid, "227E") == 0)
|
if (strcmp(flashid, "227E") == 0)
|
||||||
resetFlashrom_N64(romBase);
|
resetFlashrom_N64(romBase);
|
||||||
else if ((strcmp(flashid, "8813") == 0) || (strcmp(flashid, "8816") == 0))
|
else if ((strcmp(flashid, "8813") == 0) || (strcmp(flashid, "8816") == 0))
|
||||||
resetReadmode_N64();
|
resetReadmode_N64();
|
||||||
|
|
||||||
if ((strcmp(flashid, "227E") == 0) || (strcmp(flashid, "8816") == 0)) {
|
// Found first flashrom chip, set to 32MB
|
||||||
cartSize = 32;
|
cartSize = 32;
|
||||||
|
|
||||||
// Send ID command to second flashrom
|
// Send ID command to possible second flashrom
|
||||||
setAddress_N64(romBase + 0x2000000 + (0x555 << 1));
|
setAddress_N64(romBase + 0x2000000 + (0x555 << 1));
|
||||||
writeWord_N64(0xAA);
|
writeWord_N64(0xAA);
|
||||||
setAddress_N64(romBase + 0x2000000 + (0x2AA << 1));
|
setAddress_N64(romBase + 0x2000000 + (0x2AA << 1));
|
||||||
@ -2203,17 +2205,22 @@ void idFlashrom_N64() {
|
|||||||
setAddress_N64(romBase + 0x2000000);
|
setAddress_N64(romBase + 0x2000000);
|
||||||
readWord_N64();
|
readWord_N64();
|
||||||
// Read flashrom ID
|
// Read flashrom ID
|
||||||
sprintf(flashid, "%04X", readWord_N64());
|
sprintf(cartID, "%04X", readWord_N64());
|
||||||
if ((strcmp(flashid, "227E") == 0) || (strcmp(flashid, "8813") == 0)) {
|
|
||||||
|
// Check if second flashrom chip is present
|
||||||
|
if ((strcmp(cartID, "227E") == 0) || (strcmp(cartID, "8813") == 0)) {
|
||||||
cartSize = 64;
|
cartSize = 64;
|
||||||
}
|
strncpy(flashid , cartID, 5);
|
||||||
|
|
||||||
// Reset flashrom to read mode
|
// Reset flashrom to read mode
|
||||||
if (strcmp(flashid, "227E") == 0)
|
if (strcmp(flashid, "227E") == 0)
|
||||||
resetFlashrom_N64(romBase);
|
resetFlashrom_N64(romBase + 0x2000000);
|
||||||
else if ((strcmp(flashid, "8813") == 0) || (strcmp(flashid, "8816") == 0))
|
else if ((strcmp(flashid, "8813") == 0) || (strcmp(flashid, "8816") == 0))
|
||||||
resetReadmode_N64();
|
resetReadmode_N64();
|
||||||
}
|
}
|
||||||
|
// Empty cartID string
|
||||||
|
cartID[0] = '\0';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Erase Intel flashrom
|
// Erase Intel flashrom
|
||||||
|
Loading…
Reference in New Issue
Block a user