6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 24, 2024 8:12 am

All times are UTC




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: Floppy Controller
PostPosted: Thu Apr 21, 2022 9:31 pm 
Offline

Joined: Thu Mar 10, 2016 4:33 am
Posts: 181
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:

Attachment:
IMG_0055.jpg
IMG_0055.jpg [ 2.3 MiB | Viewed 1388 times ]


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:
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Floppy Controller
PostPosted: Thu Apr 21, 2022 9:42 pm 
Offline
User avatar

Joined: Sat Jul 24, 2021 1:37 pm
Posts: 282
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?)

_________________
BB816 Computer YouTube series


Top
 Profile  
Reply with quote  
 Post subject: Re: Floppy Controller
PostPosted: Fri Apr 22, 2022 2:30 am 
Offline

Joined: Thu Mar 10, 2016 4:33 am
Posts: 181
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.


Attachments:
floppy.pdf [123.67 KiB]
Downloaded 117 times


Last edited by jds on Mon Apr 25, 2022 8:50 pm, edited 2 times in total.
Top
 Profile  
Reply with quote  
 Post subject: Re: Floppy Controller
PostPosted: Fri Apr 22, 2022 8:05 am 
Offline
User avatar

Joined: Sat Jul 24, 2021 1:37 pm
Posts: 282
Looks like you posted the wrong file!

_________________
BB816 Computer YouTube series


Top
 Profile  
Reply with quote  
 Post subject: Re: Floppy Controller
PostPosted: Fri Apr 22, 2022 8:50 am 
Offline

Joined: Fri Jul 09, 2021 10:12 pm
Posts: 741
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!


Top
 Profile  
Reply with quote  
 Post subject: Re: Floppy Controller
PostPosted: Fri Apr 22, 2022 2:02 pm 
Offline
User avatar

Joined: Sat Jul 24, 2021 1:37 pm
Posts: 282
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

_________________
BB816 Computer YouTube series


Top
 Profile  
Reply with quote  
 Post subject: Re: Floppy Controller
PostPosted: Fri Apr 22, 2022 2:49 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1488
Location: Scotland
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

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
 Post subject: Re: Floppy Controller
PostPosted: Sun Apr 24, 2022 8:14 pm 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 1007
Location: Canada
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:

_________________
Bill


Top
 Profile  
Reply with quote  
 Post subject: Re: Floppy Controller
PostPosted: Mon Apr 25, 2022 8:51 pm 
Offline

Joined: Thu Mar 10, 2016 4:33 am
Posts: 181
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Floppy Controller
PostPosted: Mon Apr 25, 2022 9:01 pm 
Offline

Joined: Thu Mar 10, 2016 4:33 am
Posts: 181
This is the floppy interface diagram from the Rockwell Forth Manual:

Attachment:
RockwellDiagram.png
RockwellDiagram.png [ 145.18 KiB | Viewed 1211 times ]


Top
 Profile  
Reply with quote  
 Post subject: Re: Floppy Controller
PostPosted: Wed Apr 27, 2022 4:05 am 
Offline

Joined: Thu Mar 10, 2016 4:33 am
Posts: 181
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:
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Floppy Controller
PostPosted: Sat Apr 30, 2022 6:07 am 
Offline

Joined: Tue Jul 05, 2005 7:08 pm
Posts: 1043
Location: near Heidelberg, Germany
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é

_________________
Author of the GeckOS multitasking operating system, the usb65 stack, designer of the Micro-PET and many more 6502 content: http://6502.org/users/andre/


Top
 Profile  
Reply with quote  
 Post subject: Re: Floppy Controller
PostPosted: Sat Apr 30, 2022 6:41 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
Thanks André, once again, for your floppy notes - an excellent resource!


Top
 Profile  
Reply with quote  
 Post subject: Re: Floppy Controller
PostPosted: Sat Apr 30, 2022 7:25 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8514
Location: Midwestern USA
BigEd wrote:
Thanks André, once again, for your floppy notes - an excellent resource!

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

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC


Who is online

Users browsing this forum: barnacle, Google [Bot] and 69 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: