From 5cec7afd1fb261e9242e7817b7a9860ef2feab21 Mon Sep 17 00:00:00 2001 From: sanni Date: Tue, 17 Mar 2020 14:09:47 +0100 Subject: [PATCH] V4.6: Increase SA1 compatibility --- Cart_Reader/Cart_Reader.ino | 8 ++++---- Cart_Reader/SNES.ino | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Cart_Reader/Cart_Reader.ino b/Cart_Reader/Cart_Reader.ino index 52c2c8b..ffd3353 100644 --- a/Cart_Reader/Cart_Reader.ino +++ b/Cart_Reader/Cart_Reader.ino @@ -2,15 +2,15 @@ Cartridge Reader for Arduino Mega2560 Author: sanni - Date: 03.03.2020 - Version: 4.5 + Date: 17.03.2020 + Version: 4.6 SD lib: https://github.com/greiman/SdFat LCD lib: https://github.com/adafruit/Adafruit_SSD1306 Clockgen: https://github.com/etherkit/Si5351Arduino RGB Tools lib: https://github.com/joushx/Arduino-RGB-Tools - Compiled with Arduino 1.8.10 + Compiled with Arduino 1.8.12 Thanks to: MichlK - ROM-Reader for Super Nintendo @@ -43,7 +43,7 @@ **********************************************************************************/ #include -char ver[5] = "4.5"; +char ver[5] = "4.6"; /****************************************** Options diff --git a/Cart_Reader/SNES.ino b/Cart_Reader/SNES.ino index 2a665bb..ad73d52 100644 --- a/Cart_Reader/SNES.ino +++ b/Cart_Reader/SNES.ino @@ -547,6 +547,26 @@ void readHiRomBanks( unsigned int start, unsigned int total, SdFile *file) void getCartInfo_SNES() { boolean manualConfig = 0; + //Prime SA1 cartridge + uint16_t c = 0; + uint16_t currByte = 0; + byte buffer[1024] = { 0 }; + PORTL = 192; + while (c < 1024) { + PORTF = (currByte & 0xFF); + PORTK = ((currByte >> 8) & 0xFF); + + // Wait for the Byte to appear on the data bus + // Arduino running at 16Mhz -> one nop = 62.5ns + // slowRom is good for 200ns, fastRom is <= 120ns; S-CPU best case read speed: 3.57MHz / 280ns + // let's be conservative and use 6 x 62.5 = 375ns + NOP; NOP; NOP; NOP; NOP; NOP; + + buffer[c] = PINC; + c++; + currByte++; + } + // Print start page if (checkcart_SNES() == 0) { // Checksum either corrupt or 0000