Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
63
Task/CRC-32/NOWUT/crc-32.nowut
Normal file
63
Task/CRC-32/NOWUT/crc-32.nowut
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
; link with PIOxxx.OBJ
|
||||
|
||||
sectionbss
|
||||
|
||||
crctable.d: resd 256
|
||||
|
||||
sectiondata
|
||||
|
||||
havetable.b: db 0
|
||||
string: db "The quick brown fox jumps over the lazy dog"
|
||||
stringend:
|
||||
db 13,10,0 ; carriage return and null terminator
|
||||
|
||||
sectioncode
|
||||
|
||||
start!
|
||||
gosub initplatform
|
||||
|
||||
beginfunc
|
||||
localvar crc.d
|
||||
|
||||
callex ,printnt,"input = ".a
|
||||
callex ,printnt,string
|
||||
|
||||
callex ,printnt,"The CRC-32 checksum = ".a
|
||||
callex crc,crc32,string,stringend
|
||||
callex ,printhexr,crc
|
||||
|
||||
endfunc
|
||||
end
|
||||
|
||||
crc32:
|
||||
beginfunc bufend.d,buf.d
|
||||
localvar i.d,j.d,k.d,k2.d,crc.d
|
||||
|
||||
ifunequal havetable,0,tabledone
|
||||
i=0
|
||||
whileless i,256
|
||||
|
||||
k=i > j=8
|
||||
countdown j
|
||||
k2=k > k=_ shr 1
|
||||
ifequal k2 and 1,0,noxor > k=_ xor $EDB88320
|
||||
noxor:
|
||||
nextcount
|
||||
|
||||
crctable(i shl 2)=k
|
||||
i=_+1
|
||||
wend
|
||||
|
||||
havetable=1
|
||||
tabledone:
|
||||
|
||||
crc=-1
|
||||
|
||||
whileless buf,bufend
|
||||
crc=_ shr 8 xor crctable(crc and $FF xor [buf].b shl 2)
|
||||
buf=_+1
|
||||
wend
|
||||
|
||||
crc=_ xor -1
|
||||
endfunc crc
|
||||
returnex 8 ; clean off 2 parameters from the stack
|
||||
Loading…
Add table
Add a link
Reference in a new issue