davidgiven / fluxengine

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

Trying to write IBM with tweaks for Commodore 1581 #185

Open hpingel opened 4 years ago

hpingel commented 4 years ago

Hi,

it's me, I'm back - the guy with the interest in Commodore 1581. ;-) I did some read tests last year, please compare https://github.com/davidgiven/fluxengine/issues/95.

But now I want to try to write: So I currently use the latest Cypress image and a self-compiled version of Fluxengine (current master branch) where I have tweaked the ibm-preset-720 to my needs. Basically the Commodore 1581 disks have 10 sectors per track (s=10) and have the sides inverted.

Because of the additional sector I seem to need to decrease the gap sizes because otherwise I exceed the allowed number of bytes per track (Error: track data overrun). I am completely unsure at the moment if I nee the IAM stuff or not and if I have to modify the IDAM / DAM bytes.

At the moment I can write a d81 image to disk and read it back again with Fluxengine. But the real 1581 doesn't want to read from that disk. I am wondering if the swapped sides could be an issue? It wasn't back then when I asked the same regarding reading a disk (https://github.com/davidgiven/fluxengine/issues/102).

My current settings for the 1581 are (gap values I don't provide at the moment because I'm constantly chaging them for testing purposes and it doesn't work anyway at the moment):

    setWriterDefaultInput(":c=80:h=2:s=10:b=512");
    trackLengthMs.setDefaultValue(200);
    sectorSize.setDefaultValue(512);
    emitIam.setDefaultValue(true);
    clockRateKhz.setDefaultValue(250);
    idamByte.setDefaultValue(0x5554);
    damByte.setDefaultValue(0x5545);
             ...
    sectorSkew.setDefaultValue("0123456789");
hpingel commented 3 years ago

I was just successful to read a disk image written by Fluxengine in my Commodore 1581 disk drive!!! Yeah!

I will create a pull request. :)

hpingel commented 3 years ago

Thank you for merging my PR regarding swapSides (https://github.com/davidgiven/fluxengine/pull/214#issue-556335808). I hope that the ordinary ibm presets still do work now as I have not added the param to the stock ibm presets (yet). Will test if it defaults to false.

I will create another PR with suggestions for a preset for Commodore 1581 (and maybe also CBM-FD2000). As things a still under development i can't promise the perfect gap values yet.

As far as I can see the gap1 value will not change anything as long as emitIAM is false? Could we reflect that in the gap name? gapIAM maybe? Just to point out that there is a connection?

My current WIP preset looks like this:

static ActionFlag presetCBM1581(
    { "--ibm-preset-cbm1581" },
    "Preset parameters to a 3.5\" 800kB disk.",
    [] {
        setWriterDefaultInput(":c=80:h=2:s=10:b=512");
        trackLengthMs.setDefaultValue(200);
        sectorSize.setDefaultValue(512);
        startSectorId.setDefaultValue(1);
        emitIam.setDefaultValue(false);
        clockRateKhz.setDefaultValue(250);
        idamByte.setDefaultValue(0x5554);
        damByte.setDefaultValue(0x5545);
        gap0.setDefaultValue(80);
        gap1.setDefaultValue(80); //as emitIam is false this value remains unused
        gap2.setDefaultValue(22);
        gap3.setDefaultValue(34);
        sectorSkew.setDefaultValue("0123456789");
        swapSides.setDefaultValue(true);
    });

The only thing that can still be optimized are the gap values I guess. The values above seem to work well with the Cypress firmware 14 (see #213 )

Also I want to thank @keithclark for his PR that was helpful for me to look at regarding gap values ( https://github.com/davidgiven/fluxengine/pull/203)

hpingel commented 3 years ago

And here is a possible draft for a preset for Commodore 1581 ( #218 ).

(And the CBM-FD2000 mentioned in #107 is not far away from that preset I guess. I can peek at the Atari settings once again.)