From this thread that Gampy pointed me to: viewtopic.php?f=42&t=6198#p91839
Code: Select all
success &= this.ValidateRange( 0, 0x7FFFD, 0x500, "Operating system");
success &= this.ValidateRange( 0x8002, 0x13FFF, 0x8000, "Engine calibration");
success &= this.ValidateRange(0x14002, 0x16DFF, 0x14000, "Engine diagnostics.");
success &= this.ValidateRange(0x16E02, 0x1BDFF, 0x16E00, "Transmission calibration");
success &= this.ValidateRange(0x1BE02, 0x1C7FF, 0x1BE00, "Transmission diagnostics");
success &= this.ValidateRange(0x1C802, 0x1E51F, 0x1C800, "Fuel system");
success &= this.ValidateRange(0x1E522, 0x1EE9F, 0x1E520, "System");
success &= this.ValidateRange(0x1EEA2, 0x1EF9F, 0x1EEA0, "Speedometer");
0x000000 -> 0x0004FF
0x000502 -> 0x003FFF
0x020000 -> 0x07FFFF
Checksum is stored at 0x500
Yet for whatever reason, whenever I go through and add up these segments, I get invalid checksums, but the rest of the addresses in the code block work correctly (checksum + sum of 16-bit words = 0).
To be clear about how I'm doing this:
1) Sum each 16-bit word within each segment together.
2) Sum each of the sums from each segment
3) Bitwise and with 0xFFFF (truncate)
This strategy works for all segments except the OS, which leads me to believe an address range is wrong?
Code: Select all
python3 checksum.py
Sum iteration: 0x0 0x4ff Size: 1280
Sum iteration: 0x502 0x3fff Size: 15102
Sum iteration: 0x20000 0x7ffff Size: 393216