Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Jan 2002 23:15:49 +0100 (CET)
From:      Oliver Fromme <olli@secnetix.de>
To:        freebsd-hackers@FreeBSD.ORG, Randell Jesup <rjesup@wgate.com>
Subject:   Re: FreeBSD Floppy driver needs enhancement...
Message-ID:  <200201092215.g09MFnn15086@lurza.secnetix.de>
In-Reply-To: <7dcbb25c031dc107d2@[192.168.1.4]>

next in thread | previous in thread | raw e-mail | index | archive | help
Randell Jesup <rjesup@wgate.com> wrote:
 >         Yes (if anyone still cares about floppies).  The old Amiga
 > trackdisk (floppy driver) could do that, since all the decoding was in
 > software (and via the graphics bitblitter(!)).  Do the integrated disk
 > controllers in PC's (still) allow direct raw bit access, or only after MFM
 > decoding?

No, it can't.  The FDC in a PC (a NEC µPD765 or a clone of
it, nowadays usually embeded within a multi-I/O-controller
or the mainboard chipset) is severely limited in what it
can do.  Basically, it can only read MFM-encoded sectors of
several fixed sizes, with a fixed header.  You can neither
read Amiga floppies nor C64 floppies with a standard PC
FDC.  I think you can't even read the actual value of the
CRC, if I remember correctly.  You only get to know whether
the check failed.

I once wrote a (fairly popular) floppy disk copy program
for DOS in assembler, which worked by directly accessing
the FDC (no BIOS calls involved).  I think I still have the
original NEC docs somewhere in a box in the basement.  By
the way, it's the same FDC that was used in the Schneider
CPC 464 back in th 80s, with its 3" (yes 3", not 3.5")
floppy drive.

In contrast, the FDC of the Amiga was like heaven.  You can
read the floppies at bitlevel with that beast.  The actual
data encoding (MFM or GCR) was done by a coprozessor.
That's why you can read PC-formatted floppies with the
Amiga, but not vice versa.  I think that the native Amiga
floppies use MFM2 encoding.

C64 floppies use GCR encoding.  There's no chance to read
them with a standard PC floppy disk controller.

 > Also, I seem to remember PC's can't recover from bad sector ID's.

That's true.  Basically, when you read a sector from a
floppy on the PC, you tell the FDC exactly what sector you
expect (sector, track, head, size, and strange things such
as a "deleted" flag).  If the controller does not find a
sector with exatly those contents in the header on the
current track, it just fails.

That opened possibilities for several sick copy protection
mechanisms.  I've seen commercial floppies that had a 81st
track (floppy drives can read up to two tracks beyond the
official limit, some even more), and all sectors on that
track marked as being track 99.  Standard copy programs
just couldn't copy that track -- even if they looked for an
81st track, they couldn't find any sectors, so assumed that
the track wasn't formatted.

However, there was a copy program (no, not mine) which was
able to handle that stuff, but extremely slowly.  It used
another trick of the PC FDC:  The µPD765 a command to look
for the next track and return its location data.  So you
can just look what is there, then read it.  And copy it.

There were other, even more sick copyright mechanisms,
though, which were impossible to copy (such as changing
of the bitrate within a track etc.).  That stuff wasn't
very common, fortunately.

Regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"All that we see or seem is just a dream within a dream" (E. A. Poe)

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201092215.g09MFnn15086>