Page 1 of 1

Floppy Controller

Posted: Thu Apr 21, 2022 9:31 pm
by jds
I've had a floppy drive working on my Rockwell Forth system for some time now, but haven't managed to document as I'd planned to, so I thought I'd post a picture of it here in the mean time.

The motivation for this is that the Rockwell Forth ROM has built in code for floppy disk control, so the software side is done. The documentation on this shows a block diagram of possible hardware using a Western Digital 1993 controller. This particular chip requires a lot of support circuitry to interface with a drive, but the newer 1793 has all of this built in, and the data sheet says that they are register compatible. So it should be possible to build a relatively simple controller using the 1793. This was a very common floppy controller back then and most of the more modern controllers were backward compatible (The main exception being the NEC 765 controllers).

So this is what I built:
IMG_0055.jpg
And with a bit of debugging and a couple of patch wires it actually works. These controllers are not fast enough for HD disks, so it should work with most 5 1/4 inch drives and up to 720k 3.5 inch drives, but not 1.44 MB drives. One of the little tricks I discovered is that I needed to cover the HD marker hole on a 3.5 inch disk to get it to work.

There are two patch wires, one was a simple mistake where I used the wrong address line, the other was a logic error that required an inverted signal that happened to be available.

The Rockwell software uses what is now a non-standard format and it took me a while to figure out parameters that worked, but eventually I managed to get it working reliably with what is a 640k capacity on a 3.5 inch disk. This is 80 tracks, 16 sectors per track, 256 byte sectors, double sided. The software loads 1k blocks and it seems very fast. I don't have a filesystem just block read and write functions. I haven't managed to get the Forth screen editing working yet, but this is probably down to my lack of experience with Forth.

To format a 640k 3.5 inch disk I used these words:

Code: Select all

320 B/SIDE !
80 0 FORMAT
And there is a word called R/W that can be used to read or write a 1k block.

I'm shifting houses soon, so this will have to go in a box for a few weeks at least, but I would like to try changing the format to be compatible with the IBM disk format so that I can transfer data from a PC to the Forth board. Maybe not a full FAT filesystem, but just being able to read and write Forth screens would be really useful.

Re: Floppy Controller

Posted: Thu Apr 21, 2022 9:42 pm
by akohlbecker
Very cool! Can you share your schematic?

I've been planning on designing a floppy interface myself, though I picked up a WD37C65C instead (looks like a more recent chip?)

Re: Floppy Controller

Posted: Fri Apr 22, 2022 2:30 am
by jds
I'd guess that the WD37C65C would be similar, but probably includes the input and output registers that I implemented with the 74LS logic. So it should be an even simpler design. And it would probably support HD disks too.

Here's the schematic.

Re: Floppy Controller

Posted: Fri Apr 22, 2022 8:05 am
by akohlbecker
Looks like you posted the wrong file!

Re: Floppy Controller

Posted: Fri Apr 22, 2022 8:50 am
by gfoot
I'm currently building my own floppy controller from TTL parts, mostly for the experience and understanding what actually goes over the wire to the floppy drive. I have a working read circuit hooked up to an Arduino, and have planned the extensions to make it work well with a 6502 (latching the data, and having control registers to let the 6502 control the drive) but I haven't had time to actually go ahead and implement the extensions yet.

So far it's been much simpler than I thought it would be, but writing to the disc (while still working within the standard disc soft sectoring format) is going to be a whole new challenge as well!

Re: Floppy Controller

Posted: Fri Apr 22, 2022 2:02 pm
by akohlbecker
Your videos are the reason I'm even thinking about this project myself! Sharing for anyone else reading https://www.youtube.com/watch?v=t-Cblankxqc

Re: Floppy Controller

Posted: Fri Apr 22, 2022 2:49 pm
by drogon
gfoot wrote:
I'm currently building my own floppy controller from TTL parts, mostly for the experience and understanding what actually goes over the wire to the floppy drive. I have a working read circuit hooked up to an Arduino, and have planned the extensions to make it work well with a 6502 (latching the data, and having control registers to let the 6502 control the drive) but I haven't had time to actually go ahead and implement the extensions yet.

So far it's been much simpler than I thought it would be, but writing to the disc (while still working within the standard disc soft sectoring format) is going to be a whole new challenge as well!
Steve Wozniac was master of this in the Apple II - not only did he design the stripped down interface he realised he could use a different way to encode the data on the disc surface to increase the density from ~80KN to 130KB in DOS 3.3 ... His software replaced a lot of very expensive (at the time!) hardware.

Go for it :)

-Gordon

Re: Floppy Controller

Posted: Sun Apr 24, 2022 8:14 pm
by BillO
jds wrote:
I'd guess that the WD37C65C would be similar, but probably includes the input and output registers that I implemented with the 74LS logic. So it should be an even simpler design. And it would probably support HD disks too.

Here's the schematic.
Well, that's the simplest FD controller I've ever seen. Not sure it will work though. :lol:

Re: Floppy Controller

Posted: Mon Apr 25, 2022 8:51 pm
by jds
akohlbecker wrote:
Looks like you posted the wrong file!
Fixed now, sorry about that. I used print to PDF and picked up the file from the wrong directory.

I'll try and put the whole KiCad project on Github sometime. I've got some spare PCB's if anyone wants one, but I suspect that they are not that useful to anyone else as it required a particular expansion bus. I based it on the Apple II bus without worrying about being completely compatible, it is intended to work with my own backplane board. I don't have an Apple II to try it, but it might possibly work in one. That's maybe something worth thinking about.

Re: Floppy Controller

Posted: Mon Apr 25, 2022 9:01 pm
by jds
This is the floppy interface diagram from the Rockwell Forth Manual:
RockwellDiagram.png

Re: Floppy Controller

Posted: Wed Apr 27, 2022 4:05 am
by jds
I've just had some fun getting the Forth screen editing working, maybe this should be in the Forth section as it's more software. The hardware appears to be working correctly, but Forth is unforgiving of user error or lack of knowledge. The low level R/W word was working, but the screen commands would just hang and require a reset. It turns out that this is because of my RAM configuration. So I need a little bit of setup before it all works:

Code: Select all

320 B/SIDE !
HEX
1000 MEMTOP
And after that I have full disk based screen editing, which is a lot nicer than trying to transfer files from the terminal.

Forth is starting to make more sense to me now.

Re: Floppy Controller

Posted: Sat Apr 30, 2022 6:07 am
by fachat
drogon wrote:
gfoot wrote:
I'm currently building my own floppy controller from TTL parts, mostly for the experience and understanding what actually goes over the wire to the floppy drive. I have a working read circuit hooked up to an Arduino, and have planned the extensions to make it work well with a 6502 (latching the data, and having control registers to let the 6502 control the drive) but I haven't had time to actually go ahead and implement the extensions yet.

So far it's been much simpler than I thought it would be, but writing to the disc (while still working within the standard disc soft sectoring format) is going to be a whole new challenge as well!
Steve Wozniac was master of this in the Apple II - not only did he design the stripped down interface he realised he could use a different way to encode the data on the disc surface to increase the density from ~80KN to 130KB in DOS 3.3 ... His software replaced a lot of very expensive (at the time!) hardware.

Go for it :)

-Gordon
Sorry ro spoil the fun ;-)

Woz' data format was far from optimal, Commodore GCR and MFM were even more bits per inch.
https://extrapages.de/archives/20190102 ... notes.html

Where he excelled was the optimization into as few chips as possible. So much that, that it relied on exact CPU timing, and as far as urban myth goes, prevented the 65816 from becoming even faster. It had to introduce NMOS type bogus cycles that weren't necessary to not break the Apple II disk interface when they switched.
So we all still suffer (a bit ;-) ) today from this optimization.

But that just as a side note. I'm working on my own floppy controller, so I totally understand the desire to understand all that!

André

Re: Floppy Controller

Posted: Sat Apr 30, 2022 6:41 am
by BigEd
Thanks André, once again, for your floppy notes - an excellent resource!

Re: Floppy Controller

Posted: Sat Apr 30, 2022 7:25 am
by BigDumbDinosaur
BigEd wrote:
Thanks André, once again, for your floppy notes - an excellent resource!

Yep! I’ve read it and it is very interesting.