From 18e387d1654c5661349ca25954d6147104806c97 Mon Sep 17 00:00:00 2001 From: laqieer Date: Sat, 3 Jul 2021 21:38:46 +0800 Subject: [PATCH] Fix Flash chip's erase operation: erased memory is FFh-filled, not zero-filled. --- src/gba/Flash.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gba/Flash.cpp b/src/gba/Flash.cpp index c3c5585a..9d0124e0 100644 --- a/src/gba/Flash.cpp +++ b/src/gba/Flash.cpp @@ -172,13 +172,13 @@ void flashWrite(uint32_t address, uint8_t byte) if (byte == 0x30) { // SECTOR ERASE memset(&flashSaveMemory[(flashBank << 16) + (address & 0xF000)], - 0, + 0xff, 0x1000); systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; flashReadState = FLASH_ERASE_COMPLETE; } else if (byte == 0x10) { // CHIP ERASE - memset(flashSaveMemory, 0, flashSize); + memset(flashSaveMemory, 0xff, flashSize); systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; flashReadState = FLASH_ERASE_COMPLETE; } else {