| |
Bacchus
Registered: Jan 2002 Posts: 155 |
Drive code: Detect missing disk...
I have detecting missing *device* covered. This logics work really well:https://codebase64.org/doku.php?id=base:reading_the_error_chann..
Also, checking if a file exists, one would expect that a plain Open would do the job, but you basically need to read the first byte and checking the Status. But then you have established that.
But what is the easiest way to detect if the device contains a disk? Let's say we have established that there is a disk in the drive. I can start reading a file, but then I don't know if the error will tell me if the file or the entire disk is missing.
Should I do a block read, start reading the directory or what is the general suggestion?
/Bacchus |
|
... 20 posts hidden. Click here to view all posts.... |
| |
Krill
Registered: Apr 2002 Posts: 2940 |
Quoting Bacchusthere is an inner loop loading five different files. Letting them all fail will take a long time. Wedging in stuff there is tricky so I prefer to do it this way this time ... Retrofitting or not, what i was saying is that i see no advantage of checking for disk-not-present prior to saving, as saving itself does that check implicitly, too.
This is also independent from any inner loops handling multiple files. |
| |
Bacchus
Registered: Jan 2002 Posts: 155 |
Quote: Quoting Bacchus
I did a test program where I implemented the above, but there is still issues when the same code is implemented in the program. :-P
What kind of a issue?
@Cosmos Can't really describe it perfectly but it feels like the commands aren't concluded properly, and the drive isn't ready to accept new commands. The detect disk command works arbitrarily. Sometimes it does and sometimes not (possibly depending on what happened before). Trying to send an "I" commands after my detection routines, I simply get an error. In VICE I can switch to DEV 8: and do M 0200 to see the status message, and sometimes that is Syntax error. That could sometimes happen if I send commands in the wrong case (common issue I have when messing with drive code).
@Krill I fully sympathize with this point of view and I will onboard it when considering the task ahead. Would be stupid not to :-)
Can be agree that if $98 is $00, then I have closed all files I have opened, right?
/Bacchus |
| |
Krill
Registered: Apr 2002 Posts: 2940 |
Quoting BacchusCan't really describe it perfectly but it feels like the commands aren't concluded properly, and the drive isn't ready to accept new commands. The detect disk command works arbitrarily. Sometimes it does and sometimes not (possibly depending on what happened before). I think it's important to error out at the earliest possible chance. So i'd check $90 after every command that might fail, plus OPEN returns an error flag via the C flag. On error, of course, need to properly clean up, too. |
| |
Comos
Registered: May 2004 Posts: 73 |
Quoting KrillI think it's important to error out at the earliest possible chance. So i'd check $90 after every command that might fail, plus OPEN returns an error flag via the C flag. On error, of course, need to properly clean up, too.
Besides $90 it's possible to readout accu for error code aswell in certain calls. |
Previous - 1 | 2 | 3 - Next |