Decode the sectors of a floppy disk from a digital oscilloscope trace of the floppy drive data line
Haskell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
Decode.hs
LICENSE
README.md
floppy.csv
floppy2.csv

README.md

floppy-decode

What is this?

This is a tool to, given a waveform from an oscilloscope connected to the data line of a floppy drive, extract the data from the signal.

Specifically, given a CSV file generated by my Rigol 1052, break it apart. Given I'm mostly trying to understand how the data is encoded, this is a specialised, hacked-up tool to process the specific samples I've collected, rather than a proper robust tool. Do not expect it to work on a random waveform you provide without tweaking. There are semi-arbitrary constants embedded in the source, and I'm specifically trying to extract the boot sector from a 1.44MB 3.5" floppy.

Where did I get my disk format spec from?

I used a combination of this book and this page. MFM is a really neat idea.

Does it work?

I've extracted a boot sector that looks good to me!

It's not terribly clever, so if there's a pulse with ambiguous timing it might get out of sync, and stay out of sync, and produce bad data. :(

What are these input files?

They're CSVs from my Rigol 1052, sampling from a floppy disk drive. They used the "deep memory" facility of the scope. floppy.csv is using a high sample rate, and only covers about half a sector of data. floppy2.csv uses a lower rate (the '5ms' setting on the scope, I think) and captures about 8 sectors. The trigger is in the middle of the sample, so we capture sectors 15, 16, 17, 18, 1, 2, 3, 4! (Which nicely demonstrates that it's formatted with 18 sectors per track, and sectors are not interleaved.)

Haskell, really?

It's my favourite language for playing with things like this. I should probably have used a parser combinator.

Anything else...

Feel free to contact me for questions or comments. Cheers.