On Fri, Mar 20, 2026 at 12:17 AM B 9 <[email protected]> wrote:

> On Thu, Mar 12, 2026 at 10:49 AM Brian K. White <[email protected]>
> wrote:
>
> Oh yeah I switched to a rolling xor checksum too.
>> It only needs ints in basic and I think actually catches more errors.
>> Still kind of swiss cheese compared to real crc algorithms but those are
>> expensive and this is cheap.
>>
> Need a cheap CRC algorithm? Coincidentally, I made a 34-byte 8080 machine
> language <https://github.com/hackerb9/crc16-8080/> program which
> calculates CRC16/xmodem. Are you seeing many transmission errors?
>
I knew 34 bytes wasn't quite true since it wasn't usable directly from
BASIC. I created a longer, 55-byte CRC-16 program
<https://github.com/hackerb9/crcbas/blob/main/gencrc.asm> which has a nicer
BASIC interface via CALL with the varptr to an array of integers for
arguments.  But, that's still not quite right, because it doesn't count the
BASIC loader program. This is certainly not the most efficient way of doing
it, but I created one that weighs in at about 400 or 500 bytes:

    https://github.com/hackerb9/crcbas

It provides a general purpose machine language CRC-16 checksum, usable from
BASIC, that relocates itself to run from a string buffer so it doesn't
conflict with any .CO files. It's pretty fast and can be used
incrementally, if you like.

Let me know what you think and if you have any ideas for ways to make it
less expensive.

—b9

Reply via email to