crc68.s 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. .globl _crc32 ; (ulg val, uch *buf, extent bufsize)
  11. .globl _get_crc_table ; ulg *get_crc_table(void)
  12. _crc32:
  13. move.l 8(sp),d0
  14. bne valid
  15. moveq #0,d0
  16. rts
  17. valid: movem.l d2/d3,-(sp)
  18. jsr _get_crc_table
  19. move.l d0,a0
  20. move.l 12(sp),d0
  21. move.l 16(sp),a1
  22. move.l 20(sp),d1
  23. not.l d0
  24. move.l d1,d2
  25. lsr.l #3,d1
  26. bra decr8
  27. loop8: moveq #0,d3
  28. move.b (a1)+,d3
  29. eor.b d0,d3
  30. lsl.w #2,d3
  31. move.l 0(a0,d3.w),d3
  32. lsr.l #8,d0
  33. eor.l d3,d0
  34. moveq #0,d3
  35. move.b (a1)+,d3
  36. eor.b d0,d3
  37. lsl.w #2,d3
  38. move.l 0(a0,d3.w),d3
  39. lsr.l #8,d0
  40. eor.l d3,d0
  41. moveq #0,d3
  42. move.b (a1)+,d3
  43. eor.b d0,d3
  44. lsl.w #2,d3
  45. move.l 0(a0,d3.w),d3
  46. lsr.l #8,d0
  47. eor.l d3,d0
  48. moveq #0,d3
  49. move.b (a1)+,d3
  50. eor.b d0,d3
  51. lsl.w #2,d3
  52. move.l 0(a0,d3.w),d3
  53. lsr.l #8,d0
  54. eor.l d3,d0
  55. moveq #0,d3
  56. move.b (a1)+,d3
  57. eor.b d0,d3
  58. lsl.w #2,d3
  59. move.l 0(a0,d3.w),d3
  60. lsr.l #8,d0
  61. eor.l d3,d0
  62. moveq #0,d3
  63. move.b (a1)+,d3
  64. eor.b d0,d3
  65. lsl.w #2,d3
  66. move.l 0(a0,d3.w),d3
  67. lsr.l #8,d0
  68. eor.l d3,d0
  69. moveq #0,d3
  70. move.b (a1)+,d3
  71. eor.b d0,d3
  72. lsl.w #2,d3
  73. move.l 0(a0,d3.w),d3
  74. lsr.l #8,d0
  75. eor.l d3,d0
  76. moveq #0,d3
  77. move.b (a1)+,d3
  78. eor.b d0,d3
  79. lsl.w #2,d3
  80. move.l 0(a0,d3.w),d3
  81. lsr.l #8,d0
  82. eor.l d3,d0
  83. decr8: dbra d1,loop8
  84. and.w #7,d2
  85. bra decr1
  86. loop1: moveq #0,d3
  87. move.b (a1)+,d3
  88. eor.b d0,d3
  89. lsl.w #2,d3
  90. move.l 0(a0,d3.w),d3
  91. lsr.l #8,d0
  92. eor.l d3,d0
  93. decr1: dbra d2,loop1
  94. done: movem.l (sp)+,d2/d3
  95. not.l d0
  96. rts