home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / program / c / bts314b4 / crc.s < prev    next >
Text File  |  1993-12-27  |  1KB  |  57 lines

  1. /*    CRC-32 Routinen (c) St.Slabihoud 1992,1993    */
  2.  
  3. #ifdef __PUREC__
  4.  
  5.     EXPORT Z_32UpdateCRC,Z_UpdateCRC,xcrc
  6.     IMPORT cr3tab,crctab
  7.  
  8.  
  9. /* Z_32UpdateCRC (c,crc) */
  10. /* A1 Tabelle                         */
  11. /* D0 Byte                             */
  12. /* D1 CRC                                 */
  13.  
  14. Z_32UpdateCRC:
  15.             lea            cr3tab,a1
  16.             moveq        #0,d2
  17.             move.b  d0,d2                    /* Byte-Wert                    */
  18.       eor.b   d1,d2                 /* XOR mit alter CRC    */
  19.             add.w        d2,d2
  20.             add.w        d2,d2
  21.             lsr.l        #8,d1
  22.       move.l  0(a1,d2.w),d0
  23.       eor.l   d1,d0
  24.             rts
  25.  
  26. /* Z_UpdateCRC (c,crc)     */
  27. /* A1 Tabelle                         */
  28. /* D0 Byte                             */
  29. /* D1 CRC                                 */
  30.  
  31. Z_UpdateCRC:
  32.             lea            crctab,a1
  33.             move.w    d1,d2
  34.             lsr.w        #8,d2
  35.             eor.b        d0,d2
  36.             add.w        d2,d2
  37.             lsl.w        #8,d1
  38.       move.w  0(a1,d2.w),d0
  39.       eor.w   d1,d0
  40.             rts
  41.  
  42. /* xcrc(crc,c)                      */
  43. /* A1 Tabelle                         */
  44. /* D0 CRC                                 */
  45. /* D1 Byte                             */
  46.  
  47. xcrc:
  48.             lea            crctab,a1
  49.             move.w    d0,d2
  50.             lsr.w        #8,d2
  51.             eor.b        d1,d2
  52.             add.w        d2,d2
  53.             lsl.w        #8,d0
  54.       move.w  0(a1,d2.w),d1
  55.       eor.w   d1,d0
  56.             rts
  57. #endif