diff --git a/compiler/res/prog8lib/cx16/diskio.p8 b/compiler/res/prog8lib/cx16/diskio.p8 index 1e6c4e90c..67f79bf32 100644 --- a/compiler/res/prog8lib/cx16/diskio.p8 +++ b/compiler/res/prog8lib/cx16/diskio.p8 @@ -312,13 +312,12 @@ close_end: reset_read_channel() list_blocks = 0 ; we reuse this variable for the total number of bytes read - ; commander X16 supports fast block-read via MACPTR() kernal call uword readsize while num_bytes { readsize = 255 if num_bytes`_. If you're targeting the Commander X16 instead, -download a recent emulator version (R42 or newer) for the CommanderX16, such as `x16emu `_ +download a recent emulator version for the CommanderX16, such as `x16emu `_ (preferred, this is the official emulator. If required, source code is `here `_. There is also `Box16 `_ which has powerful debugging features. You can select which one you want to launch using the ``-emu`` or ``-emu2`` command line options. diff --git a/examples/cx16/diskspeed.p8 b/examples/cx16/diskspeed.p8 index 5964ff1e9..be6ef0281 100644 --- a/examples/cx16/diskspeed.p8 +++ b/examples/cx16/diskspeed.p8 @@ -6,14 +6,13 @@ main { ubyte[256] buffer = 0 to 255 - const ubyte REPEATS = 2 sub print_speed(uword jiffies) { if jiffies==0 { txt.print("\n 0 jiffies measured, speed is extremely high\n") return } - float speed = 65536.0 * REPEATS / (jiffies as float / 60.0) + float speed = floats.floor(65536.0 / (jiffies as float / 60.0)) txt.nl() txt.print_uw(jiffies) txt.print(" jiffies = ") @@ -22,95 +21,56 @@ main { } sub start() { - txt.print("\n\ndisk benchmark. drive 8. repeats = ") - txt.print_ub(REPEATS) + txt.print("\n\ndisk benchmark on drive 8.\n\n") uword batchtotaltime - txt.print("\n\nwriting 64kb using save") - batchtotaltime = 0 - repeat REPEATS { - cbm.SETTIM(0,0,0) - void diskio.save("@:benchmark.dat", $100, 32768) - void diskio.save("@:benchmark.dat", $100, 32768) - batchtotaltime += cbm.RDTIM16() - txt.chrout('.') - } - print_speed(batchtotaltime) + 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()) txt.print("\nwriting 64kb sequentially") - batchtotaltime = 0 - repeat REPEATS { - 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) - } - batchtotaltime += cbm.RDTIM16() - diskio.f_close_w() + 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) } - txt.chrout('.') + diskio.f_close_w() + print_speed(cbm.RDTIM16()) } - print_speed(batchtotaltime) - txt.print("\nreading 64kb using load into hiram") - batchtotaltime = 0 - repeat REPEATS { - cbm.SETTIM(0,0,0) - cx16.rambank(4) - if not diskio.load("benchmark.dat", $a000) - sys.exit(1) - batchtotaltime += cbm.RDTIM16() - txt.chrout('.') - } - print_speed(batchtotaltime) + 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()) - txt.print("\nreading 64kb using vload into videoram") - batchtotaltime = 0 - repeat REPEATS { - cbm.SETTIM(0,0,0) - if not diskio.vload("benchmark.dat", 0, $0000) - sys.exit(1) - batchtotaltime += cbm.RDTIM16() - txt.chrout('.') - } - print_speed(batchtotaltime) + 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()) txt.print("\nreading 64kb sequentially") - batchtotaltime = 0 - repeat REPEATS { - if diskio.f_open("benchmark.dat") { - cbm.SETTIM(0,0,0) - repeat 65536/255 { - if not diskio.f_read(buffer, 255) - sys.exit(1) - } - batchtotaltime += cbm.RDTIM16() - diskio.f_close() + if diskio.f_open("benchmark.dat") { + cbm.SETTIM(0,0,0) + repeat 65536/255 { + if not diskio.f_read(buffer, 255) + sys.exit(1) } - txt.chrout('.') + diskio.f_close() + print_speed(cbm.RDTIM16()) } - print_speed(batchtotaltime) - - txt.print("\nreading 64kb sequentially (x16 optimized)") - batchtotaltime = 0 - repeat REPEATS { - if diskio.f_open("benchmark.dat") { - cbm.SETTIM(0,0,0) - repeat 65536/255 { - if not diskio.f_read(buffer, 255) - sys.exit(1) - } - batchtotaltime += cbm.RDTIM16() - diskio.f_close() - } - txt.chrout('.') - } - print_speed(batchtotaltime) txt.nl() txt.print(diskio.status()) txt.print("\ndone.\n") + + diskio.delete("benchmark.dat") } }