diff --git a/compiler/res/prog8lib/cx16/cx16diskio.p8 b/compiler/res/prog8lib/cx16/cx16diskio.p8 index 3730a4c0a..bdd06b443 100644 --- a/compiler/res/prog8lib/cx16/cx16diskio.p8 +++ b/compiler/res/prog8lib/cx16/cx16diskio.p8 @@ -102,6 +102,8 @@ cx16diskio { goto byte_read_loop ; macptr block read not supported, do fallback loop diskio.list_blocks += size bufferpointer += size + if msb(bufferpointer) == $c0 + bufferpointer = mkword($a0, lsb(bufferpointer)) ; wrap over bank boundary num_bytes -= size if c64.READST() & $40 { diskio.f_close() ; end of file, close it diff --git a/compiler/res/prog8lib/diskio.p8 b/compiler/res/prog8lib/diskio.p8 index bbb512c63..b6c1215af 100644 --- a/compiler/res/prog8lib/diskio.p8 +++ b/compiler/res/prog8lib/diskio.p8 @@ -226,6 +226,8 @@ close_end: sub f_read(uword bufferpointer, uword num_bytes) -> uword { ; -- read from the currently open file, up to the given number of bytes. ; returns the actual number of bytes read. (checks for End-of-file and error conditions) + ; NOTE: on systems with banked ram (such as Commander X16) this routine DOES NOT + ; automatically load into subsequent banks if it reaches a bank boundary! if not iteration_in_progress or not num_bytes return 0 diff --git a/docs/source/todo.rst b/docs/source/todo.rst index f3e20e8ba..94fd7e253 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -3,7 +3,6 @@ TODO For next release ^^^^^^^^^^^^^^^^ -- bug: f_read() can't deal with running out of banked ram? maybe only cx16diskio.f_read()? - add McCarthy evaluation to shortcircuit and/or expressions. Both conditional expressions and assignments! - add some more optimizations in vmPeepholeOptimizer - vm Instruction needs to know what the read-registers/memory are, and what the write-register/memory is. diff --git a/examples/cx16/zsound/stream-test-zcm.p8 b/examples/cx16/zsound/stream-test-zcm.p8 index fc5ebc635..a283064d3 100644 --- a/examples/cx16/zsound/stream-test-zcm.p8 +++ b/examples/cx16/zsound/stream-test-zcm.p8 @@ -36,13 +36,9 @@ zsound_lib: ubyte load_ok = false - sub prebuffer() { + sub prebuffer() { txt.print("prebuffering...") - repeat 4 { - void cx16diskio.f_read(digi_address, ram_bank_size) - txt.print_ub(cx16.getrambank()) - txt.spc() - } + void cx16diskio.f_read(digi_address, ram_bank_size*4) } sub start() {