Z80 home brew with FDC
lynchaj at yahoo.com
Sun Sep 21 08:12:46 CDT 2008
On 9/21/08 5:24 PM, "Alexis" <thrashbarg at kaput.homeunix.org
<http://www.classiccmp.org/mailman/listinfo/cctalk> > wrote:
> On Sun, 21 Sep 2008 09:37:51 pm Andrew Lynch wrote:
>> I have a working prototype on my bench and can read and write sectors and
>> format tracks.
> I never worked out how to format tracks on the 8272. It's one of the
> that puts me off using them. Could you describe how it's done?
> The other thing that puts me off is the data clock separator. How are you
> doing this?
Look at the code for the CompuPro Disk 1 interface. I don't have to code for
my CBIOS handy but I recall that you have to establish a 6-byte command
buffer (with the right parameters), establish the interleave (if formatting
with one) and then loop through all of the tracks sequentially, sending the
format command for each track. I used a hardware interleave so that my CBIOS
didn't have to do it.
The command buffer for my CP/M system looks like this. The fields come right
from the 8272 manual.
FMTDAT .DB F_FMT ; format command
.DB 00H ;HDS,DS1,DS0
.DB NFIELD ;N (0, 1, 2, 3) 0=128-byte sectors
.DB FSC ;Sector count (26,15,8) =1ah
.DB 01BH ;SPECIAL FORMAT GPL.
.DB 0E5H ;D (FILLER BYTE)
Collector of Classic Computers
Build Master and lead engineer, Altair32 Emulator
Hi Alexis, Rich,
Thanks Rich! Yes, Rich has the right command sequence but you also need to
send the C, H, R, N to the i8272 for each sector during the execution phase.
It is not very intuitive but I got it working last night on my test bench
and confirmed it is working with Dave Dunfield's IMD program (Thanks Dave!)
and the Catweasel with CW2DMK (Thanks Tim!). For some odd reason it also
requires a leading $00 to format correctly which I don't understand either.
Basically, it is like writing a sector but you feed it sector metadata as it
goes around the track formatting sectors. Note, during execution phase it
is not like feeding the MSR/data registers like during the command/result
phase. The whole NEC765/i8272 process is kind of screwy IMO and I am
struggling to get my brain around it. I have sample code if you'd like to
see it but it is an awful mess right now.
As for the data separator, I am using an FDC9229 although you could use a
FDC9239 I think. The chips are still available but not exactly common. You
have to look but you can find them. I have some pointers if you'd like.
Actually, Alexis, you'd be the perfect guy for building your own Z80 home
brew FDC as you already have done most of this on your other projects. You
did an awesome job on your home brew 8080 a while back and your other
projects have been great too. Your experience would be a lot of help to the
project in putting out a design that not only works but is reliable and
I'd like to support as many hobbyists as possible so I am trying to preserve
the hardware "hooks" to support 8" drives, etc. Due to the complexity of
this project it could really use another set of eyes to check the design.
There are many subtle issues with FDCs that require real hardware
One final note, the i8272 data sheet for the FORMAT TRACK command is rather
misleading or at least incomplete IMO. I prefer the SMC FDC765 datasheet
found on the BitSavers.org site (Thanks Al!). It also has data sheets for
hard to find units like the FDC9216, FDC9229, FDC9239, etc. Warning: 45MB
Thanks and have a nice day!
More information about the cctalk