[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: System disk specific to the IIc+?



<touchstone> wrote:

> On 2008-01-31 08:15:58 -0700, schmidtd <schmidtd@my-deja.com> said:
> > And I now know why GSOS gives you the option to format 800k floppies
> > with 1:2 or 1:4 interleave.
> 
> i have seen that but don't know what that means.

When writing to a floppy (on an Apple II or Mac), the data has to be
converted from its normal structure into an encoded form which is able
to be stored reliably on the disk. This process takes some CPU time, and
the writing process is also time critical, so the normal method is to do
a two stage "encode, then write" sequence.

The floppy drive is spinning all the time (once the motor is activated),
so if the sectors on the floppy are adjacent and the computer wants to
write two consecutive sectors, then after it has finished writing the
first one and encoding the second one, the drive has already rotated
part or all of the way through the next sector. This means it would have
to wait an entire revolution of the drive before it can write the next
adjacent sector.

This would cause a major performance hit, so to improve performance, an
interleaving technique is used. Sectors which are logically adjacent
(numbered 0, 1, 2, etc.) are spread out with other sectors between them
(on each track). The degree of separation is given in the interleave
factor. 1:2 means that logically adjacent sectors are at least two
physical sectors apart, and 1:4 means that logically adjacent sectors
are at least four physical sectors apart.

The reason for having different interleave factors is due to different
overhead for various drives, and CPU performance.

If the computer is fast enough and it has direct write access to the
drive mechanism, then it is possible to write to a 3.5" disk with 1:2
interleave at maximum speed, because the encoding can be completed in
the time it takes one sector to pass under the head.

If the computer is slower then the encoding process takes longer and
more than one sector will have passed under the drive head. It is
therefore necessary to use at least a 1:3 interleave to get best
performance, and in some cases, 1:4 may be required.

Some drives have even more overhead. A notable example is the UniDisk
3.5. This actually has a two-stage process for accessing the drive, with
a microprocessor inside the drive acting as a go-between. For writing,
the computer sends a sector of data to the drive's microprocessor, which
then writes it to the disk.

This is an alterating process: the UniDisk's microcontroller can either
be transferring data from the host computer, or writing it to the drive.
it also has to do the sector-level encoding. This means that the
sequence of steps is to transfer the data to the drive, then encode it,
then write it. The total time taken means that it can't even keep up
with 1:3 interleave, so it is necessary to use 1:4 interleave to get
best performance with a UniDisk 3.5.

For consistency, the computer only offers 1:2 and 1:4 interleave, as
this covers the fast ones (e.g. GS/OS and ROM 3 IIgs firmware, which can
do 1:2), and the slowest ones (UniDisk 3.5). In principle, someone could
create 1:3 interleave disks, which would be a little faster than 1:4 on
many computers, but might be a lot worse on others.

All of the above considers writing only. The same issues apply in the
read direction, but there are some enhancements which can be made, which
mean that for more advanced drivers it is possible to ignore the
interleave and read any disk at full speed. This is done by reading an
entire track into memory in a single pass, then sorting out the
interleave order and decoding all the sectors in memory.

For less capable drivers (ROM 1 IIgs firmware, or anything involving a
UniDisk 3.5), the disk is read one sector at a time, and the same issues
arise with interleave factors.

> is this the same as "high speed interleave"?

Yes.

> any advantages or disadvatages?

Speed.

If you pick the wrong interleave factor (determined by the drives and
computers in which the disk will be used) then you will get either a
major or minor performance hit.

If your computer and drive are fast enough to support 1:2 interleave,
then writing to a 1:4 interleave disk will be about twice as slow,
because the drive has to rotate twice as far to get to the next sector.

If your computer and drive are only able to keep up with 1:4 interleave,
then writing to a 1:2 interleave disk will be about ten times slower,
because an entire revolution of the disk will be needed to write
adjacent sectors.

In both cases, reading will either be just as bad as writing, or be
unaffected by the interleave, depending on the driver and hardware
implementation (if it can read entire tracks in one pass).

It is also worth noting that standard PC floppies are formatted with a
1:1 interleave, which they can achieve because the encoding step is done
in hardware (inside the disk controller). If you write to a 1:1
interleave floppy in an Apple ][ 3.5" drive, it will be about ten times
slower than it would if you reformatted it as 1:2 (or 1:4, depending on
your drive). The tradeoff is that the interleave will also reduce the
performance for a PC (e.g. 1:2 will take twice as long to read or write)
but on average you get best performance by increasing the interleave to
suit the slowest computer.

-- 
David Empson
dempson@actrix.gen.nz