Here I compiled two basic "Hello, World!" programs. The only difference between them is that one has a capital "W" and the other has a lowercase "w".

This is the hex output of the two:


Code:
2A 2A 54 49 38 33 46 2A 1A 0A 00 43 6F 6D 70 69 6C 65 64 20 77 69 74 68 20 4F 52 47 3A 20 68 74 74 70 3A 2F 2F 63 6C 72 68 6F 6D 65 2E 6F 72 67 2F 61 73 6D 2F 35 00 0D 00 24 00 06 48 45 4C 4C 4F 00 00 00 00 00 24 00 22 00 BB 6D EF 40 45 21 00 00 22 4B 84 21 A8 9D EF 0A 45 EF 2E 45 C9 48 65 6C 6C 6F 20 77 6F 72 6C 64 21 00 CB 0E

**TI83F*
Compiled with ORG: http://clrhome.org/asm/5
$HELLO$"�m�@E!"K�!���
E�.E�Hello world!�



Code:
2A 2A 54 49 38 33 46 2A 1A 0A 00 43 6F 6D 70 69 6C 65 64 20 77 69 74 68 20 4F 52 47 3A 20 68 74 74 70 3A 2F 2F 63 6C 72 68 6F 6D 65 2E 6F 72 67 2F 61 73 6D 2F 35 00 0D 00 24 00 06 48 45 4C 4C 4F 00 00 00 00 00 24 00 22 00 BB 6D EF 40 45 21 00 00 22 4B 84 21 A8 9D EF 0A 45 EF 2E 45 C9 48 65 6C 6C 6F 20 57 6F 72 6C 64 21 00 AB 0E

**TI83F*
Compiled with ORG: http://clrhome.org/asm/5
$HELLO$"�m�@E!"K�!���
E�.E�Hello World!�


If you look, all the bytes are exactly identical except for two.
The first one is " 6F 20 77 " and " 6F 20 57 ". That's because "57" is a "W" while "77" is a "w". That's not what's confusing me.

What I want to know about is the second-to-the-last byte.

In the first file, it says "CB". In the next file, it says "AB".
This number changes even if I change the value of even one byte in the file (such as, "w" to "W").

And if I change that value at all, the program becomes "Invalid" and won't run.

What is this byte? How do I generate the correct byte so that the program will run on the calculator?

If that byte isn't exactly the right value, the assembled program would refuse to run.
My immediate guess would be that its part of the checksum or file version. But for only one byte, that seems really small. Im not really sure. Anyone else? Kerm?
Yes it is the checksum. You can tell since the difference between 'W' and 'w' is 32, which is $20 in hex and thus the difference between AB and CB.

TI uses the lower 16 bits of the sum of all bytes in the data section for a checksum. If this is incorrect your linking software may reject the file.

Remember that z80 is little-endian, so the Checksum is $0ECB/AB.
Is there a way to calculate the sum manually, and write it in (if you modified a file in hex)
Yes there is, the checksum is the lower 16-bits of all bytes in the data section. The hex above is a complete file so the data section begins at offset 55 ($37). So:

First 55 bytes:

Code:
2A   2A   54   49   38   33   46   2A   1A   0A   00   43   6F   6D   70   69   6C   65   64   20   77   69   74   68   20   4F   52   47   3A   20   68   74   74   70   3A   2F   2F   63   6C   72   68   6F   6D   65   2E   6F   72   67   2F   61   73   6D   2F   35   00


Data in data section (excluding final 2 bytes (checksum):

Code:
0D   00   24   00   6   48   45   4C   4C   4F   00   00   00   00   00   24   00   22   00   BB   6D   EF   40   45   21   00   00   22   4B   84   21   A8   9D   EF   0A   45   EF   2E   45   C9   48   65   6C   6C   6F   20   57   6F   72   6C   64   21   00


If you add those together you get 3755, or 0EAB in hex. If you change any bytes you can add these up again.

The TI Link Protocol Guide can assist, it is available at ticalc.org
Gotcha. Very helpful info. Thank you!
tr1p1ea wrote:
Yes there is, the checksum is the lower 16-bits of all bytes in the data section. The hex above is a complete file so the data section begins at offset 55 ($37). So:

First 55 bytes:

Code:
2A   2A   54   49   38   33   46   2A   1A   0A   00   43   6F   6D   70   69   6C   65   64   20   77   69   74   68   20   4F   52   47   3A   20   68   74   74   70   3A   2F   2F   63   6C   72   68   6F   6D   65   2E   6F   72   67   2F   61   73   6D   2F   35   00


Data in data section (excluding final 2 bytes (checksum):

Code:
0D   00   24   00   6   48   45   4C   4C   4F   00   00   00   00   00   24   00   22   00   BB   6D   EF   40   45   21   00   00   22   4B   84   21   A8   9D   EF   0A   45   EF   2E   45   C9   48   65   6C   6C   6F   20   57   6F   72   6C   64   21   00


If you add those together you get 3755, or 0EAB in hex. If you change any bytes you can add these up again.

The TI Link Protocol Guide can assist, it is available at ticalc.org


Thank you! This is very helpful.
The linkguide is very handy for understanding these things:
http://merthsoft.com/linkguide
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement