V4.6: Increase SA1 compatibility

This commit is contained in:
sanni 2020-03-17 14:09:47 +01:00
parent f9ca4f9108
commit 5cec7afd1f
2 changed files with 24 additions and 4 deletions

View File

@ -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 <SdFat.h>
char ver[5] = "4.5";
char ver[5] = "4.6";
/******************************************
Options

View File

@ -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