2022-08-12 20:02:44 +00:00
|
|
|
%import textio
|
|
|
|
|
|
|
|
main {
|
|
|
|
|
|
|
|
sub crc8(uword data, uword length) -> ubyte {
|
|
|
|
ubyte crc = 0
|
|
|
|
repeat length {
|
|
|
|
crc ^= @(data)
|
|
|
|
repeat 8 {
|
|
|
|
if crc & $80
|
|
|
|
crc = (crc<<1)^$1d
|
|
|
|
else
|
|
|
|
crc<<=1
|
|
|
|
}
|
|
|
|
data++
|
|
|
|
}
|
|
|
|
return crc
|
|
|
|
}
|
|
|
|
|
|
|
|
sub start() {
|
2023-09-05 19:44:03 +00:00
|
|
|
txt.print("calculating (expecting $a2)...")
|
2023-04-28 21:13:03 +00:00
|
|
|
cbm.SETTIM(0,0,0)
|
2022-08-12 20:02:44 +00:00
|
|
|
ubyte crc = crc8($e000, $2000)
|
2023-09-05 19:44:03 +00:00
|
|
|
txt.print_ubhex(crc, true)
|
2022-08-12 20:02:44 +00:00
|
|
|
txt.nl()
|
2023-04-28 21:13:03 +00:00
|
|
|
txt.print_uw(cbm.RDTIM16())
|
2022-08-12 20:02:44 +00:00
|
|
|
txt.print(" jiffies")
|
2023-09-05 19:44:03 +00:00
|
|
|
sys.wait(300)
|
2022-08-12 20:02:44 +00:00
|
|
|
}
|
|
|
|
}
|