Checksums

= Checksum algorithms =

ck_std : "std"
Two u32 locations in the rom, "sumt" and "xort", are used to save this checksum. sumt = simpl u32 sum of all u32 values of the ROM, excluding the sumt and xort locations. i.e.

for (i=0; i< romsize; i+=4) { if ((i == sumt_location) || (i == xort_location)) continue; sumt += rom[i]; xort ^= rom[i]; }

This checksum is constantly calculated and verified during runtime.

ck_alt : "secondary" / "alt"
I'm not finished analyzing this algo, but some ROMs have both the std checksum and this one. It is also calc'd + verified continuously.

It is the same "std" algo as described above, but applied to a region of the ROM described in the FID struct. On the ROMs I've seen, the "alt_sumt" and "alt_xort" values are stored @ 0x1400; and the ck_alt function works on the area from 0x1408 up to (but not including) the FID struct.