View Full Version : WD 179x floppy controller
tcdev
1st October 2008, 03:00 PM
I'm so sick of looking at graphics controllers I had to have a small break to work on something new(ish).
I've started re-writing the floppy controller for the TRS-80 from scratch. This time it should be a pin-compatible replacement - eventually - which may enable hooking up real TRS-80 floppy drives?
In the mean-time, I'll look at fast-tracking the development for more "modern" emulations and provide a parallel back-end that bolts onto the pin-compatible implementation that can be connected to flash or spi flash, SD card etc.
tcdev
3rd October 2008, 10:43 AM
The WD179X implementation is coming along nicely!
Right now I can simulate type I (head movement) and READ_SECTOR commands. Aside from FORCE_INTERRUPT and hooking up the IRQ/DRQ lines, that should be sufficient functionality to boot NEWDOS/80, based on my previous register-level WD179X implementation.
Being "pin-compatible", it requires serial clock and data streams - the upside being that it could be used to interface to a real TRS-80 floppy drive. That aside, the "drive+media" implementation is completely flexible and the only requirements are the "physical" pin interface and reasonable timing.
The emulation requires "raw" track images to function - just like a real WD179x - and I'm using the standard DMK disk format, minus the headers atm. This also means that this implementation will support READ/WRITE-TRACK commands! :cool:
When I next get a few hours to work on it, I should be able to try it in real hardware - more specifically the DE1 reading a NEWDOS/80 image from parallel FLASH.
Stay tuned for more updates!
tcdev
7th October 2008, 11:28 AM
I've implemented enough functionality to boot Model III NEWDOS/80 from a double-density 40-track raw disk image from parallel flash!
I'm now in the process of adding support for the remaining commands so that I can use multiple drives in the system. Right now I have coded support for multiple drives, but the track register gets confused when switching drives. I've just coded READ ADDRESS but I suspect seeking isn't working correctly?
Anyway, it's all pretty cool atm. Retro-fitting 1771 support on the Model I should be a breeze once I'm done.
tcdev
8th October 2008, 01:35 PM
I've managed to get multiple (2) drives working on the controller. In this case, both drives are emulated from the same flash device.
I'm somewhat confused about the raw track formats supported by the controller. A DMK disk image written in a TRS-80 emulator on the PC appears to violate the GAP2 specification in the WD179X datasheet. :confused:
In any case, the next step is to implement read multiple sector, write sector(s) and read/write track. That should then be full functionality implemented. Finally I need to go through the datasheet line-by-line and confirm my implementation is 100% accurate...
I'll also add 177X emulation mode for the TRS-80 Model I.
Oh, some eye-candy here (http://members.iinet.net.au/~msmcdoug/pace/platforms/de1/)!
Dirk
8th October 2008, 03:52 PM
Hi Mark,
could you please write down a small tutorial how to prepare the de1 Board
for loading floppy images ?
Do you know a webadress from such dmk images could be downloaded ?
I found a dis image, wrote it on to the flash of the de1 board starting at adress 0 but it doesn´t work.
Which status should have the 10 switches on the board.
Thanks in advance
Dirk
tcdev
8th October 2008, 11:45 PM
could you please write down a small tutorial how to prepare the de1 Board
for loading floppy images ?
Do you know a webadress from such dmk images could be downloaded ?
Which status should have the 10 switches on the board.
Hi Dirk,
Loading floppies from flash was only meant to be a temporary measure. Ultimately I want to be able to read disk images from SD card!
Atm the disk images must be a proprietary format, which I've called "RTF" (raw track format), which is a .DMK format with headers stripped out.
I'll prepare a short tutorial with the steps explaining how to do it soon. There are utilities in the SVN repository for creating RTF files from DMK.
For now, pls find attached a couple of disk images.
1. Erase flash
2. Write newdos80.rtf to $00000
3. Write games.rtf to $80000 (512KiB)
Switches 0-3 enable/disable drives 0-3. OFF/Down is ENABLED!
LEDS0-3 are drive select 0-3
Switches 4-5 show floppy debug on 7-segment LED.
LED9 is TRACK-00 indicator
LED7 is INDEX PULSE
Regards,
tcdev
9th October 2008, 07:24 AM
I've been tweaking the controller - or more correctly - the floppy emulation.
"Disabling" the drive (no floppy) now works correctly and attempting to boot from an empty Drive 0 now results in "Diskette?" rather than "Cass?"
I've added a "floppy interface" module which should ease support of different floppy media emulations. It handles enable/disable and drive select and stepping. The back end has two options - direct memory for random access "media" such as flash, SRAM etc, and a FIFO for streaming "media" such as reading off SD card etc. I've tested both back-end options with flash memory so far...
The current floppy implementation only handles DD formats (6272 bytes/track) but I've had thoughts on how to emulate SD automatically from the same DMK format.
Now to hook up some SRAM and get the track read/write commands working...
P.S. Other TRS-80 enhancements include double-width character support and KEY(1) is <BREAK>
Dirk
9th October 2008, 04:14 PM
Hi Mark,
it works ! Thank you very much.
regards
Dirk
tcdev
11th October 2008, 06:12 AM
I've added an SRAM drive which reads fine, in preparation for adding the write commands to the controller.
I added READ TRACK which appears to sort-of work - the data looks OK but not synchronised to the start of the track like I thought it would be. I'm using Super Utility v3.2 to read a track into memory, and comparing with the raw track data. Haven't had time to look any further into it.
UPDATE: Turns out it *does* appear to work after all! I was reading to an area of memory occupied/used by Super Utility.
After I get READ TRACK sorted out, I can work on WRITE TRACK. Once that's done, that just leaves the multiple sector options and it should be done!
tcdev
12th October 2008, 12:30 PM
Taking a step back to consider how I'm going to implement writes.
Obviously, if I'm going to support the connection of real drives, I need to implemented FM/MFM encoding within the 179X itself. I also need to work out how that's going to be adapted to emulated media such as flash or sram... although that's totally unnecessary and I might simply circumvent that until I get the write logic working OK...
Meanwhile, I have drives 1 & 2 reading from flash, and drives 3 & 4 reading from SRAM. Unfortunately, that won't work on a stock DE1 atm as I'm actually using an external SRAM module from Burched connected via GPIO_0. However, it's only for development purposes whilst I finish the controller...
I've changed the MicroLabs Hires Graphics support to the Model III version of the board, of whose technical details I'd been previously unaware (thanks to Tim Mann for reverse-engineering it sometime back). I did have the Model IV version implemented, which I'll obviously retain for my Model 4/4P emulation. Speaking of which, I'll probably hack something together on that soon so I can finally run my old hires software - including an unfinished version of Lode Runner written in spaghetti assembler that I wrote myself! Need to finish that one day... maybe port it to Miosys C perhaps...
As reported, READ TRACK appears to work perfectly - reading the exact amount of bytes from the DMK image. At least, Super Utility would suggest it's working fine! Not bad for adding only a few extra lines of VHDL to the existing implementation! :p
MiniMorph
13th October 2008, 09:37 PM
This is great progress indeed. I think the State of the art at the moment is the DE1 and DE2 ports of the Minimig however as they do support SD Cards.
Is it not tempting to port some of that over.
I know the Amiga has slightly weird disk drives but they cannot be that different.
As I have stated before I would love to help out with any firmware required. The firmware is needed for the high level interface and the reading an writing of SD card which is not well suited to HDL.
The actual computer should be pure hardware of course otherwise we will end up with something closer to mess.org !
All the best and keep up the good work.
Good to see the DE1 board put to work ;)
tcdev
14th October 2008, 11:34 AM
I think the State of the art at the moment is the DE1 and DE2 ports of the Minimig however as they do support SD Cards.
As I have stated before I would love to help out with any firmware required. The firmware is needed for the high level interface and the reading an writing of SD card which is not well suited to HDL.
Good to see the DE1 board put to work ;)
Chris is working on a HDL SD card interface atm. It will (most likely) require an embedded micro for the FAT routines - not sure at this stage which way to go. Might be something we could rip from Minimig? But he has to get the SD I/O going first...
I'm certainly intending on getting WD179x floppy disk emulation going with files on a FAT-formatted SD card. That's perfect not only for TRS-80 but also a few other micros as well, including the BBC Micro!
I's also like to have a dig at TRS-80 hard disk emulation as well!
As for firmware, it'll depend greatly which way we go. Appreciate the offer, and will let you know if there's anything - floppy disk related or not - that we could use a hand with!
And the DE1 is a nice little board - I like using it! Would be perfect if it had an EP2C35 (or 90!) but it's the best platform for prototyping most of the PACE projects as it has plenty of buttons, switches, LEDS, flash, SD and heaps of GPIO! :cool:
tcdev
15th October 2008, 11:45 AM
I've cobbled together write support for the WD179x - both track and sector writes. I can format "disks" and copy files to said disks in SRAM! :D
I say "cobbled" because I still haven't resolved the issue of synchronising reads and writes with arbitrary (emulated) media. Rather than attempt to de-serialise the data and add a clock to produce MFM format, I've added a "back door" parallel write data port and hand-tuned the write synchronisation for now.
It's not _too_ much of a fudge - the plan is still to support real floppy disk drives as well as all manner of emulated media - the latter being able to operate in "turbo" mode. Reading is easy as the incoming RCLK determines how fast data is read. For writing though, how does one specify the WCLK?
Anyway, functionally there's enough there now for normal disk operations. Some of the exception handling is incomplete, such as CRC generate, Lost Data, etc, but I'll add that as I tune the media interface.
Next plan is to get SD card access happening. I could probably whip up something reading from a standard DMK image in an hour or two, with a NIOS processor and software-based SD driver. But I'm not sure there's much point - I want to find a "nicer" solution than the NIOS...
vBulletin® v3.6.8, Copyright ©2000-2010, Jelsoft Enterprises Ltd.