mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-24 05:29:17 +01:00
V32A: Add verifying ST M27C322 Eproms (beta)
This commit is contained in:
parent
45f67ed300
commit
09d122369f
@ -2,8 +2,8 @@
|
||||
Cartridge Reader for Arduino Mega2560
|
||||
|
||||
Author: sanni
|
||||
Date: 2018-04-04
|
||||
Version: V32
|
||||
Date: 2018-05-04
|
||||
Version: V32A
|
||||
|
||||
SD lib: https://github.com/greiman/SdFat
|
||||
LCD lib: https://github.com/adafruit/Adafruit_SSD1306
|
||||
@ -35,7 +35,7 @@
|
||||
infinest - help with GB Memory cart
|
||||
|
||||
**********************************************************************************/
|
||||
char ver[5] = "V32";
|
||||
char ver[5] = "V32A";
|
||||
|
||||
/******************************************
|
||||
Define Starting Point
|
||||
|
@ -336,6 +336,7 @@ void epromMenu() {
|
||||
display_Clear();
|
||||
time = millis();
|
||||
write_Eprom();
|
||||
verify_Eprom();
|
||||
break;
|
||||
|
||||
case 3:
|
||||
@ -1822,6 +1823,52 @@ void write_Eprom() {
|
||||
}
|
||||
}
|
||||
|
||||
void verify_Eprom() {
|
||||
println_Msg(F("Verifying..."));
|
||||
display_Update();
|
||||
|
||||
// Open file on sd card
|
||||
if (myFile.open(filePath, O_READ)) {
|
||||
// Get rom size from file
|
||||
fileSize = myFile.fileSize();
|
||||
if (fileSize > flashSize) {
|
||||
print_Error(F("File size exceeds flash size."), true);
|
||||
}
|
||||
|
||||
blank = 0;
|
||||
word d = 0;
|
||||
for (unsigned long currWord = 0; currWord < fileSize / 2; currWord += 256) {
|
||||
//fill sdBuffer
|
||||
myFile.read(sdBuffer, 512);
|
||||
for (int c = 0; c < 256; c++) {
|
||||
word myWord = ((sdBuffer[d + 1] << 8) | sdBuffer[d]);
|
||||
|
||||
if (readWord_Eprom(currWord + c) != myWord) {
|
||||
blank++;
|
||||
}
|
||||
d += 2;
|
||||
}
|
||||
d = 0;
|
||||
}
|
||||
if (blank == 0) {
|
||||
println_Msg(F("Eprom verified OK"));
|
||||
display_Update();
|
||||
}
|
||||
else {
|
||||
println_Msg(F("Verification ERROR!"));
|
||||
print_Msg(blank);
|
||||
print_Error(F("B did not verify."), false);
|
||||
display_Update();
|
||||
}
|
||||
// Close the file:
|
||||
myFile.close();
|
||||
}
|
||||
else {
|
||||
println_Msg(F("Can't open file on SD."));
|
||||
display_Update();
|
||||
}
|
||||
}
|
||||
|
||||
//******************************************
|
||||
// End of File
|
||||
//******************************************
|
||||
|
Loading…
Reference in New Issue
Block a user