keirf / greaseweazle

Tools for accessing a floppy drive at the raw flux level
The Unlicense
897 stars 91 forks source link

Add ZX Spectrum Opus Discovery disk config #330

Open gnulnulf opened 1 year ago

gnulnulf commented 1 year ago

The img file is normally called "OPD". The single sided drive: 40T/18S(0-17)/256ss -> 180k The double sided drive: 80T/18S(0-17)/256ss -> 720k I'm not sure if I got the gaps right.

Main difference from other formats is the usage of sector 0. My addition to the diskdefs.cfg config is:

disk zx.opus.ss
    cyls = 40
    heads = 1
    tracks * ibm.mfm 
        rate = 250
        secs = 18
        bps = 256
        id = 0
        gap2 = 22
        gap3 = 24
        gap4a = 32
        interleave = 7
        iam = no
    end
end

disk zx.opus.dd
    cyls = 80
    heads = 2
    tracks * ibm.mfm 
        rate = 250
        secs = 18
        bps = 256
        id = 0
        gap2 = 22
        gap3 = 24
        gap4a = 32
        interleave = 7
        iam = no
    end
end
keirf commented 11 months ago

Names maybe would be better as zx.opus.sd and zx.opus.dd? Or do you really need opus1 rather than opus?

gnulnulf commented 11 months ago

I know there is Opus1 and Opus2 hardware, we can expect it to work alike. zx.opus.sd and zx.opus.dd sound great.

mitchelln commented 5 months ago

Hi. Does this work yet please, or does it need code changes to be implemented? Thanks.

gnulnulf commented 5 months ago

You only need the profile in your diskdefs.cfg

mitchelln commented 5 months ago

Thanks. That's sorted it. I tried to add an opd.py file as well, but it didn't pick that up.

gnulnulf commented 5 months ago

@mitchelln , it now works for you? I think the diskdefs on linux is src/greaseweazle/data/diskdefs.cfg

I editted the initial comment to be more readable.

Michielhimself commented 2 months ago

How do I use this without an opd.py file? gw.exe complains that it doesn't recognise the OPD input file I am trying to write to a physical disk. I added the config entries to diskdefs.cfg and the -h option reports zx.opus.ss and zx.opus.dd among the supported formats now.

keirf commented 2 months ago

Rename .opd file to .img and try again.

Michielhimself commented 2 months ago

That worked and using the single sided format, delivers something on to disk that gives a readable directory entry on Opus but it doesn't lead to a loadable program (Wrong File Type error). Are the gaps certain to be correct for a stock Opus with a single-sided single density drive? When I copy the OPD file content from my GoTek secondary drive to my stock primary drive to the same physical disk in Opus itself, it does work.

keirf commented 2 months ago

Gaps don't really need to be specified. Try removing them all from your diskdefs.

keirf commented 2 months ago

Also interleave should be 13 and cskew should be 13 also. So be sure to fix interleave and specify cskew. And then see how you get on.

keirf commented 2 months ago

If that doesn't work, only then additionally try gap3=12

Michielhimself commented 2 months ago

If that doesn't work, only then additionally try gap3=12

still no, including with interleave = 13 and cskew =13. The Disk index "CAT 1's" on Opus / ZX Spectrum, but no files load. "m Wrong file type, 0:1"

Michielhimself commented 2 months ago

I know there is Opus1 and Opus2 hardware, we can expect it to work alike. zx.opus.sd and zx.opus.dd sound great.

Opus 2 is simply an Opus Discovery 1 with the 2nd drive slot populated. The drives are sometimes identical, sometimes a stock sssd (180k) drive in slot 1 and sssd (180k) or dsdd (720k) in slot 2 (requires different ROM to support), or other permutations (GoTek in slot 1 or 2) depending on modder preference.

keirf commented 2 months ago

I don't know then I'm afraid. I assume the OPD is known good? It sounds more like a filesystem error than a sector/track level issue.

Michielhimself commented 2 months ago

Yeah, all the OPD I'm using are the original 180K format and mount + load fine in an actual Opus via the GoTek, including copying them to physical disk (in the ZX Spectrum / Opus) and then running from the physical disk. Only factor I haven't been able to exclude yet is the floppy drive I'm using for the Greaseweazle based imaging. It runs pretty much error-free on the greaseweazle but that's still a drive verifying it's own sectors - if it's out of whack a bit it's not going to produce something the Opus can read. I have another way of writing OPD to physical media, using a Spectrum HW accurate emulator on older PC hardware, but really wanted to have the Greaseweazle option working to not have to rely on older hardware anymore, so I'll look around for another 3.5" drive to use here in my cave-o-parts and see if that changes things.

Many thanks for the help with the attempts so far!

gnulnulf commented 2 months ago

The reason I played with the gaps was to keep it within the maximum tracksize. full track = 6250 index ->gap4->trackheader-> gap1 -> ( sectorheader -> gap2 -> sector data -> gap3 ) * 18 ->gap4b

Are you using a 40 track drive or a 80 track with double steps? You can try to create a scp and look at it with hxc-> track analyzer.

I used this to write: gw.exe write --drive=1 --tracks=step=1:c=0-39:h=0 "D:\zxspectrum\d6.img" --format=opus1.ss --diskdefs=diskdefs.cfg

If you like I can try to reproduce it on my side.

keirf commented 2 months ago

Greaseweazle will automatically mess with all gaps (except gap2) to fit sectors in. Of course if you do know the correct gap values from a real disk, that is best of all.

Michielhimself commented 2 months ago

Trying to use an 80-track drive. Should I use step = 1? I guess that's not handled automagically. The 40-track I have has been modded (I keep as a spare for when the one in Opus dies) so doesn't take signal or voltage using standard cabling from the Greaseweazle.

Michielhimself commented 2 months ago

Success!! Using --tracks=step=2 (using an 80-track HD drive) and Keirf's suggested settings in diskdefs.cfg has delivered me a disk that loads in Opus Discovery 1 physical hardware and a Toastrack 128K ZX Spectrum+ !! (With some retries on track 29, my DSDD disks are OLD :-) ) I'll now give a try removing the gap3=12 from the config.

Command: .\gw.exe write --tracks=step=2:c=0-39:h=0 .\GreatEscape.IMG --format=zx.opus.ss

Config file in use (relevant section): `disk zx.opus.ss cyls = 40 heads = 1 tracks * ibm.mfm rate = 250 secs = 18 bps = 256 gap3 = 12 id = 0 cskew = 13 interleave = 13 iam = no end end

disk zx.opus.dd cyls = 80 heads = 2 tracks * ibm.mfm rate = 250 secs = 18 bps = 256 gap3 = 12 id = 0 cskew = 13 interleave = 13 iam = no end end`

Michielhimself commented 2 months ago

Using same command options and the settings from gnulnulf's original post at the top of this thread in diskdefs.cfg, and using a different OPD image, I made another succesfully readable opus phsyical disk (used blank media to start, so not an accidental residue from an earlier attempt).

Michielhimself commented 2 months ago

Update: one one of the disks I imaged with gnulnulf's settngs, some games loaded and others (higher numbered tracks) did not. I now imaged it again using the settings recommended by Keirf without the gap3=12 and that rewritten disk (from same image) now works fine for all programs on the image.

`disk zx.opus.ss cyls = 40 heads = 1 tracks * ibm.mfm rate = 250 secs = 18 bps = 256 id = 0 cskew = 13 interleave = 13 iam = no end end

disk zx.opus.dd cyls = 80 heads = 2 tracks * ibm.mfm rate = 250 secs = 18 bps = 256 id = 0 cskew = 13 interleave = 13 iam = no end end `