RE: [cc65] dio_query_sectcount() on Atari ?

From: Shawn Jefferson <sjefferson1shaw.ca>
Date: 2012-10-20 02:16:24
Hi, I will try to answer the questions to the best of my knowledge. I may be
wrong about some facts, so jump in if you have corrections.

> From: owner-cc65@musoftware.de [mailto:owner-cc65@musoftware.de] On Behalf
> Of Oliver Schmidt
>
> That's interesting. Usually DOSes of the type we're talking here about
> use some bitmap to mark free and used sectors. And the DOS needs to
> know how large that bitmap is in order to know where to stop reading
> bits when i.e. looking for a free sector. Typically that information
> (if nothing else helps) can be used to quite easily find out the
> number of sectors present.
>
> Just out of curiosity: Is it possible to explain to a non-Atari
> insider in in reasonable length why such an approach doesn't work on
> the Atari?

Atari DOS 2.x makes assumptions about the disk.  Single Density disks have
720 sectors, and the directory starts at a specific sector and has space for
64 files.  The VTOC is also a fixed length and has room for 720 sectors.
When Atari came out with the 1050 disk drive, they introduced "Medium
Density", which had 1040 sectors.  Again, assumptions about the disk were
made.  The same VTOC and directory exists, but then there is another VTOC
for the sectors beyond 720, stored in a sector above 720.  AtariDOS was the
"standard". Most DOS formatted disks you find will be AtariDOS formatted.

MyDOS and SpartaDOS may have fields that specify how many sectors the disk
has been formatted with.  MyDOS is also AtariDOS compatible.  There will be
some subset of disks that are MyDOS and SpartaDOS formatted.

There were many other DOSes, but most are compatible with one of the above
usually-and those are the large majority of DOS formatted disks (AtariDOS
3.0 isn't but wasn't really utilized much.)

Then you have the non-DOS formatted disk, and these would be most games and
a large majority of commercial products available for the Atari.  There is
no way to figure out how many sectors these disks have (other than reading
to the last sector).  Most of these disks were either 720 or 1040 sectors
though.

Then, you have disk images, which are typically called "ATR files".  These
can be an image of any type of these above (and more), including hard drive
disk images (hard drive images are usually MyDOS or SpartaDOS formatted
however.

Then there are the multitude of disk drives available for the Atari
computer, all of which provided some different features, and some common
ones.  There is the "Percom block", which would return data about the drive
and disk, including the number of sectors.  Most advanced drives implemented
this, and most hard drives.  However, the most popular drives, the Atari 810
and Atari 1050 did not.
 
> A dio_query_sectcount() that does something smart im most/many cases
> and falls back to some brute force approach if nothing else helps
> would be fine for me too - with the one exception of reading all
> sectors until a failure happens, because that should rather be done by
> the application itself.

Perhaps the "best" method would be to query for the percom block, and if
this isn't available, default to brute force method.  I don't think trying
to figure out what DOS formatted the drive is useful in this case.



----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sat Oct 20 02:17:27 2012

This archive was generated by hypermail 2.1.8 : 2012-10-20 02:17:31 CEST