DrCoolZic wrote:FD detection was not removed in 0.12 unless you turn the debug on.
That's strange, I didn't change debug flag, but with 0.12 and 0.20 it worked and I didn't see any lock. Maybe on my STF the function to check disk sometimes works and sometimes fails ? 0.12 definitly worked, while 0.10 was always stuck.
The way it was done is not stupid but not very useful either.
How do you know you have a floppy in the drive? what I was doing is a recalibrate + seek to a specif track with verify flag on. For this to succeed you need to have a floppy disk inserted that is formatted. Seek verify check that the track number of the first found id matches the track you are seeking. This should work well as I said witha formatted FD but will fail if the F disk is not formatted or use some protection trick.
All the commands have reasonable timeout in the WD command itself doubled by timeout in the way I call the commands and therefore it is not so important to know upfront. If you try to read and you do not have a FD the command will fail. In the last version my FD_ready function is more an FD_reset function as it call a reaclibrate so we start on know territory and set some state variables in the lib.
Maybe you can check if a disk is inserted by also reading a track ? Isn't read track supposed to fail with RNF if no disk is present ? (or if it's not formatted)
You can also just do a "read address" on a track ; it should work with protected disk too, as long as the disk has at least 1 sector ; even if the track in the ID field is not the one of the real track, it will work (while seek + verify would not work with a protected disk if track byte is wrong on purpose in the ID field.
BTW, how do you accurately count the number of bytes in a track ? Since the DMA transfers by block of 16, you can't be sure that the last 16 bytes or less are not in the DMA buffer after a read track. Or do you measure the time between 2 index pulses to get an average value of a byte, that you use to get an estimation of the number of byte in the last DMA buffer when the command is complete from the FDC point of view ? Or you do some "read address" to flush the DMA buffer ?