format 'commodore1581' is broken
Please see the attached file (sorry, a zip is not compressing the data enough, so I needed to use 7zip. And in order to be able to upload that to github, I needed to package the 7z inside a zip)
The file "td1581-optimized.flux" contains a flux image of the real test-/demo 1581 disk. Only flux normalisation has been done: Flux times are changed to their optimum theorectical value - making the image highly compressible.
td1581.d81 contains the well known content of that disk. That's the expected result.
fluxengine read commodore1581 -s td1581-optimized.flux -o foo.d81
yields many errors like:
0.0: 500 ms in 145284 bytes 60 records, 30 sectors; 1.66us clock (602kHz); 10 distinct sectors; Required sector 0 missing; logical track 0.1; 15360 bytes decoded. 0.1: 500 ms in 145323 bytes 60 records, 30 sectors; 1.66us clock (603kHz); 10 distinct sectors; Required sector 0 missing; logical track 0.0; 15360 bytes decoded.
and the resulting image is malformed.
Also fluxengine write commodore1581 -i td1581.d81 -d foo.scp creates an scp file with malformed sector headers - an original commodore 1581 disk does not contain sector 0, but the generated .scp does.