Subject: Re: ** NEED CRC FOR USE IN ASC-> help.
Keywords: crc
Lines: 48
For those who don't have access to a C compiler or don't want to go to
their computer every time they want to use ASC->, I have converted
Li Sheng's C program to a 48SX program. To use it just upload it to your
48SX in ASCII mode with translate code 3, then place the string on level
1 and execute CRC.
Arguments Results
2: 2: "your string"
1: "your string" 1: Checksum: #xxxxh
Note: You must be in Hex mode to display the proper checksum.
Once you obtain the checksum, just append it to the end of your
string in reverse order and execute ASC->.
Program Listing:
----------------Cut Here----------------
%%HP: T(3)A(D)F(.);
\<< DUP SIZE 1 SWAP
# 0h 'CRCN' STO
FOR c DUP c c SUB
NUM \-> n
\<<
IF 'n<58'
THEN n 48 -
ELSE n 55 -
END
\>> DUP \-> x
\<<
IF 'x<0' 'x>
15' OR
THEN DROP
'CRCN' PURGE
"CRC Error:
Invalid String"
DOERR
ELSE R\->B
'CRCN' RCL SWAP XOR
# Fh AND # 1081h *
'CRCN' RCL # 10h /
XOR 'CRCN' STO
END
\>>
NEXT 'CRCN' RCL
'CRCN' PURGE
"Checksum" \->TAG
\>>
----------------Cut Here----------------