Arduino Floppy Dump project
v0.01b, 2020-08-07

Copyright (C) 2019-2020 Denis Dratov (@Dexus) volutar at mail.ru

This hobby project is derived from Rob Smith's "Arduino amiga floppy disk reader/writer"
Initial cudos to him!

For reference: http://amiga.robsmithdev.co.uk/

Arduino pinout is ALMOST the same, except
1. There's _no_ _writing_ abilities, so pins a0-a2 and pin3 are not used
2. The lines RD_DATA and TRK00 are swapped: pin8 is Read Data, pin4 is Track0

Since it's super early alpha, it can do almost nothing (from what's supposed to):

What supposed to be done:
- Floating speed adjustment (using statistic data)
- Pre-index data restore, so no edge case CRC errors when tail or head of sectors are dropped
- Error processing (now it totally ignores everything, though printing (!) in catalog)
- Error fallback modes (quick -> adjusted with stats)
- Exporting multiple different floppy image formats
- RAW data extraction for bad sectors, and recover of de-magnetized "drifted" data
- Console mode for manual track investigation and probably recovery
- Importing of multiple floppy image formats (so it would be used as a converter)

What's done and can't be used, yet:
- Raw data dump (short chunks - only 1920 flux turns, since atmega 328p has only 2kb of ram)

What is done:
- Arduino Atmega328p 16mhz capturing sketch firmware with number of optimized asm fragments.
- Precise counter (125ns resolution) (Actually 62.5ns, but it's excessive and doesn't fit well)
- MFM threshold values are consts and stuck with DD floppies
- Python3 based script, using pySerial lib (google it)
- Export of UDI image (raw-level, byte-adjusted floppy image format, used for ZX-Speccy emulators)
- Arduino COM port autodetection
- Statistics gather
- Density adjustment, and each track re-adjustment
- HD density is captured without errors (2us for shortest flux) - which is already improvement


========================

sketch/afd100.ino - Arduino sketch (use it in Arduino SDK)
afd_udi.py - main script
demfm.py - MFM parsing lib
readme.txt - this file

Enjoy.

==========History========
	2020-08-07 0.01b
Added removing trailing empty tracks after track80 for saved images (if they were accidentially captured)
Added statistics gathering, density adjustment (DD/HD) and dynamic MFM threshold values
	Statistics gathering side-effect - speed dropped twice
Prints statistics for each track (temporary for EVERY track)
	Yes, the speed is dropped for _each_ track (supposed to work only for the first and for bad tracks)
Logs everything into dump.log
	Just in case if you missed fancy stats
If no output filename prompted - asks for it after disk capture
Firmware is updated to 1.0a, allows for threshold up to 192

	2020-08-05 0.01a
Initial release
