FDC (Floppy Disc Controller) Is
IBM Pentium 366Mhz, BBC B+ 64k 1770, year 2001
For an IBM PC with 1.2Mb 5.25" disk Dive B:
BBC DFS 1770 80 or 40 track
Double sided or Single Sided Drive with High Density disks (IBM 360K).
fd1 for IBM drive B:, fd0 IBM drive A:
bbc80, for 80t, BBC for 40t
ddinhd for IBM 360k Floppies, ddindd for IBM floppies 1.2Mb
sd for single density disks
ss for single sided drives or floppies formatted on one side
Write, write0, write1 file.ssd, file.dsd, file.img. To write a Disc Image from
an IBM to a BBC disk
Read [filename], Read0, Read1 etc. To extract a BBC to IBM PC
To find the parameters for FDC I formatted a floppy in a BBC put it in IBM and
tried to use the read command trying various parameters until successful. Here
the S command is very useful, it will produce something like this.
DRIVE fd1
CYLINDERS 80 HEADS 1 SECTORS 10 BYTES 256 SD SINGLESTEP
MINSECTOR 0 GAP3 10 GAP3FORMAT 14 FILL E5 DDinHD (300 kHz, 360 RPM)
SINGLESIDED HEAD0ALIAS 0 HEAD1ALIAS 0
After a read/verify error: STOP
If you find and read the information on various Disk filing systems, disk drives and Technical specs you should know what you must work towards. Alternatively the S command will help with a logical trial and error approach.
Note:
I could not get the CAT command to work or Format. I found it best to format
floppies in the BBC put them in an IMB to write them.
Note:
Back in the days when I could get 5.25" disks and I only had a BBC I recall
that my BBC had problems if I tried to feed it Double Density Disks. Its far
to long ago to recall what or why and I have not been able to find even one
to use!
People with other configurations can add/edit this file to make it more useful.
gowst@hotmail
FDC, based on John Wilson's FDCDEMO (version 12-Sep-1995),
april 1996/nov 1998,
by W.H.Scholten
John Wilson's comments:
FDCDEMO is a program demonstrating how to program the floppy disk controller found in the IBM PCs and clones (based on the NEC 765 chip and its successors).
FDCDEMO.ASM contains the assembly language source code (MASM or TASM) of both the public-domain FDC driver code, and a simple command line interpreter which demonstrates how to call the FDC driver, and allows the user to set all disk parameters and read, write, and format disks using keyboard commands. This may in itself be useful for making image files of disks for emulators etc., or writing boot images to disks for Linux etc. (replacing RAWRITE.EXE).
Note
that Beebwin and some other programs expect disk image files to have the sectors in logical order instead of physical order; you will need to write a small program to correct the order in this case, or if you can find out the required order drop me a line and maybe I can help.
Note
that most PC floppy controllers have broken single density modes. They may still be able to read single density disks with a few retries, but they can't write or format them. However, FDCs based on the 37C65 series of chips appear to work OK; this chip is normally in a 40-pin DIP or 44-pin PLCC package and has one 9.6 MHz crystal and one 16 or 32 MHz crystal (as opposed to the more common chips that use a single 24 MHz crystal). The bottom-of-the-line ISA IDE/FDC controller from JDR Micro Devices was based on this chip when I ordered mine, you might want to try them but of course nothing is guaranteed, they might have changed the circuit since then.
The syntax of each command is given below. More than one command may be on a line if the commands are separated by blanks or tabs. Commands may be abbreviated to any unique abbreviation, except for FORMAT, PUT, and WRITE, which must be spelled out in full (for safety, such as it is). There are commands to set each parameter individually, and then there are "macro" commands to set all parameters for the standard DOS disk types, as well as a few DEC and BBC types.
This program is not intended to be a sector editor, it is only able to read and write either one sector at a time or one disk at a time, and there is no way provided to edit the sector buffer contents. If necessary you can use SAVE and LOAD to move data between the sector buffer and files (one sector at a time), and then use DEBUG.COM to edit the disk files, but that would be hellish for a big job.
The SHOW command is a little cumbersome, since all it can do is dump out the whole sector, which is more than a screenful for 512- and 1024-byte sectors, so you need to be ready with the Pause key.
I'm a little proud of the logic used by READ and WRITE to figure out sector interleave (using the SECZER/SECINI/SECNXT routines), if you're in a position where you need to read or write large sections of a disk quickly using only a one-sector buffer you may want to take a look at that code. Otherwise the command-line front-end is basically throwaway fluff intended simply to demonstrate the FDC code and help with testing disk parameters.
John Wilson 11 Bank Street Troy, NY 12180-4303
+1 (518) 271-1982 <wilsonj@alumni.rpi.edu>
Note from me (WHS): newer computers seem to have better single density support than older ones. Many people have reported singly density started working after getting a new computer/mainboard!
COMMAND SUMMARY, updated for FDC by whs (wouters@cistron.nl), minimum abbreviations are shown with brackets.
-----------------------------------------------------------------------
180KB Set up all disk parameters for 180KB 40-track 9-sector SS DD floppies.
This command sets DOUBLESTEP on the assumption that you are using a 1.2MB (i.e. 80-track) drive, if you're really using a 180KB or 360KB (i.e. 40-track) drive you must issue a SINGLESTEP command afterwards.
360KB Set up all disk parameters for 360KB 40-track 9-sector DS DD floppies.
This command sets DOUBLESTEP on the assumption that you are using a 1.2MB (i.e. 80-track) drive, if you're really using a 180KB or 360KB (i.e. 40-track) drive you must issue a SINGLESTEP command afterwards.
720KB Set up all disk parameters for 720KB 80-track 9-sector DS DD floppies.
1.2MB Set up all disk parameters for 1.2MB 80-track 15-sector DS HD floppies.
1.44MB Set up all disk parameters for 1.44MB 80-track 18-sector DS HD floppies.
2.88MB Set up some disk parameters for 2.88MB 80-track 36-sector DS ED floppies.
Since I have no 2.88MB drive the support is incomplete.
fd0, fd1, fd2, fd3 Select which floppy drive to use. Default is fd1. Most systems support only two drives so fd2 and fd3 may not do anything useful.
BBC Default. Set up all disk parameters for BBC DS SD 40-track 10-sector floppies on 360K PC drive. For 80 track floppies in a 1.2M drive also enter CYL 80 (and DDINHD might be needed).
BBC80 Same as bbc but for 80 track disks (you may need to enter DDINHD after this). Paramters set are: 'bbc', then cyl80.
BBC640 Sets 3.5" ADFS L 640 K format with a head1alias =1. If it doesn't work, try head1alias=0. Parameters set: 'bbc', cyl 80, bytes 256, sectors 16, head1 1.
BBC800 Sets 3.5" ADFS 800 K format (archimedes) with a head1alias =0. If it doesn't work, try head1alias=1.
Parameters set are: BYTES n Set number of bytes per sector. "n" is 128, 256, 512, or 1024.
CAT n Where n is 0 or 1. Shows files on side 0/1 for BBC DFS format.
CONT Continue reading/formatting after a read/verify error.
Useful to read bad disks. CYLINDERS n Set number of cylinders per disk. Usually 40 or 80, but anything up to 256 is allowed.
DD Set recording method to MFM (modified frequency modulation) for double density (or HD or ED) disks.
DDINDD Set data rate for double density (e.g. 360KB) disk in a double density (i.e. 360KB) drive. Note that if you are using a generic 360KB 40-track drive, you will probably want to set SINGLESTEP too.
DDINHD Set data rate for double density (e.g. 360KB) disk in a high density (i.e. 1.2MB) drive. Note that if the disk comes from a machine that uses normal (e.g. 360KB) 40-track drives, you will probably want to set DOUBLESTEP too.
DO[UBLESTEP] Set the seek code to double head stepping, for using 40-track disks in 80-track drives.
DS Set up for double-sided disks (default). (No longer equivalent to HEADS 2)
ED Set data rate for extended density vertical format disk (i.e. 2.88MB).
FILL hh Set the hex value of the fill byte to be used to blank out sectors during a subsequent format operation. FORMAT, FORMAT0, FORMAT1 Format and verify the disk using the currently set parameters.
GA[P3] n Set the size of gap 3 in the disk format (see any FDC chip's data sheets if you don't understand what this means).
GAP3F[ORMAT] n Set the size of gap 3 written during a subsequent format operation (see any FDC chip's data sheets if you don't understand what this means).
GET cyl [head] sec Get a single sector into the sector buffer, from the specified decimal cylinder, head, and sector location on the disk. The head number is (must be) omitted when using a single-sided disk (i.e. "SS"). HD Set data rate for high density disk (i.e. 1.2MB or 2.88MB).
HEAD0[ALIAS] n Set head alias to use in headers on side 0. Normally 0.
HEAD1[ALIAS] n Set head alias to use in headers on side 1. Normally 1. Some unusual formats (e.g., by Commodore, BBC) use values other than the physical head number for the "head" field in sector headers.
REMOVED:HEADS n REMOVED:Set number of heads, 1 or 2. "SS" and "DS" commands are equivalent. heads is now only used internally during disk reading/writing LOAD filename Load the sector buffer from a file (containing data for a single sector). Size is determined by the BYTES command.
M[INSECTOR] n Sets the minimum sector number on each track. Normally 1, but 0 on some variants (BBC).
PUT cyl [head] sec Put a single sector from the sector buffer, onto the specified decimal cylinder, head, and sector location on the disk. The head number is (must be) omitted when using a single-sided disk (i.e. "SS").
Q[UIT] Quit to DOS.
R[EAD] filename, READ0 filename, READ1 filename Read entire contents of disk into an (for double sided: interleaved) image file. All sectors appear in the file in the same order as on the disk.
READ0 and READ1 only read sides 0 and 1.
RX01 Set up all disk parameters for DEC RX01 SSSD 77-track 26-sector floppies (8", or 5.25" workalike disks).
RX02 Set up all disk parameters for DEC RX02 SSDD 77-track 26-sector workalike floppies.
RX50 Set up all disk parameters for DEC RX50 SSDD 80-track 10-sector floppies. SAVE filename Save the sector buffer to a file (which receives data for a single sector). Size is determined by the BYTES command.
SD Set recording method to FM (frequency modulation) for single density disks.
N.B. most PC FDC chips can't write SD disks properly, but many can read them given a few retries.
SECTORS n Set number of sectors per track.
SHOW Show contents of sector buffer in hex and ASCII. Sorry, the program doesn't let you edit it, you'll have to SAVE it to a file and edit it there.
SI[NGLESTEP] Set the seek code to use normal head stepping, for anything other than using 40-track disks in 80-track drives. SS Set up for single-sided disks. (No longer equivalent to HEADS 1)
S[TATUS] Display all disk settings.
STOP Stop reading/formatting after a read/verify error.
W[RITE] filename, WRITE0 filename, WRITE1 filename Write entire contents of disk from an (for double sided: interleaved) image file. All sectors appear in the same order on the disk as in the file.
WRITE0 and WRITE1 write the imagefile to side 0,1.