Moved fast verify to a different option
Moved the Fast verify function to its own submenu option with 'c' Changed version number to 1.2
This commit is contained in:
1 parent
08ab129263
commit
929d53da6d
1 file changed
+66
-52
@@ -1,4 +1,4 @@
|
|||||||
#define version "Sega System16/18/24/X Hitachi FD1094 Security Programmer 1.1 by arcadehacker.blogspot.com"
|
#define version "Sega System16/18/24/X Hitachi FD1094 Security Programmer 1.2 by arcadehacker.blogspot.com"
|
||||||
|
|
||||||
// Uncomment the game you would like to program from the list below, only one line must be uncommented at any time.
|
// Uncomment the game you would like to program from the list below, only one line must be uncommented at any time.
|
||||||
|
|
||||||
@@ -210,21 +210,21 @@ int invertbit(int Bit)
|
|||||||
|
|
||||||
int parity(unsigned char cByte)
|
int parity(unsigned char cByte)
|
||||||
{
|
{
|
||||||
int bits[8];
|
int bits[8];
|
||||||
Byte2Bits(cByte, bits);
|
|
||||||
int xor1 = bits[0] ^ bits[1];
|
Byte2Bits(cByte, bits);
|
||||||
int xor2 = bits[2] ^ bits[3];
|
int xor1 = bits[0] ^ bits[1];
|
||||||
int xor3 = bits[4] ^ bits[5];
|
int xor2 = bits[2] ^ bits[3];
|
||||||
int xor4 = bits[6] ^ bits[7];
|
int xor3 = bits[4] ^ bits[5];
|
||||||
int xora = xor1 ^ xor2;
|
int xor4 = bits[6] ^ bits[7];
|
||||||
int xorb = xor3 ^ xor4;
|
int xora = xor1 ^ xor2;
|
||||||
int xorf = xora ^ xorb;
|
int xorb = xor3 ^ xor4;
|
||||||
return invertbit(xorf);
|
int xorf = xora ^ xorb;
|
||||||
|
return invertbit(xorf);
|
||||||
}
|
}
|
||||||
|
|
||||||
float readportanalog(char port)
|
float readportanalog(char port)
|
||||||
{
|
{
|
||||||
|
|
||||||
int value = analogRead(port);
|
int value = analogRead(port);
|
||||||
float voltage = value * (5.0 / 1023.0);
|
float voltage = value * (5.0 / 1023.0);
|
||||||
//Serial.print(voltage);
|
//Serial.print(voltage);
|
||||||
@@ -305,9 +305,31 @@ void writesecret()
|
|||||||
digitalWrite(D0, HIGH); clkrw();
|
digitalWrite(D0, HIGH); clkrw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void dataverifydo()
|
void dataverifydo()
|
||||||
{
|
{
|
||||||
int ok = 0, fail = 0;
|
verifysecret();
|
||||||
|
|
||||||
|
digitalWrite(RW, HIGH); digitalWrite(AD1, HIGH); // activate D0 INPUT
|
||||||
|
pinMode(D0, INPUT);
|
||||||
|
|
||||||
|
for (int c=0; c <= 8191; c++) {
|
||||||
|
float voltage;
|
||||||
|
|
||||||
|
p(" Addr: "); Serial.print(c);
|
||||||
|
p(" Read volts: "); voltage = readportanalog(D0); Serial.print(voltage);
|
||||||
|
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");
|
||||||
|
digitalWrite(AS, HIGH); digitalWrite(AS, LOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void dataverifyfastdo()
|
||||||
|
{
|
||||||
|
int differences = 0;
|
||||||
verifysecret();
|
verifysecret();
|
||||||
|
|
||||||
digitalWrite(RW, HIGH); digitalWrite(AD1, HIGH); // activate D0 INPUT
|
digitalWrite(RW, HIGH); digitalWrite(AD1, HIGH); // activate D0 INPUT
|
||||||
@@ -318,26 +340,15 @@ void dataverifydo()
|
|||||||
float voltage = readportanalog(D0);
|
float voltage = readportanalog(D0);
|
||||||
cByte = pgm_read_byte_near(EncryptionKey + c);
|
cByte = pgm_read_byte_near(EncryptionKey + c);
|
||||||
if (parity(cByte) != digitalRead(D0))
|
if (parity(cByte) != digitalRead(D0))
|
||||||
{
|
differences ++;
|
||||||
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);
|
digitalWrite(AS, HIGH); digitalWrite(AS, LOW);
|
||||||
}
|
}
|
||||||
if(!fail)
|
if(!differences)
|
||||||
{
|
p("Verified OK\r\n");
|
||||||
p("\r\nVerify OK, Correct Bytes: "); Serial.print(ok);
|
|
||||||
p("\r\n");
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p("\r\nVerify FAILED, Errors "); Serial.print(fail);
|
p("Veify FAILED, Number of differences: "); Serial.print(differences);
|
||||||
p("\r\n");
|
p("\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -450,7 +461,8 @@ void setup()
|
|||||||
p("\r\n"); p(version); p("\r\n\r\n");
|
p("\r\n"); p(version); p("\r\n\r\n");
|
||||||
p("Commands:\r\n");
|
p("Commands:\r\n");
|
||||||
p("w - Writes encryption key data into the FD1094 chip. Select your game by uncommenting the appropriate line in the arduino program source code.\r\n");
|
p("w - Writes encryption key data into the FD1094 chip. Select your game by uncommenting the appropriate line in the arduino program source code.\r\n");
|
||||||
p("v - Dumps and compares a parity bit for all encryption data bytes stored inside the FD1094 chip.\r\n\r\n");
|
p("v - Dumps and compares a parity bit for all encryption data bytes stored inside the FD1094 chip.\r\n");
|
||||||
|
p("c - Dumps and compares jus as 'v' but giving only the global results from the operation.\r\n\r\n");
|
||||||
p("Game configuration selected: "); p(Game); p("\r\n\r\n");
|
p("Game configuration selected: "); p(Game); p("\r\n\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -458,30 +470,32 @@ void setup()
|
|||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
|
if (Serial.available()>0)
|
||||||
|
{
|
||||||
|
memset(temp, 0, TEMP_SIZE);
|
||||||
|
Serial.readBytesUntil('\r', temp, TEMP_SIZE-1);
|
||||||
|
|
||||||
if (Serial.available()>0)
|
char *pTemp = temp;
|
||||||
{
|
|
||||||
|
|
||||||
memset(temp, 0, TEMP_SIZE);
|
if (temp[0]=='w')
|
||||||
Serial.readBytesUntil('\r', temp, TEMP_SIZE-1);
|
{
|
||||||
|
p("Data Write...\r\n");
|
||||||
|
datawrite();
|
||||||
|
p("Done!\r\n\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
char *pTemp = temp;
|
if (temp[0]=='v')
|
||||||
|
{
|
||||||
|
p("Data Verify...\r\n");
|
||||||
if (temp[0]=='w')
|
dataverify();
|
||||||
{
|
p("Done!\r\n\r\n");
|
||||||
p("Data Write...\r\n");
|
}
|
||||||
datawrite();
|
|
||||||
p("Done!\r\n\r\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (temp[0]=='v')
|
|
||||||
{
|
|
||||||
p("Data Verify...\r\n");
|
|
||||||
dataverify();
|
|
||||||
p("Done!\r\n\r\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (temp[0]=='c')
|
||||||
|
{
|
||||||
|
p("Data Verify...\r\n");
|
||||||
|
dataverifyfastdo();
|
||||||
|
p("Done!\r\n\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user