Re: Need a sysRPL CRC16 routine.
- From: dot <dot@xxxxxxx>
- Date: Sat, 07 Apr 2007 05:15:55 -0700
Thanks for your thoughts on the string > hex and vice versa. It is an
underlying goal in my effort, though, to keep the program in a sysrpl
program.
One of the more demanding issues associated with this is the string
and hex handling. Sysrpl is not particularly intuitive on this point.
It might be useful to create stand alone programs to manipulate
strings and hex (back and forth). I haven't fully tested the program
that I submitted yesterday, and one of the things I anticipate might
happen will be the need to pad the result with leading zeros if the
result happens to be less than four characters (hex digits) long.
If the result of some message string would happen to produce the
crc-16 value of "1" (for example), then there would be a need to
prefix "000" to the crc-16 string before breaking it into the two
bytes and interposing them for the big endian result. Likewise for
other results that might require "00" or "0" to be the prefix pad
needed.
For the hex numbering system in the hp calc, it's almost like there is
a 'hex' (voodoo curse!) put on it.
I forgot to say thank you to William Graves for his dilligence and the
effort he has put into the Debug4x programming environment. I have
used Debug4x, and now with the latest version, all along. It's been a
very useful tool. So, "thank you, William!"
I have crashed it a few times, and find that recovery most of the time
is as simple as reloading the emulator with a version of the .e49 file
that I have set up for my needs (flags and all). Other times
resetting the emulator works, and a few times I had to shut down
Debug4x as it was hopelessly stalled (unresponsive program). Usually
the Debug4x lock up was related to running out of stack room; and that
was caused by an error in my programming code.
-Dot-
On Sat, 07 Apr 2007 02:42:51 -0500, "John H Meyers"
<jhmeyers@xxxxxxxxxxxxxx> wrote:
On Fri, 06 Apr 2007 17:59:40 -0500, dot wrote:
the "message object" is a string object representing hex digits
Then here's a little program which converts such a string
into a genuine internal "hex string" (do HOME 256 ATTACH
before program entry or transfer):
@ "123ABC" -> #123ABCh [C# 6 CBA321]
\<< SREV DUP HEAD DROP @ Empty string is invalid
H\->S #2A4Eh SB~B #5AB3h SYSEVAL \>>
At this point, a slightly modified CRC (in ML)
which should start after the prolog+length
and continue to the end of the object
might give the correct answer, and one could use &HXS
to append the 16-bit checksum to the original hex string.
To convert an internal hex string back to a string:
@ #123ABCh -> "123ABC"
\<< DUP B\->R DROP \->H 11 OVER SIZE SUB SREV \>>
Note that these programs work on any-length strings
(whereas "user binary integers" are 16 digits),
and that longer hex strings are never fully displayed
on the stack or when edited (HP48[S/G] shows "C#" notation
when edited, although it can't re-compile that notation).
The usual "back up memory first" advice
is of course strongly recommended.
Might anyone care to examine OCRC and xCRC,
and supply the modified SysRPL/ML for obtaining the CRC
of the entire body (without length field) of a hex string?
[r->] [OFF]
.
- References:
- Need a sysRPL CRC16 routine.
- From: dot
- Re: Need a sysRPL CRC16 routine.
- From: cyrille de brebisson
- Re: Need a sysRPL CRC16 routine.
- From: John H Meyers
- Re: Need a sysRPL CRC16 routine.
- From: dot
- Re: Need a sysRPL CRC16 routine.
- From: John H Meyers
- Re: Need a sysRPL CRC16 routine.
- From: dot
- Re: Need a sysRPL CRC16 routine.
- From: John H Meyers
- Need a sysRPL CRC16 routine.
- Prev by Date: Re: Need a sysRPL CRC16 routine.
- Next by Date: Re: Free 50g for a level-free stack
- Previous by thread: Re: Need a sysRPL CRC16 routine.
- Next by thread: Re: Need a sysRPL CRC16 routine.
- Index(es):
Relevant Pages
|