home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Oakland CPM Archive
/
oakcpm.iso
/
sigm
/
vol210
/
crc68k.lbr
/
CRCASM.S
< prev
next >
Wrap
Text File
|
1986-02-09
|
896b
|
46 lines
* Assembly support for CRC calculation
*
* Based on algorithm used in R. Conn's CRC.MAC
* Why this differs from his SYSLIB routine I do not know.
* This allows calculation of same values as the CP/M-80
* programs CRC and CRCK. Different from algorithm used in
* XMODEM programs.
*
* July, 4, 1984
* Christopher Rhodes
* Labradorian Labs
.globl _clrcrc * clear CRC counter
.globl _addcrc * add byte to CRC counter
.globl _getcrc * return final CRC value
.data
_clrcrc:
clr.w CRCVAL * clear CRC counter
rts
_addcrc:
move.b 5(a7),d0 * get data byte off C stack
move.w CRCVAL,d1 * get old value
add.w d1,d1
add.b d0,d1
btst #7,CRCVAL
beq skip
eori.w #$A097,d1
skip:
move.w d1,CRCVAL
rts
_getcrc:
move.w CRCVAL,d0
rts
.bss
CRCVAL: .ds.w 1 * storage for CRC value
.end
:
move.w d1,CRCVAL
rts