Friday, March 28, 2014

What is on Sector 1, cylinder 0, side 0 of your Floppy Disk

Computers of the CPM genre and I mean in the early 1980's   (well before the IBM PC become a household presence) used floppy disks to store programs and data.

Either 5.25 or 8 inch floppy disks

At this time 3.5 or 3.x inch diskettes had not been invented

The Earliest recording format was Frequency Modulation (FM) and is usually spoken of as Single Density.  Soon this was replaced by a more sophisticated Modified Frequency Modulation  (MFM)

When the IBM PC was announced it started off with MFM diskettes so they never had to deal with the issue of FM diskette compatibility.

But the rest of the industry did.

What was the problem and solution in more detail?



Philosophically Aside
Before talking about the problem and solution in more detail it is important to realise that the IT industry used to believe in backward compatibility.

The idea is that no matter how dumb an ancient design was manufacturers did their best to guarantee that your old software or even hardware parts would be compatible with the new computers.

Today it's not so true.  Today we have
a) Maintain compatibility, but that old design was dumb
b) Use a software emulator so that your old software still works
c) Screw you Mr Customer.  Our old design was insane.   We break compatibility and to take advantage of our new hardware/ software,however you might need to repurchase your application.



Windows 1 to Windows 8

As you can see from this video, Microsoft used to always go for (a), other manufacturers would however might prefer (c)

Back to the plot
Many manufacturers of the day created a 

Mixed density format diskette.

In this schema typically track 0, or a part of track 0, perhaps the first sector contains a signature to say how the rest of the diskette is formatted.

How did it work out?
The IBM PC could not natively read FM diskettes.  So if the first track was in FM format this screwed up the PC's abilitiy to make sense of the diskette without using special conversion software.

The early IBM PC used the NEC PD765 diskette controller. But today's computers do not.  So that special software that could have worked under 16bit IBM / MSDOS will not work under todays 32bit and 64 bit systems.


To make it clear we can check an example
The example I know best would be the Cromemco 5.25 and 8" disk formats.  And I'm going to quote from the manuals thus:

DISK ORGANIZATION
Each disk used under CDOS is divided into two general
areas. The first area is the System Area. It may be
accessed by the user only through the WRTSYS utility
program or when creating a boot file with CDOSGEN. The
contents of this area are not listed by the DIRectory
intrinsic command. The System Area occupies the outer
tracks of the disk.

The second area is the File Area. This is the section
where user files (e.g., programs, data, etc.) and the
disk directory are stored.

        Tracks in      Approximate
Disk    System Area    File Area
------- -----------    ---------
5"SS SD 3               8lK
5"DS SD 3              l7lK
5"SS DD 2              l88K
5"DS DD 2              386K
8"SS SD 2              24lK
8"DS SD 2              490K
8"SS DD 2              596K
8"DS DD 2            1,208K

(SS=Single Sided; DS=Double Sided; SD=Single Density;
DD=Double Density)

The use of the two areas previously described is not
related. Even if the DIRectory command indicates a full
disk, a copy of the CDOS boot file may still be written
to the System Area using WRTSYS or CDOSGEN. The DIRectory 
intrinsic indicates only the user file portion
of the File Area which is occupied on the disk. This
has no bearing on the System Area.

Disk Specifications
This table shows the number of tracks per disk surface,
surfaces, sectors per track, and the sector size for
COOS disks. Numbers not within parentheses are decimal.
Numbers within parentheses are hexadecimal.

                              Sectors/     Sector
Disk      Cylinders Surfaces  Track        Size 
--------- --------  -------   ------      -------
8"SD      77(0-4CH)   2       26(1-lAH)  128 bytes
8"DD      77(0-4CH)   2       l6(1-10H)  512 bytes
5"SD      40(0-27H)   2       l8(1-12H)  128 bytes
5"DD      40(0-27H)   2       10(1-0AH)  512 bytes


The first track (cylinder 0, side 0) of all floppy
diskettes is initialized as single density with l28-byte
sectors by the INIT program to allow the disk to be
booted with 64FDC, l6FDC and 4FDC versions of RDOS

Disk Type Specifiers
COOS determines what type of disk is being used from a
special disk type specifier stored in the first sector
of the disk (sector 1, cylinder 0, side 0 of floppy
disks and sector 0, cylinder 0, surface 0 of hard
disks) • The disk type specifier consists of bytes 121
through 128 of this sector. The specifier is composed
of four groups of two bytes each which contain the ASCII

values of the characters listed in the following table.

Bytes     Characters Meaning
-----     ---------- -------
121 - 122 LG         CDOS large floppy
          SM         CDOS small floppy
          HD         CDOS hard disk
123 - 124 SS         single sided floppy
          DS         double sided floppy
          11         ll-Mbyte hard disk
125 - 126 SD         single density

          DD         double density
127 - 128 ST         single tracking (never implemented)
          DT         double tracking (never implemented)


The System Area of the disk includes all or part of the
first 1, 2, or 3 tracks of the disk, depending on the
disk type. The space reserved the System Area is always
at least 6.5K. On double density floppy disks, part of
the system area may be stored on a single density track
(cylinder 0, side 0) and part on a double density track
(cylinder 0, track 1).

The File Area starts at the beginning of the track
following the system area. (CDOS accesses disks by
alternating sides or surfaces as it works its way into
the disk by increasing cylinder numbers, so the next
track may be a different surface of the same cylinder.)
The directory always begins at the beginning of the file
area (i.e., the first lK of directory space is always on
the first track of the file area), but other parts of
the directory may be elsewhere on the disk. 

This information is summarized for each of the various types
of CDOS disks in the following table.


Disk Type System Area          Start of File Area 
--------- -----------          ------------------
LG SS SD  c0,s0; cl,s0          c2,s0
LG SS DD  c0,s0; cl,s0          c2,s0
LG DD SD  c0,s0; c0,s1          cl,s0
LG DD DD  c0,s0; c0,s1          cl,s0
SM SS SD  c0,s0; cl,s0; c2,s0   c3,s0
SM SS DD  c0,s0; cl,s0          c2,s0
SM DD SD  c0,s0; c0,s1, cl,s0   cl,s1
SM DD DD  c0,s0; c0,s1          cl,s0
HD 11     c0,s0                 c0,s1


SUDS 11.10 says:
The hidden sectors are the last two sectors on the first
track of the diskette. These sectors are left over from
composing sectors into blocks at four sectors per block.
They are not used to compose any block, so have not been
previously accessible. The hidden sectors on a floppy
diskette can-now be read by seeking to byte OFFFFFEOOh. On
large floppies, they are. the 25th and 26th sectors. On small
floppies, they are the 17th and 18th sectors.


Summary
Many early generations of 1980's computer used FM and later MFM formatted diskettes.  They typically used a special label on track 0, side 0 to indicate how the rest of the diskette was laid out.

IBM never had to deal with FM diskettes and made no allowances for the existing design of the day making such difficult difficult to read then, and now some 20 plus years later almost impossible.


Techy Notes
Marcus's catalog file notes down these specific Cromemco formats

SD means Single Density,  FM encoding
DD means Double Density,  MFM encoding

CSDSSDST 40 tracks, 300RPM, double sided, Track 0.side0 = 18 sectors x 128 bytes 250K SD, all other tracks 5 sectors per track x 512 bytes
CSDSDDST    40 tracks, 300RPM, double sided, Track 0.side0 = 18 sectors x 128 bytes 250K SD, all other tracks 250K DD, 10 sectors per track x 512 bytes 

USDSDDST 40 tracks, 300RPM, double sided, 9 sectors per track, 512 bytes per sector,  250K DD thoughout
IBM 360K    40 tracks, 300RPM, double sided, 9 sectors per track, 512 bytes per sector,  250K DD thoughout
IBM 320K    40 tracks, 300RPM, double sided, 8 sectors per track, 512 bytes per sector,  250K DD thoughout

SMDSDDST 40 tracks, 300RPM, double sided. Track 0.side0 = 18 sectors x 128 bytes 250K SD, all other tracks 10 sectors per track x 512 bytes   250Kbps MFM
SMSSSDST    40 tracks, 300RPM,  single sided, 18 sectors per track x 512 bytes per sector  250K SD
CLDSDDST    77 tracks, 360RPM, double sided, Track0.side0 = 26 sectors x 128 bytes 500K SD, all other tracks 16 sectors per track x 512 bytes  500K DD
Track.Side
00.00 26 x 128  500K SD  FM
00.01 16 x 512  500K DD  MFM
01.00 -> 76.01  16 x 512 500K DD  MFM

LGSSSDST    77 tracks, 360RPM, single sided, single density, 8" floppy,  26 sectors x 128 bytes 500K SD aka IBM 3740 format

ULDSDDST 77 tracks, 360RPM, double sided. 15 sectors per track x 512 bytes per sector

LGDSDDST    77 tracks, 360RPM, double sided, Track0.side0 = 26 sectors x 128 bytes 500K SD, all other tracks 16 sectors per track x 512 bytes 500K DD