2022-08-12 20:02:44 +00:00
|
|
|
%import textio
|
2023-09-05 20:59:36 +00:00
|
|
|
%import floats
|
2022-08-12 20:02:44 +00:00
|
|
|
|
|
|
|
main {
|
|
|
|
|
|
|
|
sub crc16(uword data, uword length) -> uword {
|
|
|
|
uword crc = 0
|
|
|
|
repeat length {
|
2023-09-05 20:59:36 +00:00
|
|
|
crc ^= mkword(@(data), 0)
|
2022-08-12 20:02:44 +00:00
|
|
|
repeat 8 {
|
|
|
|
if crc & $8000
|
|
|
|
crc = (crc<<1)^$1021
|
|
|
|
else
|
|
|
|
crc<<=1
|
|
|
|
}
|
|
|
|
data++
|
|
|
|
}
|
|
|
|
return crc
|
|
|
|
}
|
|
|
|
|
|
|
|
sub start() {
|
2023-09-05 19:44:03 +00:00
|
|
|
txt.print("calculating (expecting $ffd0)...")
|
2023-04-28 21:13:03 +00:00
|
|
|
cbm.SETTIM(0,0,0)
|
2022-08-12 20:02:44 +00:00
|
|
|
uword crc = crc16($e000, $2000)
|
2023-09-05 19:44:03 +00:00
|
|
|
txt.print_uwhex(crc, true)
|
2022-08-12 20:02:44 +00:00
|
|
|
txt.nl()
|
2023-09-05 20:59:36 +00:00
|
|
|
floats.print_f(cbm.RDTIM16() / 60.0)
|
|
|
|
txt.print(" seconds")
|
|
|
|
sys.wait(9999)
|
2022-08-12 20:02:44 +00:00
|
|
|
}
|
|
|
|
}
|