Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. ;===========================================================================
  2. ; Copyright (c) 1990-2000 Info-ZIP.  All rights reserved.
  3. ;
  4. ; See the accompanying file LICENSE, version 2000-Apr-09 or later
  5. ; (the contents of which are also included in zip.h) for terms of use.
  6. ; If, for some reason, all these files are missing, the Info-ZIP license
  7. ; also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html
  8. ;===========================================================================
  9. .text
  10.  
  11. .globl  _crc32          ; (ulg val, uch *buf, extent bufsize)
  12. .globl  _get_crc_table  ; ulg *get_crc_table(void)
  13.  
  14. _crc32:
  15.         move.l  8(sp),d0
  16.         bne    valid
  17.         moveq  #0,d0
  18.         rts
  19. valid:  movem.l d2/d3,-(sp)
  20.         jsr     _get_crc_table
  21.         move.l  d0,a0
  22.         move.l  12(sp),d0
  23.         move.l  16(sp),a1
  24.         move.l  20(sp),d1
  25.         not.l   d0
  26.  
  27.         move.l  d1,d2
  28.         lsr.l   #3,d1
  29.         bra     decr8
  30. loop8:  moveq  #0,d3
  31.         move.b (a1)+,d3
  32.         eor.b  d0,d3
  33.         lsl.w  #2,d3
  34.         move.l 0(a0,d3.w),d3
  35.         lsr.l  #8,d0
  36.         eor.l  d3,d0
  37.         moveq  #0,d3
  38.         move.b (a1)+,d3
  39.         eor.b  d0,d3
  40.         lsl.w  #2,d3
  41.         move.l 0(a0,d3.w),d3
  42.         lsr.l  #8,d0
  43.         eor.l  d3,d0
  44.         moveq  #0,d3
  45.         move.b (a1)+,d3
  46.         eor.b  d0,d3
  47.         lsl.w  #2,d3
  48.         move.l 0(a0,d3.w),d3
  49.         lsr.l  #8,d0
  50.         eor.l  d3,d0
  51.         moveq  #0,d3
  52.         move.b (a1)+,d3
  53.         eor.b  d0,d3
  54.         lsl.w  #2,d3
  55.         move.l 0(a0,d3.w),d3
  56.         lsr.l  #8,d0
  57.         eor.l  d3,d0
  58.         moveq  #0,d3
  59.         move.b (a1)+,d3
  60.         eor.b  d0,d3
  61.         lsl.w  #2,d3
  62.         move.l 0(a0,d3.w),d3
  63.         lsr.l  #8,d0
  64.         eor.l  d3,d0
  65.         moveq  #0,d3
  66.         move.b (a1)+,d3
  67.         eor.b  d0,d3
  68.         lsl.w  #2,d3
  69.         move.l 0(a0,d3.w),d3
  70.         lsr.l  #8,d0
  71.         eor.l  d3,d0
  72.         moveq  #0,d3
  73.         move.b (a1)+,d3
  74.         eor.b  d0,d3
  75.         lsl.w  #2,d3
  76.         move.l 0(a0,d3.w),d3
  77.         lsr.l  #8,d0
  78.         eor.l  d3,d0
  79.         moveq  #0,d3
  80.         move.b (a1)+,d3
  81.         eor.b  d0,d3
  82.         lsl.w  #2,d3
  83.         move.l 0(a0,d3.w),d3
  84.         lsr.l  #8,d0
  85.         eor.l  d3,d0
  86. decr8:  dbra   d1,loop8
  87.         and.w   #7,d2
  88.         bra     decr1
  89. loop1:  moveq  #0,d3
  90.         move.b (a1)+,d3
  91.         eor.b  d0,d3
  92.         lsl.w  #2,d3
  93.         move.l 0(a0,d3.w),d3
  94.         lsr.l  #8,d0
  95.         eor.l  d3,d0
  96. decr1:  dbra   d2,loop1
  97. done:   movem.l (sp)+,d2/d3
  98.         not.l   d0
  99.         rts
  100.