formatspecs, making for much cleaner code. Reformatted everything.
This actually happened in multiple steps but then I corrupted my local
repository and I had to recover from the working tree.
favour of pod objects, which allows STL contains. Lots of shared_ptrs
everywhere. Much simpler and more effective code. The reader works with one of
the decoders; still have to do the rest of them and the encoders.
North Star DOS provided an upgrade path for disks formatted as
single-density to hold double-density data without reformatting. In
this case, the four directory blocks will be single-density but other
areas of the disk are double-density. This cannot be accurately
represented using a .nsi file, so in these cases, we pad the sector to
512-bytes, filling with spaces.
North Star Floppy disks use 10-sector hard sectored disks with either FM
or MFM encoding. They may be single- or double-sided. Each of the 10
sectors contains 256 (FM) or 512 (MFM) bytes of data. The disk has 35
cylinders, with tracks 0-34 on side 0, and tracks 35-69 on side 1.
Tracks on side 1 are numbered "backwards" in that track 35 corresponds
to cylinder 34, side 1, and track 69 corresponds to cylinder 0, side 1.
The North Star sector format does not include any head positioning
information. As such, reads from North Star floppies need to be
synchronized with the index pulse, in order to properly identify the
sector being read. While there is a command line option:
--sync-with-index, that does this, the North Star reader forces this
behavior by default.
MFM sectors have 32 bytes of 00's followed by two sync characters,
specified in the North Star MDS manual as 0xFBFB.
This is true for most disks; however, I found a few disks, including an
original North Star DOS/BASIC v2.2.1 DQ disk, that uses 0xFBnn, where
nn is an incrementing pattern.
While searching for the start of a sector header, seekToPattern()
ignores the sector pulses. If a sector header cannot be decoded for any
reason, seekToPattern() will advance past one or more sector pulses.
For this reason, the _hardSectorId is calulated after the sector header
is found.
Due to the nature of the track ordering on side 1, an .nsi image reader
and writer are provided for double-sided disks. The .nsi image format
supports both single- and double-sided disks; however, single-sided .nsi
images are equivalent to .img images.