[comp.sys.atari.8bit] Double density format questions...

hans@umd5.umd.edu (Hans Breitenlohner) (12/19/87)

There are actually three fairly common disk formats in the Atari world:

Single density (FM), 128 byte sectors, 18 sectors per track, 720 sectors per
side, single sided.  This is commonly called "single density".

Double density (MFM), 128 byte sectors, 26 sector per track, 1040 sectors per
side, single sided.  This is commonly called "enhanced density".

Double density (MFM), 256 byte sectors, 18 sectors per track, 720 sectors per 
side, single sided.  This is commonly called "double density".

The 810 drive is single density only.

The 1050 drive supports single and enhanced density.

The never released 815 drive would have been double density only.

Various other vendors made drives which support all three densities:  Indus,
Rana, Trak come to mind, there probably are others, too.
There also are upgrades for the 1050 which make it work in all three 
densities.

There are also the double sided versions of these formats supported by some 
drives (i.e. Percom, maybe others, and now the XF551).

Disk i/o is done by sending sector numbers to the drive, which converts them
to track/record(/side) as appropriate.  Sector numbers start at 1.  For single
sided drives the conversion is the obvious one, but I do not know how the
mapping is done on double sided drives.  --  But:  send me an XF551 (or a
Percom drive) and I will find out for you!! :-)

Since the bootstrap in the os rom does not know about double density drives,
there is a special hack in the drive firmware for this:  Sectors 1 - 3
are treated as if they were 128 bytes long, even in double density.  They
actually are 256 bytes long on the disk, but only 128 bytes are transferred
from/to the sio interface.

There are three methods for changing a drive's density that I am aware of:
1. Most drives will automatically determine the correct density when a disk
   is inserted.
2. Some drives have front panel controls to set the density.
3. Some drives (all multi-density drives except the 1050, as far as I know)
   will accept a configuration command over the sio bus.

A drive's density may be determined in two ways:
1. The Status function returns bits which allow one to distinguish between
   the three popular densities.  All drives support this.
2. Some drives (see comment in 3. above) support a command to read the 
   configuration record.

Dos (2.0, 2.5, xl, and Mydos, at least, I haven't looked at any others) set 
flags to indicate the sector length, where the byte count/forward link are
located, etc., whenever they are performing i/o operations.  These just happen
to be in the boot block (see "mapping the Atari"), and when a boot block is
written they reflect the state of that disk drive.  This is the information
the boot code uses when loading the rest of Dos.  Dos 2.0 then uses the 
status function to determine the sector size for all configured and attached
drives.

Dos 2.0 apparently has 99% of the code needed to support double density drives.
The main things missing are a mechanism to change density of a drive, or even
to let Dos know that the density of a drive has changed, and the code to write
a good copy of DOS.SYS to a boot disk.  There were patches for this posted a
while back, and if needed I may be able to find them.  I don't know if this
support was continued in Dos 2.5.

On double density disks the vtoc is still at sector 360, and the directory
follows.  These sectors are now 256 bytes long, and DOS allocates 256 byte
buffers for them, but only 128 bytes are used.  Since the sector link in
Dos 2.0 and 2.5 is only 10 bits wide, only 1023 sectors per disk can be
used.  Sector 1024 in enhanced density is used for an extension of the vtoc
and sectors 1025 to 1040 are not used.  Mydos supports drives with lots more
sectors, including double sided.  I don't know how they get around this, per-
haps by doing away with the file number in each block, and thus expanding
the size of the sector link.

Well, this is probably lots more than you ever wanted to know about this 
subject, so I'll quit now.  I will be glad to answer any additional questions.