> From: owner-cc65@musoftware.de [mailto:owner-cc65@musoftware.de] On Behalf > > > I can only think of one way that would work across all DOSes, and all > types > > of disks (after all, you may want to have a disk copy routine that > copies a > > boot disk, or oddly sized ATR file). The only way I can think of is to > just > > try and read sectors until you find the last one-not the greatest > method. > > I'd strongly suggest to not implementit that way it's absolutely not > conformant to expectations. Imagine the disc copy scenario basically > reading the whole disk twice. I was thinking of a binary search read like Marc suggested, but yes, I agree it might not be what a user would expect (but the programmer might if it's documented.) > If there should be no way to do it with a reasonable amount of > overhead then it should rather not be implemented at all. Then a disck > copy program can still just call dio_read() until that returns with an > errror... That's what I did in one of the tools I implemented that uses DIO to copy disks... there's no telling exactly if your disk will have 720 sectors, 1040 sectors, or some other number depending on strange emulator-based disk formats (Atari disks can go up to 65535 sectors with some popular DOSes.) I just read until I get an error (after three retries) and then call that the end of the disk copy. > Does it probably make sense to define a "> 80% of the drives" and/or a > "> 80% of the DOSes" case in which a simple solution works and just > live with the fact that the 20% left will return an error (aka zero > sectors)? Personally, I'd prefer to see a routine that works 100% of the time, regardless of disk format so that the function returns what the programmer thinks it will return: the number of sectors on the disk. If the programmer doesn't like the standard way this is done, they can always write their own routine and accept the incompatibility and special cases such a custom routine would entail. Well, this is likely why Christian didn't implement this function on the Atari. There's no good method to quickly determine the number of sectors on a disk. :) ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo@musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.Received on Fri Oct 19 02:30:33 2012
This archive was generated by hypermail 2.1.8 : 2012-10-19 02:30:37 CEST