mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-14 08:55:06 +01:00
Merge pull request #413 from karimhadjsalem/master
fix flashing of unrom-512 boards
This commit is contained in:
commit
eeb5298c9b
@ -4012,7 +4012,7 @@ void NESmaker_ResetFlash() { // Reset Flash
|
|||||||
write_prg_byte(0xC000, 0x00);
|
write_prg_byte(0xC000, 0x00);
|
||||||
write_prg_byte(0xAAAA, 0x55);
|
write_prg_byte(0xAAAA, 0x55);
|
||||||
write_prg_byte(0xC000, 0x01);
|
write_prg_byte(0xC000, 0x01);
|
||||||
write_prg_byte(0x9555, 0xFF); // Reset
|
write_prg_byte(0x9555, 0xF0); // Reset
|
||||||
}
|
}
|
||||||
|
|
||||||
// SST 39SF040 Software ID
|
// SST 39SF040 Software ID
|
||||||
@ -4027,12 +4027,7 @@ void NESmaker_ID() { // Read Flash ID
|
|||||||
unsigned char ID1 = read_prg_byte(0x8000);
|
unsigned char ID1 = read_prg_byte(0x8000);
|
||||||
unsigned char ID2 = read_prg_byte(0x8001);
|
unsigned char ID2 = read_prg_byte(0x8001);
|
||||||
sprintf(flashid, "%02X%02X", ID1, ID2);
|
sprintf(flashid, "%02X%02X", ID1, ID2);
|
||||||
write_prg_byte(0xC000, 0x01);
|
NESmaker_ResetFlash(); // Software ID Exit
|
||||||
write_prg_byte(0x9555, 0xAA);
|
|
||||||
write_prg_byte(0xC000, 0x00);
|
|
||||||
write_prg_byte(0xAAAA, 0x55);
|
|
||||||
write_prg_byte(0xC000, 0x01);
|
|
||||||
write_prg_byte(0x9555, 0xF0); // Software ID Exit
|
|
||||||
if (strcmp(flashid, "BFB7") == 0) // SST 39SF040
|
if (strcmp(flashid, "BFB7") == 0) // SST 39SF040
|
||||||
flashfound = 1;
|
flashfound = 1;
|
||||||
}
|
}
|
||||||
@ -4110,6 +4105,7 @@ void writeFLASH() {
|
|||||||
|
|
||||||
//open file on sd card
|
//open file on sd card
|
||||||
if (myFile.open(filePath, O_READ)) {
|
if (myFile.open(filePath, O_READ)) {
|
||||||
|
myFile.seekSet(16);
|
||||||
banks = int_pow(2, prgsize); // 256K/512K
|
banks = int_pow(2, prgsize); // 256K/512K
|
||||||
for (int i = 0; i < banks; i++) { // 16K Banks
|
for (int i = 0; i < banks; i++) { // 16K Banks
|
||||||
for (word sector = 0; sector < 0x4000; sector += 0x1000) { // 4K Sectors ($8000/$9000/$A000/$B000)
|
for (word sector = 0; sector < 0x4000; sector += 0x1000) { // 4K Sectors ($8000/$9000/$A000/$B000)
|
||||||
|
Loading…
Reference in New Issue
Block a user