Saturday, August 28, 2010

16 bit crc in intel assembly

With the a86 assembler, didn't have a copy of tasm around


; 16 bit ccitt version, '123456789' => 0xe5cc
get_crc:
push bx,si,cx
mov ax,1d0fh
l1: xor ah,[si]
inc si
mov bx,8
l2: shl ax,1
jnc >l3
xor ax,1021h
l3: dec bx
jnz l2
loop l1
pop cx,si,bx
ret

No comments: