mirror of
https://github.com/sanni/cartreader.git
synced 2025-01-11 20:49:06 +01:00
Fix compiler warnings/errors
This commit is contained in:
parent
edc2b2fa15
commit
06243694d4
@ -291,7 +291,7 @@ void writeData3F_2600(uint16_t addr, uint8_t data) {
|
||||
boolean checkE7(uint16_t bank) {
|
||||
writeData_2600(0x1800, 0xFF);
|
||||
readData_2600(0x1FE0 + bank);
|
||||
uint32_t testdata = (readData_2600(0x1000) << 24) | (readData_2600(0x1001) << 16) | (readData_2600(0x1002) << 8) | (readData_2600(0x1003));
|
||||
uint32_t testdata = ((uint32_t)readData_2600(0x1000) << 24) | ((uint32_t)readData_2600(0x1001) << 16) | (readData_2600(0x1002) << 8) | (readData_2600(0x1003));
|
||||
return (testdata == 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,8 @@
|
||||
Uzlopak, sakman55, Tombo89, scrap-a, borti4938, vogelfreiheit, CaitSith2, Modman, Chomemel,
|
||||
philenotfound, karimhadjsalem, nsx0r, ducky92, niklasweber, Lesserkuma, BacteriaMage, qufb,
|
||||
vpelletier, Ancyker, mattiacci, RWeick, ButThouMust, partlyhuman, fakkuyuu, hxlnt, breyell,
|
||||
smesgr9000, joshman196, PsychoFox11, plaidpants, LuigiBlood, InvalidInterrupt
|
||||
smesgr9000, joshman196, PsychoFox11, plaidpants, LuigiBlood, InvalidInterrupt, andy-miles,
|
||||
wfmarques
|
||||
|
||||
And to nocash for figuring out the secrets of the SFC Nintendo Power cartridge.
|
||||
|
||||
|
@ -35,12 +35,12 @@ byte jagSaveType = 0; // Serial EEPROM
|
||||
// SERIAL EEPROM 93CX6
|
||||
// CONTROL: EEPCS (PA7), EEPSK (PA6), EEPDI (PF0) [DATA D0]
|
||||
// SERIAL DATA OUTPUT: EEPDO (PA5)
|
||||
#define EEP_CS_SET PORTA |= (1<<7)
|
||||
#define EEP_CS_CLEAR PORTA &= ~(1<<7)
|
||||
#define EEP_SK_SET PORTA |= (1<<6)
|
||||
#define EEP_SK_CLEAR PORTA &= ~(1<<6)
|
||||
#define EEP_DI_SET PORTF |= (1<<0)
|
||||
#define EEP_DI_CLEAR PORTF &= ~(1<<0)
|
||||
#define EEP_CS_SET PORTA |= (1 << 7)
|
||||
#define EEP_CS_CLEAR PORTA &= ~(1 << 7)
|
||||
#define EEP_SK_SET PORTA |= (1 << 6)
|
||||
#define EEP_SK_CLEAR PORTA &= ~(1 << 6)
|
||||
#define EEP_DI_SET PORTF |= (1 << 0)
|
||||
#define EEP_DI_CLEAR PORTF &= ~(1 << 0)
|
||||
|
||||
// SERIAL EEPROM SIZES
|
||||
// 0 = 93C46 = 128 byte = Standard
|
||||
@ -74,21 +74,21 @@ static const char* const menuOptionsJag[] PROGMEM = { FSTRING_SELECT_CART, FSTRI
|
||||
static const char jagRomItem1[] PROGMEM = "1MB ROM";
|
||||
static const char jagRomItem2[] PROGMEM = "2MB ROM";
|
||||
static const char jagRomItem3[] PROGMEM = "4MB ROM";
|
||||
static const char* const jagRomMenu[] PROGMEM = {jagRomItem1, jagRomItem2, jagRomItem3};
|
||||
static const char* const jagRomMenu[] PROGMEM = { jagRomItem1, jagRomItem2, jagRomItem3 };
|
||||
|
||||
static const char jagEepItem1[] PROGMEM = "128B (93C46)";
|
||||
static const char jagEepItem2[] PROGMEM = "256B (93C56)";
|
||||
static const char jagEepItem3[] PROGMEM = "512B (93C66)";
|
||||
static const char jagEepItem4[] PROGMEM = "1024B (93C76)";
|
||||
static const char jagEepItem5[] PROGMEM = "2048B (93C86)";
|
||||
static const char* const jagSaveMenu[] PROGMEM = {jagEepItem1, jagEepItem2, jagEepItem3, jagEepItem4, jagEepItem5};
|
||||
static const char* const ConfirmMenu[] PROGMEM = {FSTRING_OK, FSTRING_RESET};
|
||||
static const char* const jagSaveMenu[] PROGMEM = { jagEepItem1, jagEepItem2, jagEepItem3, jagEepItem4, jagEepItem5 };
|
||||
static const char* const ConfirmMenu[] PROGMEM = { FSTRING_OK, FSTRING_RESET };
|
||||
void jagMenu() {
|
||||
|
||||
convertPgm(menuOptionsJag, 7);
|
||||
uint8_t mainMenu = question_box(F("Jaguar MENU"), menuOptions, 8, 0);
|
||||
|
||||
// wait for user choice to come back from the question box menu
|
||||
// wait for user choice to come back from the question box menu
|
||||
switch (mainMenu) {
|
||||
// Select Cart
|
||||
case 0:
|
||||
@ -129,8 +129,7 @@ void jagMenu() {
|
||||
fileBrowser(FS(FSTRING_SELECT_FILE));
|
||||
display_Clear();
|
||||
writeJagEEP();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
println_Msg(F("Cart has no EEPROM"));
|
||||
display.display();
|
||||
}
|
||||
@ -157,8 +156,7 @@ void jagMenu() {
|
||||
display_Clear();
|
||||
writeJagFLASH();
|
||||
verifyJagFLASH();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
println_Msg(F("Cart has no FLASH"));
|
||||
display.display();
|
||||
}
|
||||
@ -187,14 +185,14 @@ void readDataLine_Jag(FsFile& database, void* entry) {
|
||||
|
||||
// Read rom size
|
||||
// Read the next ascii character and subtract 48 to convert to decimal
|
||||
castEntry->gameSize = (database.read()-48);
|
||||
castEntry->gameSize = (database.read() - 48);
|
||||
|
||||
// Skip over semicolon
|
||||
database.seekCur(1);
|
||||
|
||||
// Read save size
|
||||
// Read the next ascii character and subtract 48 to convert to decimal
|
||||
castEntry->saveSize = (database.read()-48);
|
||||
castEntry->saveSize = (database.read() - 48);
|
||||
|
||||
// Skip rest of line
|
||||
database.seekCur(2);
|
||||
@ -206,10 +204,10 @@ void printDataLine_Jag(void* entry) {
|
||||
print_Msg(castEntry->gameSize);
|
||||
println_Msg(F("MB"));
|
||||
// 0 = 93C46 = 128 byte = Standard
|
||||
// 1 = 93C56 = 256 byte = Aftermarket
|
||||
// 2 = 93C66 = 512 byte = Aftermarket
|
||||
// 3 = 93C76 = 1024 byte = Aftermarket
|
||||
// 4 = 93C86 = 2048 byte = Aftermarket - Battlesphere Gold
|
||||
// 1 = 93C56 = 256 byte = Aftermarket
|
||||
// 2 = 93C66 = 512 byte = Aftermarket
|
||||
// 3 = 93C76 = 1024 byte = Aftermarket
|
||||
// 4 = 93C86 = 2048 byte = Aftermarket - Battlesphere Gold
|
||||
switch (castEntry->saveSize) {
|
||||
case 0:
|
||||
println_Msg(F("Save: 128B"));
|
||||
@ -272,7 +270,7 @@ void setCart_Jag() {
|
||||
seek_first_letter_in_database(myFile, myLetter);
|
||||
|
||||
|
||||
if(checkCartSelection(myFile, &readDataLine_Jag, &entry, &printDataLine_Jag,&setRomnameFromString)) {
|
||||
if (checkCartSelection(myFile, &readDataLine_Jag, &entry, &printDataLine_Jag, &setRomnameFromString)) {
|
||||
EEPROM_writeAnything(10, entry.saveSize);
|
||||
jagEepSize = entry.saveSize;
|
||||
switch (entry.gameSize) {
|
||||
@ -426,8 +424,7 @@ void setup_Jag() {
|
||||
strcpy(romName, "jagMemorytrack");
|
||||
jagCartSize = 0x20000;
|
||||
jagflaSize = 0x20000;
|
||||
}
|
||||
else
|
||||
} else
|
||||
setCart_Jag();
|
||||
getJagCartInfo();
|
||||
|
||||
@ -448,18 +445,16 @@ void getJagCartInfo() {
|
||||
if (jagMemorytrack) {
|
||||
print_Msg(jagCartSize / 1024);
|
||||
println_Msg(F(" KB"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
|
||||
print_Msg(jagCartSize / 1024 / 1024 );
|
||||
print_Msg(jagCartSize / 1024 / 1024);
|
||||
println_Msg(F(" MB"));
|
||||
}
|
||||
if (jagSaveType == 0) {
|
||||
print_Msg(F("EEPROM: "));
|
||||
print_Msg(int_pow(2, jagEepSize) * 128); // 128/256/512/1024/2048 BYTES
|
||||
println_Msg(F(" B"));
|
||||
}
|
||||
else if (jagSaveType == 1) {
|
||||
} else if (jagSaveType == 1) {
|
||||
print_Msg(F("FLASH: "));
|
||||
print_Msg(jagflaSize / 1024);
|
||||
println_Msg(F(" KB"));
|
||||
@ -500,8 +495,7 @@ void shiftOutFAST(byte addr) { //
|
||||
CLOCK_CLEAR;
|
||||
if (addr & (1 << i)) {
|
||||
SER_SET; // 1
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
SER_CLEAR; // 0
|
||||
}
|
||||
CLOCK_SET; // shift bit
|
||||
@ -532,7 +526,18 @@ void readJagData(unsigned long myAddress) {
|
||||
PORTH &= ~(1 << 3) & ~(1 << 4);
|
||||
|
||||
// Long delay here or there will be read errors
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
// Read
|
||||
tempDataLO = (((PINK & 0xFF) << 8) | (PINF & 0xFF)); // D0-D15 [ROM U1]
|
||||
@ -542,7 +547,12 @@ void readJagData(unsigned long myAddress) {
|
||||
PORTH |= (1 << 3) | (1 << 4);
|
||||
// Setting CE(PH5) HIGH
|
||||
PORTH |= (1 << 5);
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
SRCLR_CLEAR;
|
||||
}
|
||||
@ -579,7 +589,7 @@ void readJagROM() {
|
||||
// create a new folder
|
||||
sd.chdir();
|
||||
EEPROM_readAnything(0, foldern);
|
||||
// sprintf(folder, "JAG/ROM/%s/%d", romName, foldern);
|
||||
// sprintf(folder, "JAG/ROM/%s/%d", romName, foldern);
|
||||
sprintf(folder, "JAG/ROM/%d", foldern);
|
||||
sd.mkdir(folder, true);
|
||||
sd.chdir(folder);
|
||||
@ -739,8 +749,7 @@ void EepromWriteData(void) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (((UPPER >> 7) & 0x1) == 1) { // Bit is HIGH
|
||||
Eeprom1();
|
||||
}
|
||||
else { // Bit is LOW
|
||||
} else { // Bit is LOW
|
||||
Eeprom0();
|
||||
}
|
||||
// rotate to the next bit
|
||||
@ -749,8 +758,7 @@ void EepromWriteData(void) {
|
||||
for (int j = 0; j < 8; j++) {
|
||||
if (((LOWER >> 7) & 0x1) == 1) { // Bit is HIGH
|
||||
Eeprom1();
|
||||
}
|
||||
else { // Bit is LOW
|
||||
} else { // Bit is LOW
|
||||
Eeprom0();
|
||||
}
|
||||
// rotate to the next bit
|
||||
@ -763,8 +771,7 @@ void jagEepromSetAddress(uint16_t addr) { // 16bit
|
||||
for (int i = 0; i < shiftaddr; i++) {
|
||||
if (((addr >> shiftaddr) & 1) == 1) { // Bit is HIGH
|
||||
Eeprom1();
|
||||
}
|
||||
else { // Bit is LOW
|
||||
} else { // Bit is LOW
|
||||
Eeprom0();
|
||||
}
|
||||
// rotate to the next bit
|
||||
@ -800,7 +807,9 @@ void EepromEWEN(void) { // EWEN 10011xxxx
|
||||
}
|
||||
EEP_CS_CLEAR;
|
||||
_delay_us(2);
|
||||
#ifdef SERIAL_MONITOR
|
||||
Serial.println(F("ERASE ENABLED"));
|
||||
#endif
|
||||
}
|
||||
|
||||
void EepromERAL(void) { // ERASE ALL 10010xxxx
|
||||
@ -827,7 +836,9 @@ void EepromERAL(void) { // ERASE ALL 10010xxxx
|
||||
}
|
||||
EEP_CS_CLEAR;
|
||||
jagEepromStatus();
|
||||
#ifdef SERIAL_MONITOR
|
||||
Serial.println(F("ERASED ALL"));
|
||||
#endif
|
||||
}
|
||||
|
||||
void EepromEWDS(void) { // DISABLE 10000xxxx
|
||||
@ -855,22 +866,25 @@ void EepromEWDS(void) { // DISABLE 10000xxxx
|
||||
}
|
||||
EEP_CS_CLEAR;
|
||||
_delay_us(2);
|
||||
#ifdef SERIAL_MONITOR
|
||||
Serial.println(F("ERASE DISABLED"));
|
||||
#endif
|
||||
}
|
||||
|
||||
void jagEepromStatus(void) {// CHECK READY/BUSY
|
||||
__asm__("nop\n\t""nop\n\t"); // CS LOW for minimum 100ns
|
||||
void jagEepromStatus(void) { // CHECK READY/BUSY
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"); // CS LOW for minimum 100ns
|
||||
EEP_CS_SET;
|
||||
boolean status = ((PINA & 0x20) >> 5); // Check DO
|
||||
do {
|
||||
_delay_ms(1);
|
||||
status = ((PINA & 0x20) >> 5);
|
||||
}
|
||||
while (!status); // status == 0 = BUSY
|
||||
} while (!status); // status == 0 = BUSY
|
||||
EEP_CS_CLEAR;
|
||||
}
|
||||
|
||||
void EepromDisplay(){ // FOR SERIAL ONLY
|
||||
#ifdef SERIAL_MONITOR
|
||||
void EepromDisplay() { // FOR SERIAL ONLY
|
||||
word eepEnd = int_pow(2, jagEepSize) * 128;
|
||||
for (word address = 0; address < eepEnd; address += 2) {
|
||||
EepromRead(address);
|
||||
@ -888,7 +902,7 @@ void EepromDisplay(){ // FOR SERIAL ONLY
|
||||
Serial.println(F(""));
|
||||
Serial.println(F(""));
|
||||
}
|
||||
|
||||
#endif
|
||||
//*****************************************************************************
|
||||
// EEPROM
|
||||
// (0) 93C46 128B STANDARD
|
||||
@ -907,7 +921,7 @@ void readJagEEP() {
|
||||
// create a new folder for the save file
|
||||
EEPROM_readAnything(0, foldern);
|
||||
sd.chdir();
|
||||
// sprintf(folder, "JAG/SAVE/%s/%d", romName, foldern);
|
||||
// sprintf(folder, "JAG/SAVE/%s/%d", romName, foldern);
|
||||
sprintf(folder, "JAG/SAVE/%d", foldern);
|
||||
sd.mkdir(folder, true);
|
||||
sd.chdir(folder);
|
||||
@ -935,8 +949,7 @@ void readJagEEP() {
|
||||
}
|
||||
myFile.write(sdBuffer, 512);
|
||||
}
|
||||
}
|
||||
else { // 93C46/93C56 - 64/128 WORDS
|
||||
} else { // 93C46/93C56 - 64/128 WORDS
|
||||
for (word currWord = 0; currWord < eepEnd; currWord++) {
|
||||
EepromRead(currWord * 2);
|
||||
sdBuffer[(currWord * 2)] = jagEepBuf[1];
|
||||
@ -966,7 +979,9 @@ void writeJagEEP() {
|
||||
if (myFile.open(filePath, O_READ)) {
|
||||
EepromEWEN(); // ERASE/WRITE ENABLE
|
||||
EepromERAL(); // ERASE ALL
|
||||
#ifdef SERIAL_MONITOR
|
||||
Serial.println(F("WRITING"));
|
||||
#endif
|
||||
word eepEnd = int_pow(2, jagEepSize) * 64; // WORDS
|
||||
if (jagEepSize > 1) { // 93C66/93C76/93C86
|
||||
for (word currWord = 0; currWord < eepEnd; currWord += 256) {
|
||||
@ -977,8 +992,7 @@ void writeJagEEP() {
|
||||
EepromWrite((currWord + i) * 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else { // 93C46/93C56
|
||||
} else { // 93C46/93C56
|
||||
myFile.read(sdBuffer, eepEnd * 2);
|
||||
for (word currWord = 0; currWord < eepEnd; currWord++) {
|
||||
jagEepBuf[0] = sdBuffer[currWord * 2];
|
||||
@ -993,8 +1007,7 @@ void writeJagEEP() {
|
||||
println_Msg(F(""));
|
||||
println_Msg(F("DONE"));
|
||||
display_Update();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
println_Msg(F("SD ERROR"));
|
||||
println_Msg(F("Press Button to Reset"));
|
||||
display_Update();
|
||||
@ -1074,13 +1087,23 @@ void busyCheck() {
|
||||
PORTH |= (1 << 5);
|
||||
|
||||
// Leave CE high for at least 60ns
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
// Setting CE(PH5) LOW
|
||||
PORTH &= ~(1 << 5);
|
||||
|
||||
// Leave CE low for at least 50ns
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
// Read register
|
||||
readBYTE_FLASH(0x0000);
|
||||
@ -1100,7 +1123,12 @@ byte readBYTE_FLASH(unsigned long myAddress) {
|
||||
LATCH_SET;
|
||||
|
||||
// Arduino running at 16Mhz -> one nop = 62.5ns
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
// Setting CE(PH5) LOW
|
||||
PORTH &= ~(1 << 5);
|
||||
@ -1109,7 +1137,18 @@ byte readBYTE_FLASH(unsigned long myAddress) {
|
||||
// Setting OEL(PH4) LOW
|
||||
PORTH &= ~(1 << 4);
|
||||
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
// Read
|
||||
byte tempByte = PINL; // D16..D23
|
||||
@ -1119,7 +1158,12 @@ byte readBYTE_FLASH(unsigned long myAddress) {
|
||||
// Setting OEL(PH4) HIGH
|
||||
PORTH |= (1 << 4);
|
||||
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
return tempByte;
|
||||
}
|
||||
@ -1134,14 +1178,30 @@ byte readBYTE_MEMROM(unsigned long myAddress) {
|
||||
LATCH_SET;
|
||||
|
||||
// Arduino running at 16Mhz -> one nop = 62.5ns
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
// Setting CE(PH5) LOW
|
||||
PORTH &= ~(1 << 5);
|
||||
// Setting OEH(PH3) LOW
|
||||
PORTH &= ~(1 << 3);
|
||||
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
// Read
|
||||
byte tempByte = PINF; // D0..D7
|
||||
@ -1151,7 +1211,12 @@ byte readBYTE_MEMROM(unsigned long myAddress) {
|
||||
// Setting OEH(PH3) HIGH
|
||||
PORTH |= (1 << 3);
|
||||
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
return tempByte;
|
||||
}
|
||||
@ -1167,7 +1232,12 @@ void writeBYTE_FLASH(unsigned long myAddress, byte myData) {
|
||||
|
||||
PORTL = myData;
|
||||
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
// Setting OEL(PH4) HIGH
|
||||
PORTH |= (1 << 4);
|
||||
@ -1202,22 +1272,29 @@ void writeSECTOR_FLASH(unsigned long myAddress) {
|
||||
LATCH_SET;
|
||||
|
||||
PORTL = sdBuffer[i];
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
// Setting OEL(PH4) HIGH
|
||||
// PORTH |= (1 << 4);
|
||||
// PORTH |= (1 << 4);
|
||||
// Setting CE(PH5) LOW
|
||||
PORTH &= ~(1 << 5);
|
||||
// Switch WE(PH6) LOW
|
||||
PORTH &= ~(1 << 6);
|
||||
__asm__("nop\n\t""nop\n\t"); // Minimum 90ns
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"); // Minimum 90ns
|
||||
|
||||
// Switch WE(PH6) HIGH
|
||||
PORTH |= (1 << 6);
|
||||
// Setting CE(PH5) HIGH
|
||||
PORTH |= (1 << 5);
|
||||
|
||||
__asm__("nop\n\t""nop\n\t"); // Minimum 100ns
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"); // Minimum 100ns
|
||||
}
|
||||
delay(30);
|
||||
}
|
||||
@ -1239,7 +1316,7 @@ void readJagMEMORY() {
|
||||
// create a new folder
|
||||
sd.chdir();
|
||||
EEPROM_readAnything(0, foldern);
|
||||
// sprintf(folder, "JAG/ROM/%s/%d", romName, foldern);
|
||||
// sprintf(folder, "JAG/ROM/%s/%d", romName, foldern);
|
||||
sprintf(folder, "JAG/ROM/%d", foldern);
|
||||
sd.mkdir(folder, true);
|
||||
sd.chdir(folder);
|
||||
@ -1283,7 +1360,6 @@ void readJagMEMORY() {
|
||||
|
||||
println_Msg(F("Press Button..."));
|
||||
wait();
|
||||
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
@ -1302,7 +1378,7 @@ void readJagFLASH() {
|
||||
// create a new folder for the save file
|
||||
sd.chdir();
|
||||
EEPROM_readAnything(0, foldern);
|
||||
// sprintf(folder, "JAG/SAVE/%s/%d", romName, foldern);
|
||||
// sprintf(folder, "JAG/SAVE/%s/%d", romName, foldern);
|
||||
sprintf(folder, "JAG/SAVE/%d", foldern);
|
||||
sd.mkdir(folder, true);
|
||||
sd.chdir(folder);
|
||||
@ -1384,8 +1460,7 @@ void writeJagFLASH() {
|
||||
myFile.close();
|
||||
println_Msg(F("WRITE COMPLETE"));
|
||||
display_Update();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
println_Msg(F("SD ERROR"));
|
||||
println_Msg(F("Press Button to Reset"));
|
||||
display_Update();
|
||||
@ -1418,8 +1493,7 @@ unsigned long verifyJagFLASH() {
|
||||
}
|
||||
// Close the file:
|
||||
myFile.close();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
println_Msg(F("SD ERROR"));
|
||||
println_Msg(F("Press Button to Reset"));
|
||||
display_Update();
|
||||
@ -1450,7 +1524,7 @@ void writeConfirm() {
|
||||
convertPgm(ConfirmMenu, 4);
|
||||
uint8_t resetMenu = question_box(F("CONTINUE?"), menuOptions, 2, 0);
|
||||
|
||||
// wait for user choice to come back from the question box menu
|
||||
// wait for user choice to come back from the question box menu
|
||||
switch (resetMenu) {
|
||||
case 0:
|
||||
return;
|
||||
@ -1459,7 +1533,6 @@ void writeConfirm() {
|
||||
wait();
|
||||
resetArduino();
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
//******************************************
|
||||
|
@ -105,7 +105,7 @@ byte ljprosize;
|
||||
byte newljprosize;
|
||||
|
||||
char mnfID[3];
|
||||
char deviceID[5];
|
||||
char deviceID_str[5];
|
||||
boolean ljproflash1found = false;
|
||||
boolean ljproflash2found = false;
|
||||
byte ljproflash1size;
|
||||
@ -346,18 +346,18 @@ void readID_U1() // Parallel Mode
|
||||
CS1_HIGH; // U1 HIGH
|
||||
// Flash ID
|
||||
sprintf(mnfID, "%02X", id0);
|
||||
sprintf(deviceID, "%02X%02X", id1, id2);
|
||||
sprintf(deviceID_str, "%02X%02X", id1, id2);
|
||||
// println_Msg(mnfID);
|
||||
// println_Msg(deviceID);
|
||||
// println_Msg(deviceID_str);
|
||||
// display_Update();
|
||||
if(strcmp(deviceID, "2015") == 0) { // MX25L1605
|
||||
if(strcmp(deviceID_str, "2015") == 0) { // MX25L1605
|
||||
ljproflash1found = 1;
|
||||
ljproflash1size = 2;
|
||||
display_Clear();
|
||||
println_Msg(F("U1 MX25L1605 FOUND"));
|
||||
display_Update();
|
||||
}
|
||||
else if (strcmp(deviceID, "2016") == 0) { // MX25L3205
|
||||
else if (strcmp(deviceID_str, "2016") == 0) { // MX25L3205
|
||||
ljproflash1found = 1;
|
||||
ljproflash1size = 4;
|
||||
display_Clear();
|
||||
@ -380,17 +380,17 @@ void readID_U2() // Parallel Mode
|
||||
CS2_HIGH; // U2 HIGH
|
||||
// Flash ID
|
||||
sprintf(mnfID, "%02X", id0);
|
||||
sprintf(deviceID, "%02X%02X", id1, id2);
|
||||
sprintf(deviceID_str, "%02X%02X", id1, id2);
|
||||
// println_Msg(mnfID);
|
||||
// println_Msg(deviceID);
|
||||
// println_Msg(deviceID_str);
|
||||
// display_Update();
|
||||
if(strcmp(deviceID, "2015") == 0) { // MX25L1605
|
||||
if(strcmp(deviceID_str, "2015") == 0) { // MX25L1605
|
||||
ljproflash2found = 1;
|
||||
ljproflash2size = 2;
|
||||
println_Msg(F("U2 MX25L1605 FOUND"));
|
||||
display_Update();
|
||||
}
|
||||
else if (strcmp(deviceID, "2016") == 0) { // MX25L3205
|
||||
else if (strcmp(deviceID_str, "2016") == 0) { // MX25L3205
|
||||
ljproflash2found = 1;
|
||||
ljproflash2size = 4;
|
||||
println_Msg(F("U2 MX25L3205 FOUND"));
|
||||
|
@ -76,10 +76,10 @@
|
||||
#define NAND_1A_LOW PORTH &= ~(1 << 3)
|
||||
#define NAND_1B_HIGH PORTH |= (1 << 4)
|
||||
#define NAND_1B_LOW PORTH &= ~(1 << 4) // Built-in RAM + I/O
|
||||
#define WE_HIGH PORTH |= (1 << 5)
|
||||
#define WE_LOW PORTH &= ~(1 << 5)
|
||||
#define OE_HIGH PORTH |= (1 << 6)
|
||||
#define OE_LOW PORTH &= ~(1 << 6)
|
||||
#define WE_HIGH_PCW PORTH |= (1 << 5)
|
||||
#define WE_LOW_PCW PORTH &= ~(1 << 5)
|
||||
#define OE_HIGH_PCW PORTH |= (1 << 6)
|
||||
#define OE_LOW_PCW PORTH &= ~(1 << 6)
|
||||
|
||||
#define MODE_READ DDRC = 0 // [INPUT]
|
||||
#define MODE_WRITE DDRC = 0xFF //[OUTPUT]
|
||||
@ -207,8 +207,8 @@ void read_setup_PCW()
|
||||
{
|
||||
NAND_1A_HIGH;
|
||||
NAND_1B_HIGH;
|
||||
OE_HIGH;
|
||||
WE_HIGH;
|
||||
OE_HIGH_PCW;
|
||||
WE_HIGH_PCW;
|
||||
LE_LOW;
|
||||
}
|
||||
|
||||
@ -226,11 +226,11 @@ unsigned char read_rom_byte_PCW(unsigned long address)
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t");
|
||||
// Read Data on AD0-AD7
|
||||
OE_LOW;
|
||||
OE_LOW_PCW;
|
||||
DATA_READ;
|
||||
delayMicroseconds(5); // 3+ Microseconds for Problem Carts
|
||||
unsigned char data = PINC;
|
||||
OE_HIGH;
|
||||
OE_HIGH_PCW;
|
||||
|
||||
return data;
|
||||
}
|
||||
@ -254,7 +254,7 @@ unsigned char read_ram_byte_1A_PCW(unsigned long address)
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
// Read Data on AD0-AD7
|
||||
OE_LOW;
|
||||
OE_LOW_PCW;
|
||||
DATA_READ;
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
@ -263,7 +263,7 @@ unsigned char read_ram_byte_1A_PCW(unsigned long address)
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
unsigned char data = PINC;
|
||||
OE_HIGH;
|
||||
OE_HIGH_PCW;
|
||||
NAND_1A_HIGH;
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
@ -300,7 +300,7 @@ unsigned char read_ram_byte_1B_PCW(unsigned long address)
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
// Read Data on AD0-AD7
|
||||
OE_LOW;
|
||||
OE_LOW_PCW;
|
||||
DATA_READ;
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
@ -309,7 +309,7 @@ unsigned char read_ram_byte_1B_PCW(unsigned long address)
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
unsigned char data = PINC;
|
||||
OE_HIGH;
|
||||
OE_HIGH_PCW;
|
||||
NAND_1B_HIGH;
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
@ -333,13 +333,13 @@ void write_ram_byte_1A_PCW(unsigned long address, unsigned char data)
|
||||
PORTC = address & 0xFF; // A0-A7
|
||||
LE_LOW; // Address Latched
|
||||
// Write Data on AD0-AD7 - WE LOW ~240-248ns
|
||||
WE_LOW;
|
||||
WE_LOW_PCW;
|
||||
PORTC = data;
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
WE_HIGH;
|
||||
WE_HIGH_PCW;
|
||||
NAND_1A_HIGH;
|
||||
}
|
||||
|
||||
@ -358,7 +358,7 @@ void write_ram_byte_1B_PCW(unsigned long address, unsigned char data)
|
||||
PORTC = address & 0xFF; // A0-A7
|
||||
LE_LOW; // Address Latched
|
||||
// Write Data on AD0-AD7 - WE LOW ~740ns
|
||||
WE_LOW;
|
||||
WE_LOW_PCW;
|
||||
PORTC = data;
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
@ -370,7 +370,7 @@ void write_ram_byte_1B_PCW(unsigned long address, unsigned char data)
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
WE_HIGH;
|
||||
WE_HIGH_PCW;
|
||||
NAND_1B_HIGH;
|
||||
}
|
||||
|
||||
@ -540,13 +540,13 @@ void write_bank_byte_PCW(unsigned char data)
|
||||
PORTC = 0xFF; // A0-A7
|
||||
LE_LOW; // Address Latched
|
||||
// Write Data on AD0-AD7 - WE LOW ~728-736ns
|
||||
WE_LOW;
|
||||
WE_LOW_PCW;
|
||||
PORTC = data;
|
||||
|
||||
for (unsigned int x = 0; x < 40; x++)
|
||||
__asm__("nop\n\t");
|
||||
|
||||
WE_HIGH;
|
||||
WE_HIGH_PCW;
|
||||
NAND_1B_HIGH;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user