davidgiven / fluxengine

PSOC5 floppy disk imaging interface
MIT License
356 stars 68 forks source link

.flux format documentation #206

Open keithclark opened 3 years ago

keithclark commented 3 years ago

I'm trying to build a .flux viewer that runs in a web browser so I can see what my drive is capturing. So far I've worked out that .flux is a sqlite datastore and that it contains gzip'd data. Using the decompressed data, I've put together a really simple viewer that renders the captured track flux to a <canvas> scatter chart.

Screen Shot 2021-01-07 at 00 08 50

This is the flux capture of a 3.5" Atari ST floppy disk. The x axis is the buffer index of the sqlite data record and the y axis the the Uint8 value stored in the buffer (I said it was simple). The histogram at the top shows the frequency of data in the y axis.

I recognize the bottom three traces (around 134, 164 and 176) but I have no idea what the trace at 63 is for. Is that captured flux data or are there two sets of data encoded in to a byte? Also what to the byte values equate to (i.e. what is the Y scale)?

I guess what I'm after is some kind of documentation for the flux file.

davidgiven commented 3 years ago

The bytecode format uses a 5-bit time field with the top two bits of the byte indicating the event type. Intervals greater than 63 ticks don't fit in the time field, so they're represented as multiple 63 bytes indicating that nothing has happened, followed by the actual event byte. You can use fluxengine inspect to view the bytecode and pulsetrain. See https://github.com/davidgiven/fluxengine/blob/master/lib/decoders/fluxmapreader.cc#L33 for the decoder logic.

The file format uses sqlite essentially because it's cheap and easy, and allows arbitrary data to be added and removed from the file at any time, but it's always been in flux (ha ha) so I never got round to documenting it. I agree, it ought to happen.

I like the scatter chart --- very clear. It'd be good to have a fluxengine convert fluxtoimg subcommand...

Voldemar0 commented 1 year ago

Hi !

It seems to me, in the old firmware the images have extension ".sql3", now I see ".flux" more often. The format remains the same, has it not been changed in new versions of the software?

I build special computer for scan/read images from floppy disk. The main target: deep support the Agat format (a'la Apple ][ 140 kb and native 840 kb format, with support non standard drive control and various non standard track formats). But other images (non Agat system) I want convert in to some common format, ".flux" for example.

davidgiven commented 1 year ago

It hasn't been .sql3 for a while. The extension for changed to .flux but remaining a sqlite file, and then the format changed to a binary protobuf file (aka fl2 internally). Look at https://github.com/davidgiven/fluxengine/blob/master/lib/fl2.proto for the format.

BTW, there's now a native GUI with a flux viewer and some analysis tools.