From 08ab12926303a50e8973a5a612e434f22c2d7347 Mon Sep 17 00:00:00 2001 From: Artemio Urbina Date: Wed, 16 Jan 2019 23:08:16 -0600 Subject: [PATCH] Modified Verify function It will only report individual addresses if there are errors Gives totals after completion Is faster (if there are no errors due to serial communication) --- ArcadeHacker_Sega_FD1094.ino | 41 +++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/ArcadeHacker_Sega_FD1094.ino b/ArcadeHacker_Sega_FD1094.ino index dceb2bb..7ced7eb 100644 --- a/ArcadeHacker_Sega_FD1094.ino +++ b/ArcadeHacker_Sega_FD1094.ino @@ -222,13 +222,13 @@ int xorf = xora ^ xorb; return invertbit(xorf); } -void readportanalog(char port) +float readportanalog(char port) { int value = analogRead(port); float voltage = value * (5.0 / 1023.0); - Serial.print(voltage); - + //Serial.print(voltage); + return(voltage); } void clk68k(int count) @@ -307,22 +307,39 @@ void writesecret() void dataverifydo() { + int ok = 0, fail = 0; verifysecret(); digitalWrite(RW, HIGH); digitalWrite(AD1, HIGH); // activate D0 INPUT pinMode(D0, INPUT); + p("Verifying, please wait\r\n"); for (int c=0; c <= 8191; c++) { - p(" Addr: "); Serial.print(c); - p(" Read volts: "); readportanalog(D0); - cByte = pgm_read_byte_near(EncryptionKey + c); - p(" Config Parity: "); Serial.print(parity(cByte)); - p(" Chip Parity: "); Serial.print(digitalRead(D0)); - if (parity(cByte) != digitalRead(D0)) {p(" NO MATCH");} - p("\r\n"); + float voltage = readportanalog(D0); + cByte = pgm_read_byte_near(EncryptionKey + c); + if (parity(cByte) != digitalRead(D0)) + { + p(" Addr: "); Serial.print(c); + p(" Read volts: "); Serial.print(voltage); + p(" Config Parity: "); Serial.print(parity(cByte)); + p(" Chip Parity: "); Serial.print(digitalRead(D0)); + p(" NO MATCH\r\n"); + fail++; + } + else + ok ++; digitalWrite(AS, HIGH); digitalWrite(AS, LOW); } - + if(!fail) + { + p("\r\nVerify OK, Correct Bytes: "); Serial.print(ok); + p("\r\n"); + } + else + { + p("\r\nVerify FAILED, Errors "); Serial.print(fail); + p("\r\n"); + } } void datawritedo() @@ -467,4 +484,4 @@ void loop() } -} +}