Gotek + Flashfloppy: How-to.

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

Gotek + Flashfloppy: How-to.

Post by stephen_usher »

This is the text I've asked to be added to the Flashfloppy Github site WiKi but is possibly more useful here.

The Sinclair QL with any of the floppy interfaces tried so far (Sandy Q-Board, Miracle Systems Trump Card and Super Gold Card) will read and write IMG files without the need for an IMG.CFG file. The settings in the FF.CFG need to be set to the following otherwise formatting will not work and HD disks won't work on the Super Gold Card (even if FLP_DENSITY is used to manually set the disk type):

Code: Select all

interface = shugart
host = unspecified
pin02 = dens
pin34 = rdy
The interfaces don't need index pulses or a track change delay so these don't need to be changed from the default.

It should be noted that all interfaces which use the default Q-Jump Toolkit II version of the FORMAT command fail to determine the correct number of sides on in a floppy image and hence format single sided, giving 720 sectors rather than the expected 1440. However, if a pre-formatted image generated by dumping a real floppy or from an emulator is used then everything works. It's only the FORMAT command which is broken. (The reason for this is being investigated.)

The version of FORMAT on the Miracle Systems Gold Card and Super Gold Card use a different algorithm and work correctly.

It is unknown if the FORMAT command in SMSQ/e running on a Super Gold Card works or not.

To create an empty DSDD image using the following command under UNIX/Linux:

Code: Select all

dd if=/dev/zero of=myfloppy.img bs=512 count=1440
And an DSHD image using:

Code: Select all

dd if=/dev/zero of=myhdfloppy.img bs=512 count=2880
An attempt has been made to support ED disk images however the data rate seems to be too high for the Gotek to reliably read/write, giving many CRC errors. Although formatting seems to succeed the image produced contains garbage.


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

Re: Gotek + Flashfloppy: How-to.

Post by stephen_usher »

The reason for the failure of the Q-Jump FORMAT command on DSDD disks has been discovered.

This is what the developer of FF, Keir Fraser, has to say:
It looks like format writes extra sectors to track 0 side 1. These will not fit and will overwrite the normal sectors. It will then try to read normal sectors on side 0. If it cannot then side 1 and 0 are the same (single sided).

This kind of trick is not a fit for FF IMG handling. Use HFE and then convert to IMG after the format. You could even keep that as your formatted blank, clone and relabel it whenever you need a blank?
So it looks like DSDD disk images will have to be formatted outside of Flashfloppy using either an emulator or qltools.


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

Re: Gotek + Flashfloppy: How-to.

Post by tofro »

If formatting seems to be a problem, would it then make sense to deposit some formatted empty images in DD, HD, ED for download somewhere?

Tobias


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

Re: Gotek + Flashfloppy: How-to.

Post by stephen_usher »

tofro wrote:If formatting seems to be a problem, would it then make sense to deposit some formatted empty images in DD, HD, ED for download somewhere?

Tobias
Indeed, or just use qltools to create them.


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

Re: Gotek + Flashfloppy: How-to.

Post by stephen_usher »

Here's an updated "How-To":

The Sinclair QL with any of the floppy interfaces tried so far (Sandy Q-Board, Miracle Systems Trump Card and Super Gold Card) will read and write IMG files without the need for an IMG.CFG file. The settings in the FF.CFG need to be set to the following otherwise formatting will not work and HD disks won't work on the Super Gold Card (even if FLP_DENSITY is used to manually set the disk type):

Code: Select all

interface = shugart
host = unspecified
pin02 = dens
pin34 = rdy
The interfaces don't need index pulses or a track change delay so these don't need to be changed from the default.

It should be noted that all interfaces which use the default Q-Jump Toolkit II version of the FORMAT command fail to determine the correct number of sides on in a floppy image and hence format single sided, giving 720 sectors rather than the expected 1440. However, if a pre-formatted image generated by dumping a real floppy or from an emulator is used then everything works. This is due to a trick used by the command to determine the number of sides only working on real hardware.

The version of FORMAT on the Miracle Systems Gold Card and Super Gold Card use a different algorithm and work correctly.

It is unknown if the FORMAT command in SMSQ/e running on a Super Gold Card works or not.

You cannot format ED disk images but with the following entry in IMG.CFG you can read and write to pre-formated images:

Code: Select all

[qled]
cyls = 80
heads = 2
secs = 10
bps = 2048
Images can be generated using the 'qltools' utility from the qltools Github site (https://github.com/NormanDunbar/qltools/releases) in the following manner:

Double-sided, double-density:

Code: Select all

qltools myimage.img -fdd DSKLABEL
Double-sided, high-density:

Code: Select all

qltools myimage.qlhd.img -fhd DSKLABEL
Double-sided, extended-density:

Code: Select all

qltools myimage.qled.img -fed DSKLABEL
qltools is available as pre-built binaries for Linux and Windows and will build with minor modifications on macOS using the Xcode command line tools up to macOS Mojave, Catalina isn't supported as qltools needs to be built s a 32 bit application and Catalina only supports 64 bit executables.


User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: Gotek + Flashfloppy: How-to.

Post by NormanDunbar »

stephen_usher wrote:Here's an updated "How-To":

...

Images can be generated using the 'qltools' utility from the qltools Github site (https://github.com/NormanDunbar/qltools/releases) in the following manner:

...
It's best to grab releases and/or source code from the official Sinclair QL repository rather than mine. You can get the latest code for Windows and Linux from https://github.com/SinclairQL/qltools/releases/latest - it's all in 32 bit format, but will work on 64 bit systems (assuming you have the support files installed.)


Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
BackToQL
ROM Dongle
Posts: 22
Joined: Tue Sep 22, 2020 3:59 pm

Re: Gotek + Flashfloppy: How-to.

Post by BackToQL »

I’m hoping that someone will be able to point me in the right direction so that I can get my Gotek/FlashFloppy drive fully working with my QL running Minerva ROM & Tetroid’s SGC.

I have it working well with HD images, but am not able to get it working with ED images.

I updated the FlashFloppy version to the latest version v3.23 from github (https://github.com/keirf/FlashFloppy).

I set the Gotek IMG.CFG file to:

Code: Select all

[qled]
cyls = 80
heads = 2
secs = 10
bps = 2048
And the FF.CFG to:

Code: Select all

interface = shugart
host = unspecified
pin02 = dens
pin34 = rdy
I generated an ED image with ‘qltools myimage.qled.img -fed DSKLABEL’, but the image is only 18kb large (the HD images I generated with QPC2 were 1,440kb which is what I expected). I tried generating the ED images with qltools on both a 64bit Win10 PC and a 32bit WinXP PC with the same results. Is it correct that the ED image has a size of 18kb?

Would anyone who has the Gotek running successfully with ED images be able to share the following:
• Details of the FF.CFG file in the root of the USB drive
• Details of the IMG.CFG file in the root of the USB drive
• A sample ED image file
• Any other relevant set up information

Any help/suggestions would be welcome.

Regards,
Peter.


Martin_Head
Aurora
Posts: 847
Joined: Tue Dec 17, 2013 1:17 pm

Re: Gotek + Flashfloppy: How-to.

Post by Martin_Head »

My FDI driver http://www.dilwyn.me.uk/utils/FDI2driver204.zip can create ED images with the MAKE_FDI command

MAKE_FDI win1_test_img,TestED,e

Creates an image file on WIN1_, with a medium name of 'TestED'. The image file should be about 3.2Mb


User avatar
XorA
Site Admin
Posts: 1358
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: Gotek + Flashfloppy: How-to.

Post by XorA »

stephen_usher wrote:The reason for the failure of the Q-Jump FORMAT command on DSDD disks has been discovered.

This is what the developer of FF, Keir Fraser, has to say:
It looks like format writes extra sectors to track 0 side 1. These will not fit and will overwrite the normal sectors. It will then try to read normal sectors on side 0. If it cannot then side 1 and 0 are the same (single sided).

This kind of trick is not a fit for FF IMG handling. Use HFE and then convert to IMG after the format. You could even keep that as your formatted blank, clone and relabel it whenever you need a blank?
So it looks like DSDD disk images will have to be formatted outside of Flashfloppy using either an emulator or qltools.
That format error sounds familiar, pretty sure we saw the same thing with some QL disk interfaces when we were playing with hxc software.

Cant remember which interface it was we saw it with. But possibly QL coders copy n paste error to more than one!


User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: Gotek + Flashfloppy: How-to.

Post by NormanDunbar »

Hi Peter,
BackToQL wrote:I generated an ED image with ‘qltools myimage.qled.img -fed DSKLABEL’, but the image is only 18kb large (the HD images I generated with QPC2 were 1,440kb which is what I expected). I tried generating the ED images with qltools on both a 64bit Win10 PC and a 32bit WinXP PC with the same results. Is it correct that the ED image has a size of 18kb?
That looks about right. When an image is created the qltools utility only writes a few sectors. The map is how it manages to keep things in order, and as you write more data to the image, it gets bigger. Eventually, you will run out of map space and the disc will be declared full.

Here are a couple that I did:

Code: Select all

qltools myimage.qled.img -fed LABEL
ls -l *.img

-rw-r--r-- 1 norman norman 18432 Jan 18 16:44 myimage.qled.img
So that's 18Kb as you noted.


If you look at the image info, you will see that there are numerous sectors and free ones at that:

Code: Select all

qltools myimage.qled.img -i

Disk ID               : QL5B
Disk Label            : LABEL     
Number of sides       : 2
...
Free sectors          : 1596
Good sectors          : 1600
Total sectors         : 1600
Directory is          : 0 sectors and 64 bytes

Logical-to-physical sector mapping table:

0 2 4 6 8 80 82 84 86 88 1 3 5 7 9 81 83 85 87 89 
All image files created by qltools are initially created as 18 Kb files. If you need them to be full sized images, I shouldn't have too much trouble amending the code to do so. I think I was the last person to work on it! (Famous last words!)


HTH

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Post Reply