Serial link file format
Created by: Administrator, Last modification: Tue 08 of Sep, 2009 (09:47 UTC) by phil
File format
Bytes from files are sent in 256 byte packets, each packet is followed by a 2 byte CRC checksum word.
CRC computation
The calculation is described as a "standard CRC-CCITT that uses polynomial $1021" and produces a 16 bit output, the Z80 code (slow, unoptimized) to generate it is as follows:
;--Z80 code to make CRC --------------------------------------------------------
; makes checksum in HL, src addr = DE, length = C bytes
crc_checksum
ld hl,$ffff
crcloop ld a,(de)
xor h
ld h,a
ld b,8
crcbyte add hl,hl
jr nc,crcnext
ld a,h
xor 10h
ld h,a
ld a,l
xor 21h
ld l,a
crcnext djnz crcbyte
inc de
dec c
jr nz,crcloop
retSee also: Serial link protocol