6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Sep 19, 2024 11:51 pm

All times are UTC




Post new topic Reply to topic  [ 49 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
PostPosted: Fri Mar 01, 2019 9:49 pm 
Offline
User avatar

Joined: Sun Oct 13, 2013 2:58 pm
Posts: 491
Location: Switzerland
Just stepped over this topic. I'm currently in the process of playing with floppy drives and accessing diskettes using a AVR MCU without FDC. And that worked pretty well. For further enjoyment I also did explore the possibility to leverage the MCU with an encoder decoder. I have a working solution which provides a byte interface to the MCU and of course the same would be true for a 6502 based processor. Although here it would make sense to change the bus interface of the CPLD to match the signals of the 6502. So I have now two solutions a software only solution where the floppy drive is directly connected to a AVR MCU (in my case an Atmega1284P running at 16MHz) and a CPLD which encodes/decodes MFM. With the same logic it should be possible to put RLL end EFM encodeing and decoding into the CPLD, although you might have to switch to a larger CPLD (the ATF1508 in this case). Note that MFM works well with Floppy drives but already RLL will be a challenge and will work only with the more recent 3 1/2 inch drives that have a stable motor speed control. RLL and EFM demand less jitter to work reliably. RLL 2,7 is probably the longest encoding scheme that will potentially work, which would give 50% more capacity than MFM.


Attachment:
File comment: WinCUPL Design file of the CPLD
MFMReader.txt [10.05 KiB]
Downloaded 120 times


Note the CPLD is work in progress. I can read tracks (or sectors depending on the software) and write sectors. You should also be able to format a drive using the MFM encoder but I have not investigated the options.

Edit March 3rd 2019:

Here is an improved version of the CPLD design file. A much simpler MFM encoder is included and it should be easier now to adopt the MCU interface to a 6502 interface.

Attachment:
File comment: Improved version of FDC CPLD
MFMReader-v1-0.txt [12.15 KiB]
Downloaded 134 times



Peter


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 06, 2019 10:41 pm 
Offline

Joined: Sun Oct 14, 2012 7:30 pm
Posts: 107
I have been down this road many times since the mid-80's. About 5 years ago I modernized my TTL experiences and created a commercial product called SuperCard Pro which is flux level reader/writer. With it and a disk drive (3", 3.5", 5.25", or 8") or two you can make exact flux level images and copies of disks... down to the sub-microsecond level. I use a 40MIPs PIC microcontroller and 512K of static RAM to capture the bitcells at 25ns resolution. There are many different computer emulations and utilities that support the SuperCard Pro (.scp) image file format and/or control the hardware directly. I have an open API so you can add support for the image format or control the hardware with any application you might want to write, and I am certainly willing to help you do that. There is a ton of C code already available being used with Windows and Linux.

I worked at Central Point Software on a little project they called "The Option Board". I also released commercial flux copiers for the Amiga. For decoding, I know GCR pretty well (long history of copy programs for the Commodore 64), and I know Mac stuff well too (EMPLANT). Ironically, to me making actual file system handlers is far more work than converting flux level to upper (FM/MFM/GCR) level.

If you have any questions about disk drives and flux data, or encoding/decoding I would be happy to answer them.


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 07, 2019 8:14 pm 
Offline
User avatar

Joined: Sun Oct 13, 2013 2:58 pm
Posts: 491
Location: Switzerland
Thanks for the offer. Any information about the format a RQDX3 (PDP-11 Q-Bus MFM controller) uses would be much appreciated. I'm not digging as deep as you did with the flux level. All I need is the format of the address records and data records including the gap sizes, sync marks, preambles and CRC / ECC used. I'm quite familiar with the FM/MFM/GCR level, this works pretty well. For floppies even with a software only solution on the AVR MCU. My problem is the opposite of your solution. I want to emulate a disk and not read one. So I don't have to struggle with loss of data or bad signals. I'm pretty impressed that all you needed was a PIC.


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 07, 2019 10:07 pm 
Offline

Joined: Sun Oct 14, 2012 7:30 pm
Posts: 107
I did a quick Google search and there is a ton of info on the RQDX3 controllers. Such as http://avitech.com.au/?page_id=645

The SuperCard Pro has a bidirectional bus, so it can also emulate a floppy drive, MFM hard drive, etc. I have not added this support yet in the firmware, but the bus support is already there. I am tinkering with it right now.


Top
 Profile  
Reply with quote  
PostPosted: Tue May 05, 2020 9:24 am 
Offline

Joined: Mon May 21, 2018 8:09 pm
Posts: 1462
So, I randomly came back to the subject of EFM encoding and decoding. I've now concluded that this is noticeably easier to do in hardware than in software, as long as you take the correct approach - though finding that approach might be less than obvious. In particular a hardware decoder eliminates the need to run a table lookup algorithm in realtime for every flux transition, and thus brings the speed requirements of the hardware down by about an order of magnitude.

As part of figuring this out, I went back to the original EFM patent of 1985, long since expired. The patent includes a sum-of-products decoding table that, supposedly, can be burned into a large PAL device to convert the 14-bit EFM words into bytes. So I laboriously copied that table into a software routine to check it - and it simply did not work. Not even close. Generating the 257 14-bit words which meet the pulse width invariants, many of them were mapped to the same byte as another, and the mapping looked nothing like the codeword table I was able to read from elsewhere.

So instead I had to go to the ECMA CD-ROM specs, pull the EFM bit patterns out of that, and generate a raw truth table to dump into a proper logic minimiser. This included generating truth-table rows for all the invalid EFM codepoints with don't-care outputs, because the minimiser I picked first generates implicit rows that map unspecified input combinations to all-zero outputs. Bravo, Logic Friday, you suck. But the output thus generated suggests that I can implement an encoder and decoder in about two 22V10s each. That's not bad at all. Obviously, I could do it with a ROM instead, but now I have options.

One of the potentially more challenging aspects of this idea is maintaining lock on the signal as the drive motor speed changes. Every flux transition has to be matched to the correct bit position in the EFM word before decoding, and the words themselves need to stay in sync with the bitstream. The TEAC 3.5" drive has a specification of ±1.5% motor speed, so in extremis the read signal could differ in speed from that written by 3.0%. If I sample at 12MHz (which is 8x oversampling), the longest valid gap between transitions is 88 clocks, which means I can catch up with a 1.0% frequency offset by shifting just one cycle in either direction per transition, even on a continuous sequence of maximum width pulses. It should be straightforward enough to design sampling hardware to do that on a binary decision based on whether the transition is captured before or after the midpoint of the cycle, perhaps with a hysteresis so that a reversal of the sense first stops the movement instead of instantly reversing. But larger adjustments than a single step are needed to accommodate the maximum frequency offset, so a kind of digital PLL will be needed. The actual register into which the transition is captured would only be clocked at 1.5MHz, and the decoding logic after the shift register would be much slower than that.

Speaking of "slower", if we switch in a further 64-fold clock speed reduction, we end up with a flux reversal signal in the audio range, which could sensibly be captured on cassette tape. The minimum pulse width would then be 128ms, corresponding to an intended frequency band of 0.23 to 4 kHz - and a stored data rate of over 1KB/sec, double that of most C64 fastloaders and immensely faster than the more typical 1980s FSK-based techniques. It remains to be seen, perhaps, whether a tape can actually be made to work reliably at that rate, but I think it's worth trying - especially since a good deal of the most complex hardware can be shared between a floppy and a tape driver.

And then what about recording in stereo? And automatic control not only of the cassette motor start/stop, but fast-seek and head load/unload? Some hi-fi tape decks do have those extra features…


Top
 Profile  
Reply with quote  
PostPosted: Tue May 05, 2020 2:34 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1948
Location: Sacramento, CA, USA
Brilliant work, sir! If you have any spare time, can you help me come up with an affordable plan to get my 1962 Ranchero to go 150 mph? :shock:

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Top
 Profile  
Reply with quote  
PostPosted: Tue May 05, 2020 3:34 pm 
Offline

Joined: Mon May 21, 2018 8:09 pm
Posts: 1462
Well, you could drop it off a cliff…


Top
 Profile  
Reply with quote  
PostPosted: Tue May 05, 2020 11:51 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1948
Location: Sacramento, CA, USA
My wife already thought of that, but she had the benefit of seeing it hiding under a tarp in our backyard for 20 years, so your insight is not only practical, but also astonishingly responsive! Well within my budget too, as long as I don't get caught in the act ...

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Last edited by barrym95838 on Wed May 06, 2020 12:24 am, edited 2 times in total.

Top
 Profile  
Reply with quote  
PostPosted: Wed May 06, 2020 12:06 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8387
Location: Midwestern USA
barrym95838 wrote:
Brilliant work, sir! If you have any spare time, can you help me come up with an affordable plan to get my 1962 Ranchero to go 150 mph? :shock:

Explosives. :D

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


Top
 Profile  
Reply with quote  
PostPosted: Wed May 06, 2020 2:00 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
barrym95838 wrote:
My wife already thought of that
"Necessity is the mother of demolition," eh? :)

BigDumbDinosaur wrote:
Explosives. :D

Or, do this.
:)

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Wed May 06, 2020 3:36 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8387
Location: Midwestern USA
Dr Jefyll wrote:
BigDumbDinosaur wrote:
Explosives. :D

Or, do this.
:)

How convenient was it that submarine surfaced in just the right place? :lol:

BTW, I witnessed catapult testing when my ship was in the shipyard for a refit. It's done with a wheeled contraption that has flotation devices on it and weighs about 50,000 pounds. I was amazed to see how far a catapult could hurl it.

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


Top
 Profile  
Reply with quote  
PostPosted: Sun May 10, 2020 8:34 pm 
Offline

Joined: Mon May 21, 2018 8:09 pm
Posts: 1462
I've been on a major trawl for information about the signal characteristics of audio cassette tapes and their players. There's still a few being made, so obtaining one to modify for experimental purposes is not out of the question.

This revealed, among other things, a fundamental difference between a cassette player intended for audio use (as was often connected to a BBC Micro or ZX Spectrum), and one specifically customised for data storage (as was supplied for use with a C64). In essence, you can get a much crisper square wave signal and much simpler recording electronics if you forego all the subtlety of getting a good-quality audio signal - and working with EFM signals is likely to be more sensitive to edge timing than the average CUTS-like format.

But the C64 Datasette electronics also seem a bit inadequate to the task, as they're only designed to reliably reproduce falling edges of a signal - they're evidently also designed around a 1980s quad op-amp, long obsolete and with very underwhelming intrinsic performance. I simulated it in LTspice, after some tribulations, and discovered that it was so fragile that, at low enough input levels, the output Schmitt trigger could end up responding to the rebound from the read pulse, rather than the pulse itself, and this resulted in the square wave output having the opposite polarity to that intended!

The process of tape recording followed by playback results in a differentiated version of the recorded signal showing up at the read head. It's easy enough to lay down a square wave by just driving the record head with logic voltage through a suitable matching impedance; what is then read back is, however, a train of pulses at the edges. To turn that back into a square wave requires an integrating pre-amplifier, which the Datasette doesn't have; instead they have apparently just grafted a Schmitt trigger stage onto the end of an audio amplifier chain. Implementing the correct approach around a modern quad op-amp seems to produce more reliable results - at least in simulation - with sufficient timing accuracy to recover the EFM signal I have in mind. There are likely to be confounding factors I haven't encountered yet, but until I have real hardware to play with, I'm adequately satisfied.

It'd be great to rig up the tape transport so that it can autonomously engage and retract the heads, and seek forward and backward, under computer control. It's something that 1980s micros didn't have, but which was quite normal on bigger computers. But since tape transports have a lot of dependence on mechanical components and the hi-fi units with "logic controlled" transports are still fetching relatively high prices on the second-hand market, that's an idea which might have to wait. Still, one option would be to remove the latch from the "piano keys" assembly and drive the latter with servos.

On the digital side, I've also been sketching out ideas for how to build the clock recovery and sampling logic needed to work with EFM. Importantly, I think I can use the same logic for both floppy and tape, just with a different input pre-conditioning stage for each, and an extra 64-stage clock divider before the tape side. I may also leave in a way to sample the raw transition intervals, as in the original design idea, and just not plan for that to be the primary method of interfacing.

I've been looking into FEC as well, as encountering errors on magnetic media will eventually be inevitable. That'll be software, not hardware, and I expect that recovering from an error will be a relatively slow (but infrequent) operation. Hamming codes look easy, but not very powerful. Convolution codes are powerful and relatively easy to understand, but very costly in overhead and need to be decoded even when there aren't any errors to correct. Reed-Solomon is much more powerful, but wading through the maths involved is giving me a headache. The tutorial I'm reading now is a NASA document…


Top
 Profile  
Reply with quote  
PostPosted: Sun May 10, 2020 8:46 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1466
Location: Scotland
Chromatix wrote:
It'd be great to rig up the tape transport so that it can autonomously engage and retract the heads, and seek forward and backward, under computer control. It's something that 1980s micros didn't have, but which was quite normal on bigger computers.


The very first computer I ever used in 1977 had a built in (compact cassette) tape drive that could forward/reverse under software control. It wasn't quite a "micro" but it was a desktop computer which ran BASIC - HP9830A.

-Gordon

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


Top
 Profile  
Reply with quote  
PostPosted: Sun May 10, 2020 9:20 pm 
Offline

Joined: Mon May 21, 2018 8:09 pm
Posts: 1462
That's definitely a cut above normal functionality for a home micro. But that machine looks like it was meant for serious professional use, in an era when mainframe or minicomputer time was still considered "expensive". I'm sure it had a price tag to match.

The EFM signal for tape storage will end up fitting neatly in the 1kHz to 4kHz band, with approximately 12kHz of timing accuracy required. Another thing I now need to investigate is the DC balance of the signal, as keeping that under control has implications for the noise margin of the read amplifier chain. EFM specifies the use of "merging bits" between the 14-bit encoded words; two merging bits are enough to merely maintain the invariant of at least two and at most ten zeroes between transitions, but the CD format uses three merging bits to give more flexibility in maintaining the DC balance between pits and lands. The minimum-performance algorithm specified for CD merging bits is fairly complex.

The merging bits are basically ignored on read, but need to be generated between pairs of codewords on write. There are cases when the merging bits must both be zeroes (ie. when the adjacent leading and trailing zeroes, plus the number of merging bits, total less than five), and also cases when one of the merging bits must be set (ie. when the aforementioned sum is at least ten - to prevent accidentally encoding a sync pattern). The position of the set merging bit may also be constrained by a nearby transition in a codeword, including cases when it is mandatory. But there are also cases when there's a choice as to whether and where to set a transition within the merging bits, and that choice should be made with the DC balance in mind.

So I'm adding routines to investigate this phenomenon and how much effort I need to put into generating the merging bits. If it's simple enough, I may be able to add the necessary logic to the two GALs already tasked with generating the codewords. And if I think I can get away with only two merging bits, that means a few percent more storage density.


Top
 Profile  
Reply with quote  
PostPosted: Mon May 11, 2020 2:40 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8509
Location: Southern California
I worked at TEAC on semi-professional tape recorders in the early 1980's, and a few years later designed a modem and record & play electronics for a product that used a $6 cassette transport that was computer-controlled (ie, with solenoids and cams and so on, as opposed to manual push buttons), and put voice audio on the left channel and digital data on the right. There was an optocoupler on one of the reel tables so the computer could count turns and fast-forward or rewind to a point just ahead of any desired place, then go into play to read the digital track to find the exact location. Please see my post at viewtopic.php?p=49477#p49477 and the ones around it.

I show, with a picture, brief description, and video demo, my very intelligent HPIL-interfaced Hewlett-Packard HP82161A high-speed microcassette drive which used a FAT, at viewtopic.php?p=77040#p77040 . Each tape holds dozens of files (or potentially up to 447 files) for my HP-41cx and HP-71B hand-held computers. Watching it work is like watching a very miniaturized version of the large digital tape drives of mainframe computers of 50 years ago, where the reels spin too fast to see, and stop on a dime, and repeat.

For manufacturers that made their own proprietary cassette machines (like Commodore with its Datassette) though, I always wondered why they didn't run the tape faster so they could get faster data rates. If it doesn't need to be compatible with standard cassette machines that run at 1-7/8 IPS, you might as well run it 2, 4, or even 8 times the normal speed, and get anywhere up to 9600bps data rate.

These topics will be of interest too:
Cassette Interface Circuit for Homebrew Computer and
Tape modems

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 49 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 9 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: