stardot / b-em

An opensource BBC Micro emulator for Win32 and Linux
http://stardot.org.uk/forums/viewtopic.php?f=4&t=10823
GNU General Public License v2.0
117 stars 58 forks source link

b-em incorrectly detects a disc image as double-sided #105

Closed ZornsLemma closed 4 years ago

ZornsLemma commented 4 years ago

If I open the attached z.ssd in b-em (built from dac33a4cf0aa3c94d8dfbf7870a01fef74f6de8b) and then LOAD "BA1", I get a "Bad program" error. If you do "*CAT 2" you can see the disc title on side 2 is part of the BA1 program. This works fine on jsbeeb. I am guessing b-em is deciding this is a double-sided interleaved image, which isn't right here.

This seems a bit reminiscent of issue #63, of course. I initially thought this was a beebasm bug. The example is contrived but I experienced this repeatedly while working on some real code; at the time I didn't want to get sucked into debugging beebasm and kept doing voodoo workarounds which appeared to fix it.

I don't think it matters but for the record the attached zip file also contains the beebasm code to build z.ssd: beebasm -i basicasm.6502 -do z.ssd

bad-disc-type-detection.zip

SteveFosdick commented 4 years ago

Ok, I am investigating.

SteveFosdick commented 4 years ago

I have created a branch and pushed a commit that I believe fixes this: https://github.com/stardot/b-em/commit/f2b9357499e5f49deb8214a48e6c12cff4a8a41c

ZornsLemma commented 4 years ago

Thanks Steve! This certainly fixes the issue for my test case. I'll switch to using this build and see if it goes wrong again, though it looks like it shouldn't - beebasm will never generate a file >200k. (I must admit the code change gives me a headache, I'm going off your description of the commit. So thanks for dealing with this, I know it's an awkward area. If only we had a time machine...)

SteveFosdick commented 4 years ago

The current master detects this correctly as single-sided.