[Coco] Fwd: IP packets on my coco

Bill Pierce ooogalapasooo at aol.com
Wed Jun 8 09:11:07 EDT 2016


I don't know how useful it would be, but there IS a CRC program (asm) in the Nitros9 repo sources...
I'm pretty sure it's named "crc"...
You give the address range of a block of data and it calculates the crc... it's 24 bit I think (standard for OS9 crcs).
Also, several of the standard OS9 utilities calculate CRCs for their file checking, "ident" comes to mind.

 

 


Bill Pierce
"Charlie stole the handle, and the train it won't stop going, no way to slow down!" - Ian Anderson - Jethro Tull

 

My Music from the Tandy/Radio Shack Color Computer 2 & 3
https://sites.google.com/site/dabarnstudio/
Co-Contributor, Co-Editor for CocoPedia
http://www.cocopedia.com/wiki/index.php/Main_Page
Global Moderator for TRS-80/Tandy Color Computer Forums
http://www.tandycoco.com/forum/

E-Mail: ooogalapasooo at aol.com


 

 

-----Original Message-----
From: Dave Philipsen <dave at davebiz.com>
To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
Sent: Wed, Jun 8, 2016 3:00 am
Subject: Re: [Coco] Fwd: IP packets on my coco

This is a C code snippet for CRC calculation showing a 256-entry table of unsigned longs (1024 bytes).  I've also read that there are ways to to it with a 16-entry table of 32-bit words (64 bytes) but it requires a little more computation that the 256-entry table.There are also some webpages that have CRC calculators on them so if you are writing an algorithm you can test it.  So I don't think calculating the CRC is going to be all that difficult nor should it be overly CPU intensive.Dave    /* Table of CRCs of all 8-bit messages. */    unsigned long crc_table[256];        /* Flag: has the table been computed? Initially false. */    int crc_table_computed = 0;        /* Make the table for a fast CRC. */    void make_crc_table(void)    {      unsigned long c;      int n, k;          *for (n = 0; n < 256; n++) { *c = (unsigned long) n;        for (k = 0; k < 8; k++) {          if (c & 1)            c = 0xedb88320L ^ (c >> 1);          else            c = c >> 1;        }        crc_table[n] = c;      }      crc_table_computed = 1;    }       /* Update a running CRC with the bytes buf[0..len-1]--the CRC       should be initialized to all 1's, and the transmitted value       is the 1's complement of the final running CRC (see the       crc() routine below). */        unsigned long update_crc(unsigned long crc, unsigned char *buf,                             int len)    {      unsigned long c = crc;      int n;          if (!crc_table_computed)        make_crc_table();      for (n = 0; n < len; n++) {        c = crc_table[(c ^ buf[n]) & 0xff] ^ (c >> 8);      }      return c;    }        /* Return the CRC of the bytes buf[0..len-1]. */    unsigned long crc(unsigned char *buf, int len)    {      return update_crc(0xffffffffL, buf, len) ^ 0xffffffffL;    }DaveOn 6/8/2016 12:57 AM, Barry Nelson wrote:>   The problem with that approach is that an 8 bit CRC requires a 256 byte lookup table or 2^8 bytes. A 32 bit CRC would need a 2^32 byte table or 4294967296 bytes, that is a 4Gb lookup table.>>> Dave Philipsen dave at davebiz.com>> Wed Jun 8 01:27:51 EDT 2016>> I remember from the CRC calculation in X/Ymodem that there is an easy>> and faster way to get the CRC using lookup tables.  That's how I did it>> with Supercomm.  I believe the CRC for the networking packets is a>> 32-bit CRC so I don't know if lookup tables are still practical or not>> with that size CRC.  What is amazing is that I was able to find that>> information without the internet back then.  I just now did a few>> cursory searches on calculating CRCs and I'm guessing that there is a>> fairly easy method that doesn't require so much overhead.>>>>>> Dave>-- Coco mailing listCoco at maltedmedia.comhttps://pairlist5.pair.net/mailman/listinfo/coco


More information about the Coco mailing list