From eee9b165a0d269f37dd5c444d900c634d5906dcd Mon Sep 17 00:00:00 2001 From: sanni Date: Fri, 1 Mar 2019 19:16:33 +0100 Subject: [PATCH] V2.9: Fix writing MBC3 flashcart --- Cart_Reader/Cart_Reader.ino | 6 +++--- Cart_Reader/GB.ino | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Cart_Reader/Cart_Reader.ino b/Cart_Reader/Cart_Reader.ino index 3f1974f..1437382 100644 --- a/Cart_Reader/Cart_Reader.ino +++ b/Cart_Reader/Cart_Reader.ino @@ -2,8 +2,8 @@ Cartridge Reader for Arduino Mega2560 Author: sanni - Date: 18-02-2019 - Version: 2.8 + Date: 01-03-2019 + Version: 2.9 SD lib: https://github.com/greiman/SdFat LCD lib: https://github.com/adafruit/Adafruit_SSD1306 @@ -37,7 +37,7 @@ vogelfreiheit - N64 flashram fix **********************************************************************************/ -char ver[5] = "2.8"; +char ver[5] = "2.9"; /****************************************** Define Starting Point diff --git a/Cart_Reader/GB.ino b/Cart_Reader/GB.ino index a8afc93..db98d1a 100644 --- a/Cart_Reader/GB.ino +++ b/Cart_Reader/GB.ino @@ -858,19 +858,21 @@ void writeFlash_GB(byte MBC) { dataOut(); uint16_t currAddr = 0; + uint16_t endAddr = 0x3FFF; - for (int currBank = 1; currBank < romBanks; currBank++) { + for (int currBank = 0; currBank < romBanks; currBank++) { // Blink led PORTB ^= (1 << 4); // Set ROM bank writeByte_GB(0x2100, currBank); - if (currBank > 1) { + if (currBank > 0) { currAddr = 0x4000; + endAddr = 0x7FFF; } - while (currAddr <= 0x7FFF) { + while (currAddr <= endAddr) { myFile.read(sdBuffer, 512); for (int currByte = 0; currByte < 512; currByte++) {