*BSD News Article 6151


Return to BSD News archive

Path: sserve!manuel.anu.edu.au!munnari.oz.au!network.ucsd.edu!ucsd.edu!brian
From: brian@ucsd.edu (Brian Kantor)
Newsgroups: comp.unix.bsd
Subject: Re: How to format UNIX floppies under 386BSD
Date: 6 Oct 1992 21:10:39 GMT
Organization: The Avant-Garde of the Now, Ltd.
Lines: 21
Message-ID: <1asvcfINN7qu@network.ucsd.edu>
References: <1992Oct5.153315.22272@ninja.zso.dec.com> <1992Oct6.145844.669@rucs2.sunlab.cs.runet.edu> <1992Oct6.173648.13606@ninja.zso.dec.com>
NNTP-Posting-Host: ucsd.edu

alan@ulka.zso.dec.com (F. Alan Jones) writes:
>source for isa/ide lower level floppy formatting?  Does there exist
>a good reference on the subject?

The manual for the floppy controller chip shows you precisely what
you need to do to format a floppy.  If you want to see example code that
implements that flowchart, look at the IBM PC Technical Reference
Manual in the BIOS listing, or at any of the older CP/M BIOSs.

In short, what you have to do is fill up a buffer or set up a series of
loops that will feed the image of a formatted floppy track to the floppy
controller chip one byte at a time fast enough.  DMA can help this.

The usual procedure is to write a track, read it back, mark and remember
it if it's bad, and then when you're all done writing the disk, go back
and fill in the FAT.

Note that this requires pretty heavy I/O access to the floppy controller
chip, which isn't buffered in the PC architecture.  Many systems have
rather poor multiuser performance whilst they are formatting a floppy.
	- Brian