Miracle Systems FLP size determining algorithm known?

Nagging hardware related question? Post here!
stephen_usher
Gold Card
Posts: 433
Joined: Tue Mar 11, 2014 8:00 pm
Location: Oxford, UK.
Contact:

Miracle Systems FLP size determining algorithm known?

Post by stephen_usher »

I'm in the process of formulating a bug report for Flashfloppy on the Gotek due to the failure of QLs with Trump Cards and (at least the clone of) SGCs to format floppy images correctly and it would be very useful if I could inform the developer how Miracle Systems disk interfaces determine the size and geometry of floppy disks. (The bug could be more general than just the QL as it involves disk image tagging breaking even for DD disks using an SGC clone.)

Does anyone know what the algorithm used is?

I see it trying to write to track zero sides 0 and 1 a couple of times and then random other tracks and then track 79 sides 0 and 1. This may help with the inability of the Trump Card to format on Flashfloppy too.

The bug I'm trying to report is:

Without an IMG.CNF file formatting of a DD sized floppy image fails with the access indicator showing each track being accessed but side zero only flashing up briefly followed by side 1 for longer and then "format failed" when it gets to track 79/1. With the default IMG.CNF file the format works. If I duplicate the default settings in a "tag" section and then tag the file with that type the format fails in the same way as above. Similarly, creating tag files for HD and ED floppy images also fail. (HD and ED images with the default IMG.CNF file format as DD images despite their size difference.)


stephen_usher
Gold Card
Posts: 433
Joined: Tue Mar 11, 2014 8:00 pm
Location: Oxford, UK.
Contact:

Re: Miracle Systems FLP size determining algorithm known?

Post by stephen_usher »

P.S.

On a Trump Card and Sandy Q-Board without IMG.CFG file and with a "tagged" file they both try to format single sided and fail. With the default config the Trump Card formats successfully single sided.

It must be something in the generic QL floppy extension code which is behaving strangely with emulated floppy hardware.

Anyway, here's a video of what happens on the SGC clone: https://youtu.be/jaDbxf8jQ74

Oh, and what's the disk geometry for a SGC ED disk? It's obviously not the same as an IBMPC ED disk as the capacity's larger.


stephen_usher
Gold Card
Posts: 433
Joined: Tue Mar 11, 2014 8:00 pm
Location: Oxford, UK.
Contact:

Re: Miracle Systems FLP size determining algorithm known?

Post by stephen_usher »

Very interesting.... If I set "flp_jiggle 1" then the format to HD images format correctly.

What precisely does flp_jiggle do at the hardware level? I need to pass this information onto the Flashfloppy developer.

I wonder if it forces a "Track Zero" signal. Previous formats seemed to start at track 3.

Now to try ED floppy images. (No go. I think QL ED format is unlike anything else. It seems to be 80 track, 2 sides, 40 sectors per track, 6400 sectors in total.)


stephen_usher
Gold Card
Posts: 433
Joined: Tue Mar 11, 2014 8:00 pm
Location: Oxford, UK.
Contact:

Re: Miracle Systems FLP size determining algorithm known?

Post by stephen_usher »

I've now managed to format an ED image. Here's how:

Edit the IMG.CFG downloaded from the Flashfloppy Github site to add the QL ED tag and put the file on the USB drive (preferably put it and FF.CFG in a sub-directory called 'FF'):

Code: Select all

[qlhd]
cyls = 80
heads = 2
secs = 18
bps = 512

[qled]
cyls = 80
heads = 2
secs = 10
bps = 2048
Create a 3200 Kbyte file and call it <imagename>.qled.img and put it onto the USB drive, e.g.

Code: Select all

dd if=/dev/zero of=myfloppy.qled.img bs=2048 count=1600
cp myfloppy.qled.img /usb-mount-point/myfloppy.qled.img
Put the USB drive into the Gotek and power it and the QL with SGC on. Select myfloppy.qled on the Gotek

Get into basic and type:

Code: Select all

tk2_ext
flp_jiggle 1
flp_density e
format flp1_myfloppy
I've found that it doesn't auto-detect that it should format as ED format properly and the format fails, hence the need for the flp_density command.

I'm going to ask the Flashfloppy developer if we can add this as a standard format, maybe with an additional host entry 'ql'.

Now all I have to work out is how to get the Trump Card and Sandy Q-Board to format correctly. They both auto detect as single-sided and then the format fails at the end. It may be the same reason that the SGC needs the flp_jiggle command, but these don't have that available.

Anyway, I hope someone may find this useful.


User avatar
tofro
Font of All Knowledge
Posts: 2701
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Miracle Systems FLP size determining algorithm known?

Post by tofro »

From the SuperGoldCard manual (emphasis mine):
The Gold Card and Super Gold Card incorporate a software fix for a
problem when accessing Mitsubishi ED disk drives in the form of a
number of rapid steps of the drive head.
This rapid stepping of the
drive head, referred to as a jiggle, when applied to other makes and
types of disk drive can result in the drive giving "not found" or 'bad
or changed medium' errors. There is a command to enable or disable this
jiggle.
Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
stephen_usher
Gold Card
Posts: 433
Joined: Tue Mar 11, 2014 8:00 pm
Location: Oxford, UK.
Contact:

Re: Miracle Systems FLP size determining algorithm known?

Post by stephen_usher »

Indeed, Tobias, but it doesn't say precisely how it does this at the controller/Shugart interface level.

From circumstantial evidence so far it seems that the QL floppy interface formatting code right back to the beginning is violating the Shugart interface standard and has worked purely by accident as most floppy drives "did the right thing". The effect of the flp_jiggle seems to be to put the floppy into the correct mode for the format to begin. Evidence from the display on the Gotek suggests that the SGC at least isn't setting the "Track Zero" line active so the drive doesn't seek to the beginning of the disk (it seems to go to start at track 3).

Until it can be determined precisely what the QL interfaces are doing a work-around in Flashfloppy can't be proposed so as to fix the problem once and for all.


Derek_Stewart
Font of All Knowledge
Posts: 3958
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Miracle Systems FLP size determining algorithm known?

Post by Derek_Stewart »

tofro wrote:From the SuperGoldCard manual (emphasis mine):
The Gold Card and Super Gold Card incorporate a software fix for a
problem when accessing Mitsubishi ED disk drives in the form of a
number of rapid steps of the drive head.
This rapid stepping of the
drive head, referred to as a jiggle, when applied to other makes and
types of disk drive can result in the drive giving "not found" or 'bad
or changed medium' errors. There is a command to enable or disable this
jiggle.
Tobias
Hi,

I have not used an ED dribe in a long time and forgot about the FLP_JIGGLE command, which these messages jogged my memory.

I remember Mike Thominson from MIracle Systems, saying that if the FLP_JIGGLE command was not used on a ED Drive, the drive head would destroy itself over a period of time, he did not really expand on the time period.

So I just followed the advice and the detail in the manual all seemed to work fine.


Regards,

Derek
stephen_usher
Gold Card
Posts: 433
Joined: Tue Mar 11, 2014 8:00 pm
Location: Oxford, UK.
Contact:

Re: Miracle Systems FLP size determining algorithm known?

Post by stephen_usher »

stephen_usher wrote:IEvidence from the display on the Gotek suggests that the SGC at least isn't setting the "Track Zero" line active so the drive doesn't seek to the beginning of the disk (it seems to go to start at track 3).
Reading up this morning on the floppy interface it seems that I have the idea of the "Track Zero" line completely wrong, it comes from the drive and not the controller. Oh well. Maybe there's a timing issue with the step pulse commands... but then the Gotek/FF combo should be faster than a real floppy drive so I doubt that could be the problem.

I may have to solder the JTAG connector onto a Gotek and monitor the debug signals from FF.


stephen_usher
Gold Card
Posts: 433
Joined: Tue Mar 11, 2014 8:00 pm
Location: Oxford, UK.
Contact:

Re: Miracle Systems FLP size determining algorithm known?

Post by stephen_usher »

OK. Found the problem, at least for the (S)GC formatting issue.

The default settings for PIN 2 and PIN 34 in "interface = shugart" on FF are "diskchange" and "ready" respectively. The (S)GC uses PIN 2 as density detect and hence the interface wasn't picking up the drive density value. I have no idea why this would affect formatting with an explicit density setting but it did. I also haven't a clue why FLP_JIGGLE would fix the problem either.

So, I now have the SGC clone successfully formatting floppy images of all types without FLP_JIGGLE or manually setting the density.

Now to switch to the Trump Card and see if I can get that formatting correctly.


stephen_usher
Gold Card
Posts: 433
Joined: Tue Mar 11, 2014 8:00 pm
Location: Oxford, UK.
Contact:

Re: Miracle Systems FLP size determining algorithm known?

Post by stephen_usher »

So, both the Trump Card and Sandy Q-board consistently determine that the drive is single-sided.

I can see during the pre-format phase that they test accessing side one briefly a couple of times but then fail to use it.

So, a bug in the Q-Jump Toolkit II format detection code? Does anyone know how it works?


Post Reply