davidgiven / fluxengine

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

Writing d64 with Greaseweazle #414

Open raneri opened 2 years ago

raneri commented 2 years ago

Hi, I'm trying to write some .d64 files for the Commodore 64 with my Greaseweazleand and a 5.25" drive TEAC FD-55GFR:

fluxengine.exe write commodore1541 -i mydisk.d64 -d drive:1

reading D64 image
39 cylinders, 1 heads
Using GreaseWeazle GW135194F84205400002209705 on COM5
Measuring rotational speed... 166ms
Writing to: drive 1
  0.0: Write:   199 ms in 50555 bytes
       Verify:  328 ms in 83047 bytes
       Rewrite: 199 ms in 50555 bytes
       Verify:  328 ms in 83072 bytes
       Rewrite: 199 ms in 50555 bytes
       Verify:  328 ms in 82903 bytes
       Rewrite: 199 ms in 50555 bytes
       Verify:  328 ms in 83000 bytes
       Rewrite: 199 ms in 50555 bytes
       Verify:  328 ms in 83015 bytes
       Rewrite: 199 ms in 50555 bytes
       Verify:  328 ms in 82981 bytes
Error: Write failed; uncorrectable error during write.

I noticed that if I give a rpm command, I get a different (correct?) speed:

Using GreaseWeazle GW135194F84205400002209705 on COM5 Rotational period is 200.137 ms (299.795 rpm)

raneri commented 2 years ago

Finally, I solved it adding this parameter: --flux_sink.rescale=0.8

Now I can create 1541 disks from .d64 files; then I can re-read them to a create a new .d64 file that works on Vice. Unfortunately, I tried a couple of these disks on a real 1541 drive but they don't work.

hpingel commented 2 years ago

I had to change jumper settings on my TEAC to force the right rotational speed. In have a ticket here somewhere explaining this.

raneri commented 2 years ago

Hi @hpingel thank you very much. I tried to activate the "I" jumper, now, the rpm has lowered from 360 (166ms) to 300 rpm (200ms), but the result is still the same: I write a floppy, then I re-read it and the created .d64 file has the same checksum of the original but is unreadable from my 1541 drive.

Another strange thing is that the reported speed from fluxengine is 200ms with the "write" command and still 166ms in read mode.

davidgiven commented 2 years ago

Currently the 1541 profile assumes you're using a 200ms period drive. This explains why you needed the --flux_sink.recale parameter to make the data fit on a 166ms period drive. You can see from the write logs:

Measuring rotational speed... 166ms
Writing to: drive 1
  0.0: Write:   199 ms in 50555 bytes

It's measured the rotational speed at 166ms, but it's trying to write (slightly less than) 200ms, which of course overwrites part of the data.

It sounds like you're managing to write disks correctly with the drive set to 200ms, but the fact that they're not readable on a real 1541 is interesting. I don't actually have a C64 so I can't verify correctness myself but (IIRC?) I had reports that it works. Could you attach the full write log, please? There's a trick used to write 40-track disks on a 80-track drive which might not be working correctly here.

raneri commented 2 years ago

Hi, finally... it works. The latest attempts were simply unfortunate (I tried a couple of images with some sort of problems, and in addiction of this, I suspect that my 1541 has some intermittent problems because it sometime fails to load anything. Maybe it's overheating). I can confirm that, despite a wide range of difficulties, I succeeded in loading two games and even a copy of CPM for Commodore 128 on a d64 image :)

tdaede commented 2 years ago

FWIW I opened https://github.com/davidgiven/fluxengine/pull/417 which offers a rescaling for reading as well, which should fix the reported read time to match the written time.

raneri commented 2 years ago

Unfortunately the problem is not completely solved for me. I can write disks that will be read by my 1541 drive (the older "brown" one) even with some difficulties (random errors, need to reset the drive and retry...); the other one doesn't read them at all (no problems with the same drive and other disks written with a real drive connected to PC via parallel interface) only sometimes and rarely I get the directory index, with the command: LOAD "$",8

In addiction of this, I always receive errors on track 70 during write, see this log: https://pastebin.com/0YQqerLX