2022-11-14 16:55:55 +00:00
|
|
|
%import diskio
|
|
|
|
%import floats
|
|
|
|
%zeropage basicsafe
|
|
|
|
%option no_sysinit
|
|
|
|
|
|
|
|
main {
|
|
|
|
|
|
|
|
ubyte[256] buffer = 0 to 255
|
|
|
|
|
|
|
|
sub print_speed(uword jiffies) {
|
2023-02-08 00:37:49 +00:00
|
|
|
if jiffies==0 {
|
|
|
|
txt.print("\n 0 jiffies measured, speed is extremely high\n")
|
|
|
|
return
|
|
|
|
}
|
2023-11-07 22:39:39 +00:00
|
|
|
float speed = floats.floor(65536.0 / (jiffies as float / 60.0))
|
2022-11-14 16:55:55 +00:00
|
|
|
txt.nl()
|
|
|
|
txt.print_uw(jiffies)
|
|
|
|
txt.print(" jiffies = ")
|
2023-12-29 02:12:44 +00:00
|
|
|
floats.print(speed)
|
2022-11-14 16:55:55 +00:00
|
|
|
txt.print(" bytes/sec\n")
|
|
|
|
}
|
|
|
|
|
|
|
|
sub start() {
|
2023-11-07 22:39:39 +00:00
|
|
|
txt.print("\n\ndisk benchmark on drive 8.\n\n")
|
2022-11-14 16:55:55 +00:00
|
|
|
|
|
|
|
uword batchtotaltime
|
|
|
|
|
2023-11-07 22:39:39 +00:00
|
|
|
txt.print("writing 64kb using save()")
|
|
|
|
cbm.SETTIM(0,0,0)
|
|
|
|
; save 2 times 32Kb to make it 64Kb total
|
|
|
|
void diskio.save("@:benchmark.dat", $100, 32768)
|
|
|
|
void diskio.save("@:benchmark.dat", $100, 32768)
|
|
|
|
print_speed(cbm.RDTIM16())
|
2022-11-14 16:55:55 +00:00
|
|
|
|
|
|
|
txt.print("\nwriting 64kb sequentially")
|
2023-11-07 22:39:39 +00:00
|
|
|
if diskio.f_open_w("@:benchmark.dat") {
|
|
|
|
cbm.SETTIM(0,0,0)
|
|
|
|
repeat 65536/256 {
|
|
|
|
if not diskio.f_write(buffer, 256)
|
|
|
|
sys.exit(1)
|
2022-11-14 16:55:55 +00:00
|
|
|
}
|
2023-11-07 22:39:39 +00:00
|
|
|
diskio.f_close_w()
|
|
|
|
print_speed(cbm.RDTIM16())
|
2022-11-14 16:55:55 +00:00
|
|
|
}
|
|
|
|
|
2023-11-07 22:39:39 +00:00
|
|
|
txt.print("\nreading 64kb using load() into hiram")
|
|
|
|
cbm.SETTIM(0,0,0)
|
|
|
|
cx16.rambank(4)
|
|
|
|
if not diskio.load("benchmark.dat", $a000)
|
|
|
|
sys.exit(1)
|
|
|
|
print_speed(cbm.RDTIM16())
|
2022-11-14 16:55:55 +00:00
|
|
|
|
2023-11-07 22:39:39 +00:00
|
|
|
txt.print("\nreading 64kb using vload() into vram")
|
|
|
|
cbm.SETTIM(0,0,0)
|
|
|
|
if not diskio.vload("benchmark.dat", 0, $0000)
|
|
|
|
sys.exit(1)
|
|
|
|
print_speed(cbm.RDTIM16())
|
2022-11-14 16:55:55 +00:00
|
|
|
|
|
|
|
txt.print("\nreading 64kb sequentially")
|
2023-11-07 22:39:39 +00:00
|
|
|
if diskio.f_open("benchmark.dat") {
|
|
|
|
cbm.SETTIM(0,0,0)
|
|
|
|
repeat 65536/255 {
|
|
|
|
if not diskio.f_read(buffer, 255)
|
|
|
|
sys.exit(1)
|
2022-11-14 16:55:55 +00:00
|
|
|
}
|
2023-11-07 22:39:39 +00:00
|
|
|
diskio.f_close()
|
|
|
|
print_speed(cbm.RDTIM16())
|
2022-11-14 16:55:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
txt.nl()
|
2023-05-01 23:48:56 +00:00
|
|
|
txt.print(diskio.status())
|
2022-11-14 16:55:55 +00:00
|
|
|
txt.print("\ndone.\n")
|
2023-11-07 22:39:39 +00:00
|
|
|
|
|
|
|
diskio.delete("benchmark.dat")
|
2022-11-14 16:55:55 +00:00
|
|
|
}
|
|
|
|
}
|