home *** CD-ROM | disk | FTP | other *** search
- ;
- ; ============================================
- ;
- ; CRC SUBROUTINES
- ;
- ; ============================================
- ;
- ;
- crcchk: push h; Check 'CRC' bytes of received block
- lhld crcval
- mov a,h
- ora l
- pop h
- rz; z flag set if ok
- mvi a,0ffh; Else nz flag to show an error
- ret
- ;
- ; Return CRC value to be transmitted. d byte will be sent first
- ; d,e
- fincrc: push h; note that "crcup" does not require
- lhld crcval; insertion of 2 final zeroes to arrive
- mov d,l; at the final answer.
- mov e,h; FLIP bytes, like original routines
- pop h
- ret
- ;
- ; update stored crcval with (a). Preserve regs.
- updcrc: push psw
- push h
- lhld crcval
- ; " "
- ; Update the CRC value in (hl) with (a)
- ; Polynomial is x^16 + x^12 + x^5 + 1
- ; Approx. 90 uS at 2 Mhz. clock
- ; a,f,h,l
- push d
- xra l
- mov d,a
- rrc
- rrc
- rrc
- rrc
- ani 0fh
- xra d
- mov e,a
- rrc
- rrc
- rrc
- mov d,a
- ani 01fh
- xra h
- mov l,a
- mov a,d
- ani 0e0h
- xra e
- mov h,a
- mov a,d
- rrc
- ani 0f0h
- xra l
- mov l,a
- pop d
- shld crcval
- pop h
- pop psw
- ret
- >Ü