mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-23 21:19:16 +01:00
V19F: Fixed timing for GBA 1M flashrom save games
This commit is contained in:
parent
7b03f32968
commit
861998b155
@ -2,8 +2,8 @@
|
|||||||
Cartridge Reader for Arduino Mega2560
|
Cartridge Reader for Arduino Mega2560
|
||||||
|
|
||||||
Author: sanni
|
Author: sanni
|
||||||
Date: 2016-10-05
|
Date: 2016-10-06
|
||||||
Version: V19E
|
Version: V19F
|
||||||
|
|
||||||
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
|
||||||
@ -34,7 +34,7 @@
|
|||||||
YamaArashi - GBA flashrom bank switch command
|
YamaArashi - GBA flashrom bank switch command
|
||||||
|
|
||||||
**********************************************************************************/
|
**********************************************************************************/
|
||||||
char ver[5] = "V19E";
|
char ver[5] = "V19F";
|
||||||
|
|
||||||
/******************************************
|
/******************************************
|
||||||
Define Output
|
Define Output
|
||||||
|
@ -241,7 +241,7 @@ void gbaMenu() {
|
|||||||
println_Msg(F("Flashrom Type not supported"));
|
println_Msg(F("Flashrom Type not supported"));
|
||||||
print_Msg(F("ID: "));
|
print_Msg(F("ID: "));
|
||||||
println_Msg(flashid);
|
println_Msg(flashid);
|
||||||
print_Error(F(":("), true);
|
print_Error(F(""), true);
|
||||||
}
|
}
|
||||||
eraseFLASH_GBA();
|
eraseFLASH_GBA();
|
||||||
if (blankcheckFLASH_GBA(65536)) {
|
if (blankcheckFLASH_GBA(65536)) {
|
||||||
@ -264,7 +264,7 @@ void gbaMenu() {
|
|||||||
println_Msg(F("Flashrom Type not supported"));
|
println_Msg(F("Flashrom Type not supported"));
|
||||||
print_Msg(F("ID: "));
|
print_Msg(F("ID: "));
|
||||||
println_Msg(flashid);
|
println_Msg(flashid);
|
||||||
print_Error(F(":("), true);
|
print_Error(F(""), true);
|
||||||
}
|
}
|
||||||
eraseFLASH_GBA();
|
eraseFLASH_GBA();
|
||||||
// 131072 bytes are divided into two 65536 byte banks
|
// 131072 bytes are divided into two 65536 byte banks
|
||||||
@ -932,13 +932,13 @@ byte readByteFlash_GBA(unsigned long myAddress) {
|
|||||||
PORTK = (myAddress >> 8) & 0xFF;
|
PORTK = (myAddress >> 8) & 0xFF;
|
||||||
|
|
||||||
// Wait until byte is ready to read
|
// Wait until byte is ready to read
|
||||||
__asm__("nop\n\t""nop\n\t");
|
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||||
|
|
||||||
// Read byte
|
// Read byte
|
||||||
byte tempByte = PINC;
|
byte tempByte = PINC;
|
||||||
|
|
||||||
// Arduino running at 16Mhz -> one nop = 62.5ns
|
// Arduino running at 16Mhz -> one nop = 62.5ns
|
||||||
__asm__("nop\n\t");
|
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||||
|
|
||||||
return tempByte;
|
return tempByte;
|
||||||
}
|
}
|
||||||
@ -950,19 +950,19 @@ void writeByteFlash_GBA(unsigned long myAddress, byte myData) {
|
|||||||
|
|
||||||
// Arduino running at 16Mhz -> one nop = 62.5ns
|
// Arduino running at 16Mhz -> one nop = 62.5ns
|
||||||
// Wait till output is stable
|
// Wait till output is stable
|
||||||
__asm__("nop\n\t");
|
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||||
|
|
||||||
// Switch WE_FLASH(PH5) to LOW
|
// Switch WE_FLASH(PH5) to LOW
|
||||||
PORTH &= ~(1 << 5);
|
PORTH &= ~(1 << 5);
|
||||||
|
|
||||||
// Leave WE low for at least 40ns
|
// Leave WE low for at least 40ns
|
||||||
__asm__("nop\n\t");
|
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||||
|
|
||||||
// Switch WE_FLASH(PH5) to HIGH
|
// Switch WE_FLASH(PH5) to HIGH
|
||||||
PORTH |= (1 << 5);
|
PORTH |= (1 << 5);
|
||||||
|
|
||||||
// Leave WE high for a bit
|
// Leave WE high for a bit
|
||||||
__asm__("nop\n\t");
|
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Erase FLASH
|
// Erase FLASH
|
||||||
|
Loading…
Reference in New Issue
Block a user