Code:
; W = CRC Message byte ; CRC16 - current 16-bit CRC check sum ; ; let CRC16 = abcd ; Message Byte = xy ; ; where abcd, xy are nibble variables ; ; Upon exit, ; ; a = c ^ (i1>>3) ^ i2 ; jmp = d ^ ((i1<<1)&$f) ^ (i2>>3) ; c = i1 ^ ((i2<<1)&0xf) ; d = i2 ; ; First compute the nibble array indices: ; i1 = a ^ x ; i2 = i1 ^ b ^ y ; ; ; Notation (I) : (J) is a byte with I= high nibble, J= low nibble ; CRC_Update xor W, CRC16_High ; (a^x):(b^y) mov Index, W ; and W, #$f0 ; W = (x^x):0 swap Index ; Index = (b^y):(a^x) xor Index, W ; Index = (a^b^x^y):(a^x) = i2:i1 ; High byte mov W, <+>3) : (((i1<<1)&0xf) | (i2>>3)) xor W, CRC16_Low ; W = (i1>>3)^c : ((((i1<<1)&0xf) | ; (i2>>3)) ^ d) mov CRC16_High, W ; low nibble of high byte is done mov W, Index and W, #$f0 ; W = i2 : 0 xor CRC16_High, W ; High nibble is of high byte is done ; now low byte mov CRC16_Low, W ; Low = i2 : 0 add CRC16_Low, W ; Low = (i2<<1) : 0 mov W, <>Index ; W = i1 : i2 xor CRC16_Low, W ; Low = i1 ^ (i2<<1) : i2 retw 0
file: /Techref/scenix/lib/io/osi2/crc16-sd.htm, 1KB, , updated: 2002/5/14 22:06, local time: 2024/12/26 17:19,
owner: JMN-EFP-786,
18.116.49.143:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://ecomorder.com/techref/scenix/lib/io/osi2/crc16-sd.htm"> CRC-16 Super fast and tiny! 17 instructions by Scott Dattalo</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to ecomorder.com! |
.