CRC-16 bit

ZXNet echo conference «code.zx»

From Kirill Frolov To All 3 December 2006

Hello Orionsoft Ori> who can suggest a procedure that counts the subject, but is not limited to 256 Ori> bytes as in the well-known source ... For X-modem; ┌─-; code ─── crc=0; for (i=0; i= sizeof(buff)) { debug0("buffer overflow! "); send_break("buffer overflow!"); return 0; } while (1) { CHECK_TIMEOUT; if (kbhit()) { buff[ptr+i] = c = getch(); crc^=((unsigned)c<<8)&0xff00; b=8; do { if (crc&0x8000) crc<<=1, crc^=0x1021; else crc<<=1; } while (--b!=0); break; } } } └── code ─── In general, at one time in CODE.ZX this issue was considered, given all sorts of procedures, and in my opinion it was even explained that that sign is simply built through a tableless algorithm and can easily be generated dynamically when Need speed and compactness. And even in my zxlib there is such an algorithm:I just couldn't insert it. The message is long, do you understand? And It’s also not much fun to suffer in a window the size of 1/16 of a monitor. Therefore not I will write nothing more meaningful here. Just rave and get confused. Ask at fido7.zx.spectrum.

From Orionsoft To All 3 December 2006

Hello, All who can suggest a procedure that counts the subject, but is not limited to 256 bytes like in the well-known source...

From Orionsoft To All 3 December 2006

Hello, Orionsoft о нашел и проверил , она правильно расчитывает в формате cciit CRC16; ;Borrowed; from http://zilog.sh.cvut.cz/~base/misc/z80bits.html ; and moddified to be a loop ;The arrow comments show what lines I added or commented out from the original. ;Inputs; de->data; bc=number of bytes ;Outputs; hl=CRC16; push bc ;<---<<< push de ;<---<<< push af ;<---<<< ld hl,$FFFF push bc ;<---<<< CRC16_Read; ld; a,(de) inc de xor h ld h,a ld b,8 CRC16_CrcByte; add; hl,hl jr nc,CRC16_Next ld a,h xor $10 ld h,a ld a,l xor $21 ld l,a CRC16_Next; djnz; CRC16_CrcByte ; dec c ;>>>---> pop bc ;<---<<< dec bc ;<---<<< push bc ;<---<<< ld a,b ;<---<<< or c ;<---<<< jr nz,CRC16_Read pop bc ;<---<<< pop af ;<---<<< pop de ;<---<<< pop bc ;<---<<< ret

From Mark Antonov To All 3 December 2006

Hello Orionsoft Ori> who can suggest a procedure that counts the subject, but is not limited to 256 Ori> bytes as in the well-known source ... source hrust2.x

From Alexander Shushkov To All 15 December 2006

Hello fk0 Here's from fk0. File: zxlib_crc_fk0.zip http://zx.pk.ru/attachment.php?attachmentid=4300