mirror of
https://github.com/irmen/prog8.git
synced 2025-01-10 20:30:23 +00:00
also add diskio.status_code() in other comp targets
This commit is contained in:
parent
551e5688da
commit
119040fc50
@ -460,6 +460,38 @@ io_error:
|
|||||||
goto done
|
goto done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
; similar to above, but instead of fetching the entire string, it only fetches the status code and returns it as ubyte
|
||||||
|
; in case of IO error, returns 255 (CBM-DOS itself is physically unable to return such a value)
|
||||||
|
sub status_code() -> ubyte {
|
||||||
|
if cbm.READST()==128 {
|
||||||
|
return 255
|
||||||
|
}
|
||||||
|
|
||||||
|
cbm.SETNAM(0, list_filename)
|
||||||
|
cbm.SETLFS(15, drivenumber, 15)
|
||||||
|
void cbm.OPEN() ; open 15,8,15
|
||||||
|
if_cs
|
||||||
|
goto io_error
|
||||||
|
void cbm.CHKIN(15) ; use #15 as input channel
|
||||||
|
|
||||||
|
list_filename[0] = cbm.CHRIN()
|
||||||
|
list_filename[1] = cbm.CHRIN()
|
||||||
|
list_filename[2] = 0
|
||||||
|
|
||||||
|
while cbm.READST()==0 {
|
||||||
|
cbm.CHRIN()
|
||||||
|
}
|
||||||
|
|
||||||
|
cbm.CLRCHN() ; restore default i/o devices
|
||||||
|
cbm.CLOSE(15)
|
||||||
|
return conv.str2ubyte(list_filename)
|
||||||
|
|
||||||
|
io_error:
|
||||||
|
cbm.CLRCHN()
|
||||||
|
cbm.CLOSE(15)
|
||||||
|
return 255
|
||||||
|
}
|
||||||
|
|
||||||
sub save(uword filenameptr, uword start_address, uword savesize) -> bool {
|
sub save(uword filenameptr, uword start_address, uword savesize) -> bool {
|
||||||
cbm.SETNAM(string.length(filenameptr), filenameptr)
|
cbm.SETNAM(string.length(filenameptr), filenameptr)
|
||||||
cbm.SETLFS(1, drivenumber, 0)
|
cbm.SETLFS(1, drivenumber, 0)
|
||||||
|
@ -145,6 +145,12 @@ diskio {
|
|||||||
return "unknown"
|
return "unknown"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub status_code() -> ubyte {
|
||||||
|
; -- return status code instead of whole CBM-DOS status string. (in this case always 255, which means 'unable to return sensible value')
|
||||||
|
return 255
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sub save(uword filenameptr, uword start_address, uword savesize) -> bool {
|
sub save(uword filenameptr, uword start_address, uword savesize) -> bool {
|
||||||
%ir {{
|
%ir {{
|
||||||
load.b r65532,0
|
load.b r65532,0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user