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

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
Post Reply
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

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

Post 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 160 times
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
sboisvert
Posts: 40
Joined: Mon Nov 02, 2009 3:43 pm

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

Post by sboisvert »

Reminds me of CK Type (also available for the ZX)
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

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

Post by XavSnap »

CKtype.jpg

P file:
Listing_CKtype.zip
(19.11 KiB) Downloaded 164 times
CkType.TZX
(3.59 KiB) Downloaded 163 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 !
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
AN7805
Posts: 91
Joined: Fri Oct 16, 2020 4:17 am

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

Post by AN7805 »

Xav, this test program working on a Zeddie 1k?

Thanks so much.

Matteo :-)
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

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

Post by XavSnap »

No Matteo,

It require a 16k RAM (not more!), and move the Ram_Top and copy the code above &7D56.(16k=&7FFF)
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
AN7805
Posts: 91
Joined: Fri Oct 16, 2020 4:17 am

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

Post by AN7805 »

Thanks so much Xavier.

Matt :-)
Post Reply