Linux / Heathkit H8/H89 Tools

Using H8/H89 Z37 Soft Sectored Floppies With Linux

Preparing Linux

I have an H8 with Norberto's Z37 controller and a 3.5 inch 720k floppy drive. You can use 1.4M drives as long as they will properly detect 720k disks. I have a 1.4M drive in my Linux machine.

So we start with the drive specs for the Z37 on the H8 using CP/M:
3.5 Inch drive
80 Tracks
Double Density
16 Sectors per Track
256 Bytes per Sector
Capacity of 620k

Format the disk under CP/M as double density, double sided.

Now on your Linux machine, what you don't have Linux! Well it's about time you stepped up to a better operating system don't you think:-)

You will require the "fdutils" package to be installed on your machine. Debian\Ubuntu\Mint etc users can install with "sudo apt-get install fdutils" Fedorea users will have to do the same only using Yum.

First we make the device node:

You must choose an unused device number from the Geometry table below, I chose device 20, it is listed as an 880k, 5.25" drive. I will never have or use such a drive so I can easily replace the device node.

mknod /dev/fd0z620 b 2 80
             ^    ^ ^  ^
             |    | |  Minor device number (format number * 4 +
             |    | |                       drive + controller*128)
             |    | Major device number (always 2!)           
             |    Blockdevice
    A name that you choose for the format. I
    recommend basing the name on the capacity,
    but you may choose any name you want.
I chose floppy device fd0 and added a z for z37 and 620 for the capacity.

So to replace device 20 in the geometry table, I end up with device node 80 for my device. It works out like so (20*4+0+(0*128)) = 80

Then we redefine the geometry of the new device with setfdprm:

setfdprm /dev/fd0z620 sect=16 dd ssize=256 dtr=2 cyl=80

Finally we tell the floppy driver to autodetect the new format when using just the short version of the Linux floppy device name, /dev/fd0

floppycontrol --autodetect 20,7,8,4

This says, try the z37 620k format first then, 720k,1440k and 2880k

If you want to restore the autodetection to default, this is what it is:

floppycontrol --autodetect 7,8,4,25,22,31

Finished! Easy right. You can now happily use your floppy drive, well at least until the next time you boot, then you will loose all your changes. To make it permanent see the Boot Time section next.

Boot time

To make your settings stick you must tell Linux to set this up every time you boot. Fortunately that is dead simple. Just put the commands we just configured into your /etc/rc.local file and make sure it's executable.

Step 1 - Add this to your /etc/rc.local file
mknod /dev/fd0z620 b 2 80
setfdprm /dev/fd0z620 sect=16 dd ssize=256 dtr=2 cyl=80
floppycontrol --autodetect 20,7,8,4

Step 2 - Make sure it's executable

chmod +x /etc/rc.local

Of course you must do all this as "root" or with the sudo command.

Copying images

You can now copy images of your floppies or make new floppies of an image stored on your Linux box. What! You don't have Linux!!

Good old dd comes to the rescue here.

Make an image from the floppy:
dd if=/dev/fd0z620 of=

Copy image to floppy:
dd if= of=/dev/fd0z620

I use a filename that is descriptive and also has the format in it, such as:


Using the cpmtools package

You can use the cpmtools package to work with floppies under Linux. Use your package manager and install cpmtools.

Add this to your /etc/cpmtools/diskdefs file

diskdef h37
  seclen 256
  tracks 80
  sectrk 16
  blocksize 2048
  maxdir 256
  boottrk 2
  os 2.2
Now you can use the CP/M tools software to:

cmpls - list files on CP/M disks
cpmcp - copy files to and from CP/M disks
cpmrm - remove files on CP/M disks
cpmchmod - change file mode on CP/M files
cpmchattr - change file attributes on CP/M files

for example, to list the files on a disk:
cpmls -f h37 /dev/fd0z620

Because we set the autodetect list above you can now just use the base device and not the full device name, like so:

cpmls -f h37 /dev/fd0

Geometry Table

This is the original Linux geometry table
1 360KB, 5.25" DD drive
2 1200KB, 5.25" HD drive 
3 360KB, 3.5" DD drive 
4 720KB, 3.5" DD drive 
5 360KB, 5.25" DD disk in HD drive 
6 720KB, 5.25" DD disk in HD drive 
7 1440KB, 3.5" HD drive 
8 2880KB, 3.5" ED drive 
9 3120KB, 3.5" ED drive 
10 1440KB, 5.25" HD drive 
11 1680KB, 3.5" HD drive 
12 410KB, 5.25" DD disk in HD drive 
13 820KB, 3.5" DD drive 
14 1476KB, 5.25" HD drive 
15 1722KB, 3.5" HD drive 
16 420KB, 5.25" DD disk in HD drive 
17 830KB, 3.5" DD drive 
18 1494KB, 5.25" HD drive 
19 1743KB, 3.5" HD drive 
20 880KB, 5.25" DD drive 
21 1040KB, 3.5" DD drive 
22 1120KB, 3.5" DD drive 
23 1600KB, 5.25" HD drive 
24 1760KB, 3.5" HD drive 
25 1920KB, 3.5" HD drive 
26 3200KB, 3.5" ED drive 
27 3520KB, 3.5" ED drive 
28 3840KB, 3.5" ED drive 
29 1840KB, 3.5" HD drive 
30 800KB, 3.5" DD drive 
31 1600KB, 3.5" HD drive