Page 1 of 1

How to check a machine code : The checksum...

Posted: Sat Dec 19, 2020 5:43 pm
by XavSnap
Hi,

This Basic code get the checksum from a 8 bytes cluster and add the address to avoid an address decay.
But, the CRC can be wrong in case of tow values are swapped in the same line !

08 00 00 00 00 00 00 0B = 19 = $13
0B 00 00 00 00 00 00 08 = 19 = $13
00 0B 00 00 00 00 00 08 = 19 = $13
00 0B 00 00 00 00 08 00 = 19 = $13


Just have a second look to this kind of line.

The right CRC will be :
(DATA1)+(DATA2+1)+(DATA3+2)+(DATA4+3)+ (DATA5+4)+ (DATA6+5)+ (DATA7+6)+ (DATA8+7)
In this case, each data can be calculate from his location.

Code: Select all

1 REM [HEX: \
31,FF,FF,CD,76,FC,CD,C9,\
FC,CD,EB,FC,CD,A8,FC,CD,\
27,FC,CD,D6,FA,20,F8,CD,\
59,FB,CD,93,FB,CD,27,FC,\
00,21,10,7C,40,40,40,00 ]
5 LET F=0
10 FOR A=16514 TO 16514+(5*8) STEP 8
20 RAND PEEK A+PEEK (A+1)+PEEK (A+2)+PEEK (A+3)+PEEK (A+4)+PEEK (A+5)+PEEK (A+6)+PEEK (A+7)+F
30 PRINT 43486+A;"= ";CHR$ (PEEK 16435+28);CHR$(INT(PEEK 16434/16)+28) ;CHR$ ((PEEK 16434-INT(PEEK 16434/16)*16)+28)
31 LET F=F+8
32 IF F=256 THEN LET F=0
40 NEXT A
CRC.P
(1.3 KiB) Downloaded 162 times

Re: How to check a machine code : The checksum...

Posted: Sun Dec 20, 2020 4:00 am
by sboisvert
Reminds me of CK Type (also available for the ZX)

Re: How to check a machine code : The checksum...

Posted: Sun Dec 20, 2020 2:25 pm
by XavSnap
CKtype.jpg

P file:
Listing_CKtype.zip
(19.11 KiB) Downloaded 169 times
CkType.TZX
(3.59 KiB) Downloaded 164 times
[edit1:
Something was wrong in the RAM_Top set-up…
This release seem ok on EO.]


[edit2:
:oops:
just one time…]


Thanks SBoisvert, another tool typed-ins !

Re: How to check a machine code : The checksum...

Posted: Sat Dec 26, 2020 1:08 am
by AN7805
Xav, this test program working on a Zeddie 1k?

Thanks so much.

Matteo :-)

Re: How to check a machine code : The checksum...

Posted: Sat Dec 26, 2020 4:18 am
by XavSnap
No Matteo,

It require a 16k RAM (not more!), and move the Ram_Top and copy the code above &7D56.(16k=&7FFF)

Re: How to check a machine code : The checksum...

Posted: Sat Dec 26, 2020 4:52 pm
by AN7805
Thanks so much Xavier.

Matt :-)