mirror of
https://github.com/irmen/prog8.git
synced 2024-12-26 14:29:35 +00:00
added iterative file loading to diskio
This commit is contained in:
parent
7a7270d769
commit
b5dc5fc615
@ -59,7 +59,7 @@ io_error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
; internal variables for the iterative file lister
|
; internal variables for the iterative file lister / loader
|
||||||
ubyte list_suffixmatch
|
ubyte list_suffixmatch
|
||||||
ubyte list_pattern_size
|
ubyte list_pattern_size
|
||||||
ubyte list_skip_disk_name
|
ubyte list_skip_disk_name
|
||||||
@ -68,6 +68,9 @@ io_error:
|
|||||||
ubyte iteration_in_progress = false
|
ubyte iteration_in_progress = false
|
||||||
str list_filename = "????????????????"
|
str list_filename = "????????????????"
|
||||||
|
|
||||||
|
|
||||||
|
; ----- iterative file lister functions -----
|
||||||
|
|
||||||
sub lf_start_list(ubyte drivenumber, uword pattern, ubyte suffixmatch) -> ubyte {
|
sub lf_start_list(ubyte drivenumber, uword pattern, ubyte suffixmatch) -> ubyte {
|
||||||
; -- start an iterative file listing with optional prefix or suffix name matching.
|
; -- start an iterative file listing with optional prefix or suffix name matching.
|
||||||
lf_end_list()
|
lf_end_list()
|
||||||
@ -171,6 +174,53 @@ close_end:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; ----- iterative file loader functions -----
|
||||||
|
|
||||||
|
sub f_open(ubyte drivenumber, uword filenameptr) -> ubyte {
|
||||||
|
f_close()
|
||||||
|
|
||||||
|
c64.SETNAM(strlen(filenameptr), filenameptr)
|
||||||
|
c64.SETLFS(11, drivenumber, 0)
|
||||||
|
void c64.OPEN() ; open 11,8,0,"filename"
|
||||||
|
if_cc {
|
||||||
|
iteration_in_progress = true
|
||||||
|
void c64.CHKIN(11) ; use #2 as input channel
|
||||||
|
if_cc
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
f_close()
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
sub f_read(uword bufferpointer, uword buffersize) -> uword {
|
||||||
|
if not iteration_in_progress
|
||||||
|
return 0
|
||||||
|
|
||||||
|
uword actual = 0
|
||||||
|
repeat buffersize {
|
||||||
|
ubyte data = c64.CHRIN()
|
||||||
|
@(bufferpointer) = data
|
||||||
|
bufferpointer++
|
||||||
|
actual++
|
||||||
|
ubyte status = c64.READST()
|
||||||
|
if status==64
|
||||||
|
f_close() ; end of file, close it
|
||||||
|
if status
|
||||||
|
return actual
|
||||||
|
}
|
||||||
|
return actual
|
||||||
|
}
|
||||||
|
|
||||||
|
sub f_close() {
|
||||||
|
; -- end an iterative file loading session (close channels).
|
||||||
|
if iteration_in_progress {
|
||||||
|
c64.CLRCHN()
|
||||||
|
c64.CLOSE(11)
|
||||||
|
iteration_in_progress = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sub status(ubyte drivenumber) -> uword {
|
sub status(ubyte drivenumber) -> uword {
|
||||||
; -- retrieve the disk drive's current status message
|
; -- retrieve the disk drive's current status message
|
||||||
uword messageptr = &filename
|
uword messageptr = &filename
|
||||||
|
Loading…
Reference in New Issue
Block a user