home *** CD-ROM | disk | FTP | other *** search
- ;
- ; This crc routine updates the checkword in (bc) using the byte
- ; passed in (a). The checkwords computed are suitable for
- ; communication with IBM format floppy disks. The two byte checkword
- ; is produced by the generating polynomial x**16+x**12+x**5+1. The
- ; checksum should be initialized to 0ffffh (i.e. 0ffffh is passed in
- ; bc when the checksum sequence is started). The new checksum is
- ; returned in (bc).
- ; a,f,b,c
- .crc:: push d
- xra c ! mov d,a
- rrc ! rrc ! rrc ! rrc
- ani 0fh; mask
- xra d ! mov e,a
- rrc ! rrc ! rrc ! mov d,a
- ani 1fh ! xra b ! mov c,a
- mov a,d ! ani 0e0h
- xra e ! mov b,a
- mov a,d ! rrc ! ani 0f0h
- xra c ! mov c,a
- pop d
- ret
- █