Sector Interleave (Was: "Bounce buffer" copyright [was Re: flash
cisin at xenosoft.com
Mon Nov 30 14:45:22 CST 2015
On Mon, 30 Nov 2015, dwight wrote:
> I wrote an interleave formatter for a friend to use on his H89.
> He had an enormous data file that took for ever to read in BASIC.
> He couldn't believe it could be made to work so much faster.
Oversimplified remedial tutorial:
Ideally, the system reads a sector, does what it has to do with the
content, and goes back for the next one, and can read every sector of the
track in a single revolution.
But, if the system can't finish with a sector in time for the next sector,
then it's going to have to wait a full revolution of the disk, which would
be the worst condition. With 10 sectors per track, we are looking at a
simple file read taking 10 times as long. Well, OK, the system could take
hours to process the data from the sector, so there is no maximum possible
slowness. Maybe Microsoft knows what the maximum slowest is.
Most "modern" systems can keep up with simple numeric sequence, although
some software can slow things down enough to bring the problem back.
If it is just barely too slow to get the next sector in sequence, then a
simple rearrangement of the sectors on the disk could solve it.
Something as simple as arranging the sectors such as 1,6,2,7,3,8,4,9,5
The rest of the software doesn't even need to know about it. It still
asks for sector 1, then asks for sector 2, etc.
If that's still not enough, it can go something such as 1,4,7,2,5,8,3,6,9
Obviously, simply loading the content of a file into memory can be done
quicker than if some software is trying to process the incoming data.
Some of us have been crazy enough to use disks with different sector
sequences for data files of different programs (WORDSTAR V WEIRD
V WORDPERVERT V SUPERCALC, etc.)
In addition, depending on how long the drive takes to move to the next
track, you might need more time before reading the first sector of the
next track. So, in some cases, it may be more efficient to have the first
sector of the next track not be the first physical sector on that track.
The sectors of that track could be in the same pattern, but simply
starting at a different point in the cycle.
A computer system that rearranges sectors on the track can normally manage
OK with a disk formatted on a different system with a different physical
sequence. If you are writing a program to FORMAT disks for a machine, the
sector sequence will not necessarily matter, although it could result in
When looking at an unfamiliar disk format, if the sectors are not in
sequential order, then it usually means that the OS uses them in numeric
order, but that the arrangement is out of numeric order for efficiency.
Sector sequence can also be done in software. With the physical sectors
still arranged sequentially and consecutively, the OS could decide that
the first "logical" sector(s) are in sector 1, and the next logical
sector(s) are in sector 3, etc. ("deblocking")
If the sectors of an unknown disk are in numeric order, it could mean that
1) the system was efficient enough to handle consecutive sectors
2) the designer didn't care about that level of efficiency
3) the OS is not using the sectors in numeric order.
In that case, it calls for examining the content of sectors, looking for
information flow. If you encounter the first part of a word of text at
the end of one sector ("half a worm in the apple"), and the rest of the
word at the beginning of another sector, that helps determine the sector
sequence. If you aren't lucky enough to have text files in a language
that you can follow, look for source files (such as DUMP.ASM), and machine
language of processors that you can follow.
Tracks where some sectors have been over-written with other content can
make it more confusing to determine the sequence.
It is USUALLY the same on every track, but there are rare exceptions.
And different disk formats from the same manufacturer may be different.
Physical format may be different on boot or system tracks than on the
rest of the disk. Other than sector numbers the physical format is
usually the same on both sides of a DS disk. When you encounter one that
is not, it is likely to be a DS disk that has been reformatted to use on a
SS machine, such as re-using a PC disk for an Osborne.
Grumpy Ol' Fred cisin at xenosoft.com
More information about the cctalk