Closed shattered closed 6 years ago
Your work-around avoids the crash, but the zero size generates the 'z' flag in the scan output, which means a DAM was found but no sector data is stored. That's considered an unusual condition so it's shown in yellow. It may be better to skip the data match as though no DAM was found. Though, since the odd tracks aren't really going to be used then anything is better than a crash!
The underlying issue is related to the scan combining the headers for all revolutions into a single track view. I think there might have been a problem if a header wasn't seen on the first revolution, or its bitstream position changed too much, and that is more likely to happen on the fringes of odd-numbered 48tpi tracks when read in a 96tpi drive.
I've seen this happen too, and started modifying BitstreamDecoder.cpp to fix it. That's what the conditional code comment ("disabled until header/data matching enhancements are complete") refers to. Hopefully I still have the stashed code changes and a sample disk to reproduce it.
I ran into this again today, and found that the distance calculation was wrong when calculating the forward distance back to the same field. 14c0d22892f8a29c4785e9e6dac415d253320b80 should resolve it.
I made the same change to the Agat code, so you might want to check it's still working as expected for your needs. It should now give a 'nd' (no-data) indicator instead of the 'z' (zero-bytes) in your example above.
Agat code works fine - thanks.
I'm using a 96tpi drive to read disks written on a 48tpi drive - occasionally, data from adjacent even track are picked up on odd track and this confuses scan_bitstream_mfm_fm() -- for whatever reason, next_idam_distance / next_dam_distance is computed as zero, and then next_idam_align / next_dam_bytes become negative... Boom, allocation failure of -1 bytes :)
My workaround is
And offending track looks like this after it's applied: