make diskio.f_read() ROM-compatible

This commit is contained in:
Irmen de Jong
2025-04-15 00:23:23 +02:00
parent 6b9cdbd482
commit fb44c87597
3 changed files with 15 additions and 13 deletions

View File

@@ -411,18 +411,17 @@ close_end:
byte_read_loop: ; fallback if MACPTR isn't supported on the device byte_read_loop: ; fallback if MACPTR isn't supported on the device
%asm {{ %asm {{
lda bufferpointer lda bufferpointer
sta m_in_buffer+1 sta P8ZP_SCRATCH_W1
lda bufferpointer+1 lda bufferpointer+1
sta m_in_buffer+2 sta P8ZP_SCRATCH_W1+1
}} }}
while num_bytes!=0 { while num_bytes!=0 {
; TODO: Romable
%asm {{ %asm {{
jsr cbm.CHRIN jsr cbm.CHRIN
m_in_buffer sta $ffff ; modified sta (P8ZP_SCRATCH_W1)
inc m_in_buffer+1 inc P8ZP_SCRATCH_W1
bne + bne +
inc m_in_buffer+2 inc P8ZP_SCRATCH_W1+1
+ +
}} }}
cx16.r0L = cbm.READST() cx16.r0L = cbm.READST()

View File

@@ -364,18 +364,18 @@ close_end:
list_blocks = 0 ; we reuse this variable for the total number of bytes read list_blocks = 0 ; we reuse this variable for the total number of bytes read
%asm {{ %asm {{
lda bufferpointer lda bufferpointer
sta m_in_buffer+1 sta P8ZP_SCRATCH_W1
lda bufferpointer+1 lda bufferpointer+1
sta m_in_buffer+2 sta P8ZP_SCRATCH_W1+1
}} }}
while num_bytes!=0 { while num_bytes!=0 {
; TODO: Romable
%asm {{ %asm {{
jsr cbm.CHRIN jsr cbm.CHRIN
m_in_buffer sta $ffff ; modified ldy #0
inc m_in_buffer+1 sta (P8ZP_SCRATCH_W1),y
inc P8ZP_SCRATCH_W1
bne + bne +
inc m_in_buffer+2 inc P8ZP_SCRATCH_W1+1
+ +
}} }}
cx16.r0L = cbm.READST() cx16.r0L = cbm.READST()

View File

@@ -3,6 +3,9 @@ TODO
romable: fix as many of the "TODO: Romable" issues as possible to improve romability of library code romable: fix as many of the "TODO: Romable" issues as possible to improve romability of library code
document romable option and that strings+initialized arrays become read-only
... ...
@@ -76,7 +79,7 @@ STRUCTS?
-------- --------
- declare struct *type*, or directly declare the variable itself? Problem with the latter is: you cannot easily define multiple variables of the same struct type. - declare struct *type*, or directly declare the variable itself? Problem with the latter is: you cannot easily define multiple variables of the same struct type.
- can contain only numeric types (byte,word,float) - no nested structs, no reference types (strings, arrays) inside structs - can contain only numeric types (byte,word,float) - no nested structs, no reference types (strings, arrays) inside structs, max 1 page of memory total size to allow regular indexing?
- only as a reference type (uword pointer). This removes a lot of the problems related to introducing a variable length value type. - only as a reference type (uword pointer). This removes a lot of the problems related to introducing a variable length value type.
- arrays of struct is just an array of uword pointers. Can even be @split? - arrays of struct is just an array of uword pointers. Can even be @split?
- need to introduce typed pointer datatype in prog8 - need to introduce typed pointer datatype in prog8