davidgiven / fluxengine

PSOC5 floppy disk imaging interface
MIT License
357 stars 69 forks source link

Sector pulses are not encoded in .flux for hard-sectored formats #474

Open hharte opened 2 years ago

hharte commented 2 years ago

The encodedecode tests do not work for for hard-sectored formats. This is because the sector pulses are not encoded into the .flux stream by the encoders. When writing a physical floppy disk, these sector pulses are not needed, as FluxEngine syncs to the index pulse, and writes an entire track at a time, ignoring the sector pulses.

When running encodedecode tests, writing to a physical floppy is bypassed, and the encoded data is written to a .flux file. Since the encoders do not include the sector pulses, they are not written into the .flux stream, and then reading back the generated .flux only detects the first sector (because of the index pulse) and misses the remaining sectors.

Aside from fixing encodedecode tests by adding sector pulses to the .flux stream, these pulses could be used by the FluxEngine firmware to time each sector write to the physical sector pulses if desired.

davidgiven commented 2 years ago

I have some changes to add emitting index pulses to the output stream for the Northstar encoder. It's not working yet, but I'm curious to know how this ever worked without them --- does it just use timing to get the sectors in the right place? I notice that the generated bytecode for each track is precisely 200ms, which is unusual.

davidgiven commented 2 years ago

I have it working now:

https://github.com/davidgiven/fluxengine/tree/hardsectors

If you still have the Northstar hardware set up, is there any chance you could give it a try and let me know if it still works? I don't have any hard sectored disks. I had to make some changes to the encoder, including removing the postamble bytes, and there's a reasonable chance I broke something.

hharte commented 2 years ago

Hello David,

Thank you, I'll check it out this weekend!

You are correct about how the encoder "worked" previously. It starts wrting at the Index pulse, and made sure the sectors are exactly 20ms each. The entire track was written based on the index pulse.

If you email me your postal address, I can send some Northstar 10-sector Hard sector disks to you. The Micropolis 16-sector disks are a little more problematic, as the drives are 100TPI. I suppose you could write your own disks in a 96TPI drive, and read them back, but reading the disks written with a Micropolis drive will be a no-go.

-Howard