Post Reply 
HP-41 ROM Checksum
08-19-2024, 02:13 PM
Post: #8
RE: HP-41 ROM Checksum
(08-18-2024 09:26 PM)Sylvain Cote Wrote:  
(08-18-2024 04:46 PM)J-F Garnier Wrote:  But ... can you tell us why you don't get the right value of the checksums of the system ROMs, which are correct ? :-)
These ROMs are 41CL specific, they are true 16-bit ROM, like the Y... ROMs.
I can modify my scripts to filter out those 6 extra bits used by the 41CL.

Yes, I knew the extra bits, thus the smiley :-) just to check if you would follow me ...


(08-18-2024 02:14 AM)Sylvain Cote Wrote:  While working on my ZVC Replica & ZENROM HHC presentation, I had to calculate the checksum of an HP-41 ROM.
...
calculate checksum value
Code:
cat ZEPROM_TEST.ROM | xxd -p -u -c 2 | perl -e 'my $word;my $prev; my $curr = 0; while(<>) { $word = hex($_); $prev = $curr; $curr += $word; } my $csum1 = $prev % 1023; $csum1 = (-$csum1) & 1023; printf "%04X\n", $csum1;'
...
I did this for fun and it is always possible that my checksum calculation is wrong, so the above values are to take with a grain of salt.

I've been puzzled by your formula using a modulo 1023 operation (any reference for it?), because the HP algorithm is doing (kind of):

s=0
for each word from 0 to 4094:
   s=s+word
   if s>1023 then s= s & 1023 ; s=s+1
checksum = (-s) & 1023

which is like a addition modulo 1024 with carry roll-over.

Your formula seems to work correctly most of the time but since the modulo 1023 operation can't generate a result of 1023, you can't get a checksum of 1 at the end.
However there is no ROM with a checksum of 1 in your list.
Also, HP's algorithm can't generate a checksum of 0, unless all words are zero.

J-F
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP-41 ROM Checksum - Sylvain Cote - 08-18-2024, 02:14 AM
RE: HP-41 ROM Checksum - Allen - 08-18-2024, 01:42 PM
RE: HP-41 ROM Checksum - J-F Garnier - 08-18-2024, 04:46 PM
RE: HP-41 ROM Checksum - Sylvain Cote - 08-18-2024, 09:26 PM
RE: HP-41 ROM Checksum - J-F Garnier - 08-19-2024 02:13 PM
RE: HP-41 ROM Checksum - Sylvain Cote - 08-19-2024, 03:54 PM
RE: HP-41 ROM Checksum - Sylvain Cote - 08-19-2024, 03:04 AM
RE: HP-41 ROM Checksum - HP67 - 08-19-2024, 08:46 AM
RE: HP-41 ROM Checksum - Sylvain Cote - 08-19-2024, 11:19 AM
RE: HP-41 ROM Checksum - HP67 - 08-19-2024, 03:13 PM
RE: HP-41 ROM Checksum - Sylvain Cote - 08-19-2024, 10:59 PM



User(s) browsing this thread: 3 Guest(s)