View Single Post
Old Mon, Dec-10-2012, 08:09:58 AM   #393
Naturally Agitated
p0lar's Avatar
Join Date: Sep 2005
Posts: 3,554
In the garage:
Reputation: 0 p0lar will become famous soon enough

United States

Default Re: Comprehensive MSS54/MSS54HP DME Information

Originally Posted by terraphantm View Post
Edit: Solved MSS54HP checksum algorithm, it's actually quite simple.
It's easier to think of the MSS54HP file as two separate 32KB files. Method for calculating the checksum for either half is the same.

Take the first 0x4000 bytes and move them to the end. So what was byte 0 is now byte 4000, etc...
Now select the first 7FFC bytes. Calculate the CRC16 value for these bytes.
That's your checksum.

That method worked for 4 different MSS54HP ROMs that I tested, including the CSL tune -- I believe it'll work for all of them
I was thinking of how to do this across a directory of files and think I've come up with a small set of shell commands that will do it for us.

Here goes (this is in an OSX 10.7 terminal window):

split -a 1 -b 32k mss54hp.bin mss54hp.bin_
split -a 1 -b 16k mss54hp.bin_a mss54hp.bin_a_
split -a 1 -b 16k mss54hp.bin_b mss54hp.bin_b_
cat mss54hp.bin_a_b mss54hp.bin_a_a > mss54hp.bin_a_reordered
cat mss54hp.bin_b_b mss54hp.bin_b_a > mss54hp.bin_b_reordered
dd if=mss54hp.bin_a_reordered of=mss54hp.bin_a_pre_csum bs=1 count=32764
dd if=mss54hp.bin_b_reordered of=mss54hp.bin_b_pre_csum bs=1 count=32764
crc16 mss54hp.bin_a_pre_csum
crc16 mss54hp.bin_b_pre_csum
Those last two lines should give the checksum of both halves of the file, at which point they could just as easily be transplanted using sed/awk, OR used to simply check against other correction algorithms.

Does that look about right, Terra? I'll have a more eloquent chunk of perl that will do it soon, but this seemed to work fast and can be written into a shell script to process an entire directory with very little effort.

Last edited by p0lar; Mon, Dec-10-2012 at 03:27:44 PM.
Jump to top p0lar is offline   Reply With Quote