home *** CD-ROM | disk | FTP | other *** search
- ;;
- ;; JAM(mbp) - The Joaquim-Andrew-Mats Message Base Proposal
- ;;
- ;; Turbo Pascal API
- ;;
- ;; Written by Joaquim Homrighausen.
- ;;
- ;; ----------------------------------------------------------------------
- ;;
- ;; jcrc32.asm
- ;;
- ;; CRC-32 calculation on block
- ;;
- ;; Copyright 1993 Joaquim Homrighausen, Andrew Milner, Mats Birch, and
- ;; Mats Wallin. ALL RIGHTS RESERVED. But see below notice.
- ;;
- ;; ----------------------------------------------------------------------
- ;;
- ;; The original C code for this CRC-32 function was written by Gary S.
- ;; Brown and then converted to 8086 assembler by Joaquim Homrighausen.
- ;;
- ;; So, in all fairness, here is the copyright notice from Gary's original
- ;; code. This is the only function excepted from the copyright status of
- ;; the JAM TP API.
- ;;
- ;; Copyright (C) 1986 Gary S. Brown. You may use this program, or code or
- ;; tables extracted from it, as desired without restriction.
- ;;
- ;; ----------------------------------------------------------------------
- ;;
- ;; TASM (3.x):
- ;; tasm /ml /m5 /p /w2 /zi JCRC32;
- ;;
- ;; MASM (5.x):
- ;; masm /Ml /p /w2 /Zi JCRC32;
- ;;
- ;; Turbo Pascal prototype:
- ;; function crc32(VAR Buf; BufLen:WORD; OldCRC:LONGINT):LONGINT;
- ;;
- ;; Initializer:
- ;; $ffffffff (-1)
- ;;
- CODE SEGMENT WORD PUBLIC
-
- ASSUME CS:CODE, DS:NOTHING, ES:NOTHING
-
- PUBLIC CRC32
-
- ctablo: dw 0
- dw 12438, 24876, 20922, -15335, -2929, -23243, -27229, -30670, -18268
- dw -5858, -9848, 19499, 31933, 11527, 7569, 4196, 8434, 29000
- dw 16862, -11139, -6933, -19119, -31289, -26538, -22336, -1670, -13844
- dw 23631, 27865, 15715, 3573, 8392, 4190, 16868, 29042, -6959
- dw -11193, -31235, -19093, -22278, -26516, -13866, -1728, 27875, 23669
- dw 3535, 15705, 12460, 58, 20864, 24854, -2891, -15325, -27239
- dw -23281, -18274, -30712, -9806, -5852, 31879, 19473, 7595, 11581
- dw 16784, 28934, 8380, 4138, -31351, -19169, -7003, -11213, -13918
- dw -1740, -22386, -26600, 3515, 15661, 27799, 23553, 20980, 24930
- dw 12504, 78, -27155, -23173, -2879, -15273, -9786, -5808, -18198
- dw -30596, 7647, 11593, 31987, 19557, 24920, 20942, 116, 12514
- dw -23231, -27177, -15251, -2821, -5782, -9732, -30650, -18224, 11635
- dw 7653, 19551, 31945, 28988, 16810, 4112, 8326, -19163, -31309
- dw -11255, -7009, -1778, -13928, -26590, -22348, 15639, 3457, 23611
- dw 27821, -31968, -19530, -7668, -11622, 18233, 30639, 9749, 5763
- dw 2834, 15236, 27198, 23208, -12533, -99, -20953, -24911, -27836
- dw -23598, -3480, -15618, 22365, 26571, 13937, 1767, 7030, 11232
- dw 31322, 19148, -8337, -4103, -16829, -28971, -23576, -27778, -15676
- dw -3502, 26609, 22375, 1757, 13899, 11226, 6988, 19190, 31328
- dw -4157, -8363, -28945, -16775, -19572, -31974, -11616, -7626, 30613
- dw 18179, 5817, 9775, 15294, 2856, 23186, 27140, -89, -12495
- dw -24949, -20963, -15696, -3546, -23652, -27894, 1705, 13887, 26501
- dw 22291, 19074, 31252, 11182, 6968, -29029, -16883, -4169, -8415
- dw -11564, -7614, -19464, -31890, 5837, 9819, 30689, 18295, 23270
- dw 27248, 15306, 2908, -24833, -20887, -45, -12475, -7560, -11538
- dw -31916, -19518, 9825, 5879, 18253, 30683, 27210, 23260, 2918
- dw 15344, -20909, -24891, -12417, -23, -3556, -15734, -27856, -23642
- dw 13829, 1683, 22313, 26559, 31278, 19128, 6914, 11156, -16841
- dw -29023, -8421, -4211
-
- ctabhi: dw 0
- dw 30471, -4594, -26359, 1901, 28778, -5789, -24988, 3803, 31196
- dw -7979, -26670, 2486, 32433, -6216, -28481, 7607, 27312, -3143
- dw -31554, 6874, 28125, -2860, -31789, 4972, 25707, -670, -30107
- dw 5121, 25350, -1521, -29432, 15214, 19561, -10912, -23961, 15363
- dw 19204, -11763, -23286, 13749, 17074, -9285, -21316, 13016, 17887
- dw -9002, -21551, 9945, 20958, -14121, -16432, 8628, 22195, -12358
- dw -18243, 10242, 24325, -14836, -20213, 12143, 22632, -16031, -18842
- dw 30428, 475, -26414, -4139, 29105, 1718, -24641, -5960, 30727
- dw 3840, -27127, -7922, 32618, 2157, -28316, -6557, 27499, 7276
- dw -31387, -3486, 27654, 6913, -32248, -2801, 26032, 4791, -29762
- dw -839, 25309, 5594, -29485, -1068, 19890, 15029, -23620, -11077
- dw 19167, 15832, -23343, -11306, 17257, 13422, -21145, -9632, 17412
- dw 13059, -22006, -8947, 20485, 9986, -16885, -14068, 22376, 8303
- dw -18074, -12703, 24286, 10713, -20272, -14377, 22963, 11956, -18499
- dw -16198, -4680, -25921, 950, 29873, -5419, -25134, 1243, 29660
- dw -7325, -27548, 3437, 31338, -7154, -27895, 2560, 32007, -4081
- dw -30968, 7681, 26886, -2206, -32667, 6508, 28267, -300, -30253
- dw 4314, 26589, -1607, -28994, 6071, 24752, -10538, -24111, 14552
- dw 20447, -11845, -22852, 16309, 18610, -10227, -20726, 13827, 16644
- dw -8352, -22425, 12654, 18025, -13471, -17306, 9583, 21096, -13300
- dw -17653, 8706, 21765, -14918, -19779, 11188, 23731, -15657, -18992
- dw 11481, 23518, -25756, -5021, 30058, 621, -25591, -5362, 29191
- dw 1280, -27201, -7496, 31665, 3254, -27950, -6699, 31964, 3035
- dw -31021, -3628, 26845, 8154, -32322, -2375, 28592, 6327, -30712
- dw -241, 26118, 4353, -28827, -1950, 24939, 5740, -24566, -10483
- dw 19972, 14595, -22681, -12192, 18793, 15982, -20783, -9770, 16607
- dw 14296, -22084, -8517, 18354, 12469, -16963, -13638, 21427, 9396
- dw -17712, -12841, 21726, 9177, -19610, -15263, 23912, 10863, -19445
- dw -15604, 23045, 11522
-
- CRC32 proc far
- push bp
- mov bp, sp
- mov dx, word ptr [bp+8]
- mov ax, word ptr [bp+6]
- mov cx, word ptr [bp+10]
- les si, dword ptr [bp+12]
- xor di, di
- repeat:
- mov bx, di
- mov bl, es:[si]
- xor bl, al
- shl bx, 1
- mov al, ah
- mov ah, dl
- mov dl, dh
- xor dh, dh
- xor ax, word ptr ctablo [bx]
- xor dx, word ptr ctabhi [bx]
- inc si
- loop repeat
- pop bp
- ret 10
- CRC32 endp
-
- CODE ENDS
- END
-
- ;; end of file "jcrc32.asm"
-