- 4INT -------------------------------------------- It's interesting -
Msg : 111 of 200 Addr Date
From : Aleksey Polushkin 2:50/340.7 25.05.97
Subj : CRC-16
----------------------------------------------------------------------
Hello Alex!
Thu May 22 1997 12:33, Ivan Tihonov wrote:
IT>> Смешно конечно, но может кто кинет сабж на паскале?
Я вот пользyюсь такой пpоцедypой для подсчета ЦРЦ16 в блоке памяти:
Aleksey
---
* Origin: --- HЛО над Вологдой --- (2:50/340.7)
{> Cut here. FileName= CRC16BLK.PAS }
{ Counting 16-bit CRC in memory block /TP7.0/ }
Function MemCRC(PMem:pointer; Size:word):word; assembler;
asm
mov ax,word ptr PMem+2;
mov es,ax;
mov di,word ptr PMem;
mov dx,Size;
mov bx,0FFFFh;
or dx,dx;
jz @L3;
@CNT:
mov ah,es:[di];
mov cx,8;
@L1:
mov al,bl;
xor al,ah;
shr al,1;
jnc @L2;
xor bx,4002h;
stc;
@L2:
rcr bx,1;
shr ah,1;
loop @L1;
inc di;
dec dx;
jnz @CNT;
@L3:
mov ax,bx;
end;
|