cx16diskio.f_read() now correctly deals with banked ram boundary

This commit is contained in:
Irmen de Jong 2022-06-26 21:42:56 +02:00
parent a6ffa5738b
commit 0fcd57192b
4 changed files with 6 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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() {