From 87d3109ffb6f9d820da9f24ca04732698ce59048 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Tue, 2 May 2023 19:21:01 +0200 Subject: [PATCH] diskio f_seek_w() abandoned due to unreliability --- compiler/res/prog8lib/cx16/diskio.p8 | 15 ++++++++------- docs/source/todo.rst | 1 - examples/cx16/fileseek.p8 | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/compiler/res/prog8lib/cx16/diskio.p8 b/compiler/res/prog8lib/cx16/diskio.p8 index aa7375719..1385b78f5 100644 --- a/compiler/res/prog8lib/cx16/diskio.p8 +++ b/compiler/res/prog8lib/cx16/diskio.p8 @@ -693,15 +693,16 @@ internal_vload: cbm.CLOSE(15) } - ; TODO see if we can get this to work as well: + + ; NOTE: f_seek_w() doesn't work reliably right now. I only manage to corrupt the fat32 filesystem on the sdcard with it... ; sub f_seek_w(uword pos_hiword, uword pos_loword) { ; ; -- seek in the output file opened with f_open_w, to the given 32-bits position -; f_seek.command[1] = 13 ; f_open_w uses channel 13 -; f_seek.command[2] = lsb(pos_loword) -; f_seek.command[3] = msb(pos_loword) -; f_seek.command[4] = lsb(pos_hiword) -; f_seek.command[5] = msb(pos_hiword) -; goto f_seek.send_command +; diskio.f_seek.command[1] = 13 ; f_open_w uses channel 13 +; diskio.f_seek.command[2] = lsb(pos_loword) +; diskio.f_seek.command[3] = msb(pos_loword) +; diskio.f_seek.command[4] = lsb(pos_hiword) +; diskio.f_seek.command[5] = msb(pos_hiword) +; goto diskio.f_seek.send_command ; } } diff --git a/docs/source/todo.rst b/docs/source/todo.rst index c96360bb4..b1a7e461c 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -11,7 +11,6 @@ For 9.0 major changes - DONE: cx16diskio module merged into diskio (which got specialized for commander x16 target). load() and load_raw() with extra ram bank parameter are gone. - DONE: drivenumber parameter removed from all routines in diskio module. The drive to work on is now simply stored as a diskio.drivenumber variable, which defaults to 8. -- get f_seek_w working like in the BASIC program on the sdcard - this needs the changes to diskio.f_open to use suffixes ,p,m - 6502 codegen: see if we can let for loops skip the loop if startvar>endvar, without adding a lot of code size/duplicating the loop condition. It is documented behavior to now loop 'around' $00 but it's too easy to forget about! Lot of work because of so many special cases in ForLoopsAsmgen..... diff --git a/examples/cx16/fileseek.p8 b/examples/cx16/fileseek.p8 index 93c24c94a..885d81ace 100644 --- a/examples/cx16/fileseek.p8 +++ b/examples/cx16/fileseek.p8 @@ -31,9 +31,9 @@ main { read_last_bytes() -; NOTE: f_seek_w() doesn't work right now. It requires substantial changes to the diskio library that are not compatible with the C64/C128. + ; NOTE: f_seek_w() doesn't work reliably right now. I only manage to corrupt the fat32 filesystem on the sdcard with it... ; txt.print("\nseeking to 1292 and writing a few bytes...\n") -; if diskio.f_open_w("seektestfile.bin,p,m") { +; if diskio.f_open_w("seektestfile.bin,p,a") { ; diskio.f_seek_w(0, 1292) ; void diskio.f_write("123", 3) ; diskio.f_close_w() @@ -42,8 +42,8 @@ main { ; txt.print(diskio.status()) ; sys.exit(1) ; } -; -; read_last_bytes() + + read_last_bytes() } sub read_last_bytes() {