Hi,
I realized that I hadn't fully understood the status word (Kernal function READST) when reading serial files in assembly.
After some experiments, this is what I think is correct.
OPEN ($ffc0) will succeed whether or not the file exists
To test if a file exists, you need to call CHRIN ($ffcf) trying to read the first byte
If you then call READST ($ffb7)
Bit 6 (EOI) is set if the file contained only one byte (value=$40)
Bit 6 (EOI) and 1 (Read timeout) are set if the file is not found (value=$42)
Bit 7 is set if the drive is not present. This could also be caught by checking the carry bit after calling OPEN.
Conclusions:
READST = $00 => CHRIN returned a valid byte, and it's not the end of the file
READST = $40 => CHRIN returned a valid byte, and it's the last byte of the file
READST = any other value than $00 or $40 => An error condition, the value returned by CHRIN is not valid
Maybe someone in the community has more information, please share if so.
I'm especially interested in whether you may trust that bit 1 in READST (Read timeout) always will be set on file not found.