diff --git a/Cart_Reader/MD.ino b/Cart_Reader/MD.ino index 0d70042..62c397a 100644 --- a/Cart_Reader/MD.ino +++ b/Cart_Reader/MD.ino @@ -790,11 +790,6 @@ void getCartInfo_MD() { sramBase = sramBase >> 1; } } - if (segaSram16bit == 2) { // 64KB - sramBase = 0x200000; - sramEnd = 0x20FFFF; - sramSize = 1UL << 15; // sramSize is the number of 2 byte words - } } // Get name @@ -1160,6 +1155,17 @@ void readSram_MD() { else myFile.write(sdBuffer, 256); } + if (segaSram16bit == 2) { + // pad to 64KB + for (int i = 0; i < 512; i++) { + sdBuffer[i] = 0xFF; + } + unsigned long padsize = (1UL << 16) - (sramSize << 1); + unsigned long padblockcount = padsize >> 9; // number of 512 byte blocks + for (int i = 0; i < padblockcount; i++) { + myFile.write(sdBuffer, 512); + } + } // Close the file: myFile.close(); print_Msg(F("Saved to "));