Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Nov 15th, 2018 88 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(int argc, char **argv)
  5. {
  6.     FILE *input = fopen("d:\\mame\\mame\\nvram\\indigo4k\\eeprom", "rb");
  7.     unsigned short eeprom[0x80];
  8.     for (int i = 0; i < 0x80; i++)
  9.     {
  10.         unsigned char upper = 0;
  11.         unsigned char lower = 0;
  12.         fread(&lower, 1, 1, input);
  13.         fread(&upper, 1, 1, input);
  14.         eeprom[i] = (upper << 8) | lower;
  15.     }
  16.     fclose(input);
  17.  
  18.     printf("EEPROM %02x: %04x\n", 0, eeprom[0]);
  19.     int s3 = (int)0xffffffa5;
  20.     s3 ^= eeprom[0] & 0x00ff;
  21.     s3 <<= 24;
  22.     s3 >>= 24;
  23.     int t3 = s3 << 1;
  24.     int t4 = (s3 < 0) ? 1 : 0;
  25.     s3 = (s3 << 1) | t4;
  26.     s3 <<= 24;
  27.     s3 >>= 24;
  28.     for (int i = 1; i < 0x80; i++)
  29.     {
  30.         printf("EEPROM %02x: %04x\n", (unsigned char)i, eeprom[i]);
  31.         unsigned char upper = eeprom[i] >> 8;
  32.         unsigned char lower = eeprom[i] & 0x00ff;
  33.         unsigned char xorval = upper ^ lower;
  34.         s3 ^= xorval;
  35.         s3 <<= 24;
  36.         s3 >>= 24;
  37.         t4 = (s3 < 0) ? 1 : 0;
  38.         s3 = (s3 << 1) | t4;
  39.         s3 <<= 24;
  40.         s3 >>= 24;
  41.     }
  42.  
  43.     printf("Checksum: %08x\n", s3);
  44.     return 0;
  45. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top