added cbm.CLEARST() to reset ST to 0

This commit is contained in:
Irmen de Jong 2023-12-18 01:20:24 +01:00
parent 0f26b39997
commit 997288fa03
4 changed files with 36 additions and 11 deletions

View File

@ -78,7 +78,7 @@ romsub $FFAB = UNTLK() clobbers(A) ; command serial
romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN
romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN
romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK
romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word
romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0)
romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters
romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters
romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file
@ -128,6 +128,14 @@ asmsub RDTIM16() clobbers(X) -> uword @AY {
}}
}
sub CLEARST() {
; -- Set the ST status variable back to 0. (there's no direct kernal call for this)
; Note: a drive error state (blinking led) isn't cleared! You can use diskio.status() to clear that.
SETNAM(0, $0000)
SETLFS(15, 3, 15)
void OPEN()
CLOSE(15)
}
}

View File

@ -82,7 +82,7 @@ romsub $FFAB = UNTLK() clobbers(A) ; command serial
romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN
romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN
romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK
romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word
romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0)
romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters
romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters
romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file
@ -128,6 +128,15 @@ asmsub RDTIM16() clobbers(X) -> uword @AY {
}}
}
sub CLEARST() {
; -- Set the ST status variable back to 0. (there's no direct kernal call for this)
; Note: a drive error state (blinking led) isn't cleared! You can use diskio.status() to clear that.
SETNAM(0, $0000)
SETLFS(15, 3, 15)
void OPEN()
CLOSE(15)
}
}
c64 {

View File

@ -29,7 +29,7 @@ romsub $FFAB = UNTLK() clobbers(A) ; command serial
romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN
romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN
romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK
romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word
romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0)
romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters
romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters
romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file
@ -81,6 +81,15 @@ asmsub RDTIM16() clobbers(X) -> uword @AY {
}}
}
sub CLEARST() {
; -- Set the ST status variable back to 0. (there's no direct kernal call for this)
; Note: a drive error state (blinking led) isn't cleared! You can use diskio.status() to clear that.
SETNAM(0, $0000)
SETLFS(15, 3, 15)
void OPEN()
CLOSE(15)
}
}
cx16 {

View File

@ -1,15 +1,14 @@
%import textio
%import diskio
%zeropage basicsafe
main {
sub start() {
uword ptr = &test
call(ptr)
call(ptr)
call(ptr)
}
sub test() {
txt.print("test!\n")
void diskio.f_open("does-not-exist")
txt.print_ub(cbm.READST())
txt.nl()
cbm.CLEARST()
txt.print_ub(cbm.READST())
txt.nl()
}
}