From a7efb5d1407fa3f70cc2124f63066b2cb656dc0c Mon Sep 17 00:00:00 2001 From: karim <64852495+karimhadjsalem@users.noreply.github.com> Date: Mon, 18 Jul 2022 20:29:50 -0400 Subject: [PATCH 1/2] fix flashing unrom-512 to match INL code --- Cart_Reader/NES.ino | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Cart_Reader/NES.ino b/Cart_Reader/NES.ino index f04ef27..bd69b6d 100644 --- a/Cart_Reader/NES.ino +++ b/Cart_Reader/NES.ino @@ -4027,12 +4027,7 @@ void NESmaker_ID() { // Read Flash ID unsigned char ID1 = read_prg_byte(0x8000); unsigned char ID2 = read_prg_byte(0x8001); sprintf(flashid, "%02X%02X", ID1, ID2); - write_prg_byte(0xC000, 0x01); - 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 + NESmaker_ResetFlash(); // Software ID Exit if (strcmp(flashid, "BFB7") == 0) // SST 39SF040 flashfound = 1; } @@ -4110,6 +4105,7 @@ void writeFLASH() { //open file on sd card if (myFile.open(filePath, O_READ)) { + myFile.seekSet(16); banks = int_pow(2, prgsize); // 256K/512K for (int i = 0; i < banks; i++) { // 16K Banks for (word sector = 0; sector < 0x4000; sector += 0x1000) { // 4K Sectors ($8000/$9000/$A000/$B000) From 36c6c657d672adaeb349081b27e02f260b484763 Mon Sep 17 00:00:00 2001 From: karim <64852495+karimhadjsalem@users.noreply.github.com> Date: Mon, 18 Jul 2022 20:35:48 -0400 Subject: [PATCH 2/2] fix reset byte --- Cart_Reader/NES.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cart_Reader/NES.ino b/Cart_Reader/NES.ino index bd69b6d..7a6b8d0 100644 --- a/Cart_Reader/NES.ino +++ b/Cart_Reader/NES.ino @@ -4012,7 +4012,7 @@ void NESmaker_ResetFlash() { // Reset Flash write_prg_byte(0xC000, 0x00); write_prg_byte(0xAAAA, 0x55); write_prg_byte(0xC000, 0x01); - write_prg_byte(0x9555, 0xFF); // Reset + write_prg_byte(0x9555, 0xF0); // Reset } // SST 39SF040 Software ID