Gotek Floppy Drive Emulator

Introduction

As of 2020 floppy disks and floppy drives are not something that are commonly seen as we have moved on to far smaller, more reliable and higher capacity types of non-volatile memory, with flash memory leading the way. Floppy disks are low capacity (around 1MB depending on the type of disks and how the data is stored) and can easily be damaged by heat, physical force and magnets. However, there are still individuals that have computers that make use of floppy disks with retro computers being a good example.

Unfortunately, floppy disks tend to be quite unreliable and the drives themselves need maintenance, which can be expensive and replacement parts can be difficult to source. The good news is that we now have floppy drive emulators, which are small devices that use a flash drive or SD card to emulate not just one floppy disk but hundreds! This means we can store lots of software (such as the entire catalogue of a computer system) on modern storage (SD card/flash drive) while being compatible with the old computer's floppy disk interface. Since the floppy disk images are stored on modern storage it's easy to transfer virtual disks to and from PCs and make backups.

Gotek Floppy Drive Emulator Introduction

Probably the most well known floppy drive emulator is the Gotek type which I'll link to here for the official home page:

http://www.gotekemulator.com/

It's very apparent how useful these drive emulators are for a wide range of equipment, not just computers.

The Gotek drives are available on many shopping sites but be aware that they may not be original or may contain different firmware and be sure to check that the drive is compatible with your system. Having said that, I was looking for a Gotek floppy drive for my BBC Micro computer and so naturally searched for 'BBC Gotek' on ebay which returned some quite expensive results. I then removed 'BBC' from the search and found cheaper Gotek drives and was able to order one for about £25 (~$32) after reading the description which mentioned it was compatible with Acorn computers but also supports a wide range of other disk formats and is able to emulate a 3", 3.5" or 5.25" floppy drive. The Gotek I bought has the model number SFR922D, resembles a 3.5" floppy drive and has the FlashFloppy firmware installed which you can access at:

https://github.com/keirf/FlashFloppy

And the FlashFloppy wiki (useful for general information as well as programming/upgrading firmware, troubleshooting, supported formats, etc.):

https://github.com/keirf/FlashFloppy/wiki

Here is a view showing the front of the Gotek:

On the front of the Gotek is a 3-digit LED 7-segment display which indicates which virtual disk is currently selected as well as displaying other information such as the current track being accessed (you can get Gotek drives with an OLED display which give more information). There are two push buttons, one to select the next virtual disk and the other to choose the previous. The USB socket is for the flash drive which only needs to be 1GB (you can use larger but it won't be an advantage due to the limit on the number of virtual disks) but the flash drive must be formatted as FAT32 which you can do using, for e.g., the Windows format tool. After the drive has been formatted you can copy disk image files to the drive which can be downloaded online and then put the flash drive into the Gotek's USB socket.

Here is the back view of the Gotek:

At the rear end of the Gotek is a 4-pin PC-like floppy drive power connector (only 5V is required, take note) and to the right of that is a standard PC 34-pin floppy drive connector. Above the power connector are a couple of programming pins, J3 and J4 and there is also provision for a RESET switch to be added which shouldn't be required but would be handy should the Gotek freeze up. To the right is the options header which has the pins labelled as J5, JA, JC, JB, S0, S1, and M0; there was a shunt already fitted to S0 and I did not need to move it or add any extra shunts to work with the BBC Micro but you may have to for your computer.

Next, let's have a look at the cables I used:

For the disk interface cable I used a standard PC floppy drive cable and typically these cables are designed for two floppy drives and thus have three connectors, one of which goes into the motherboard, and the other two for drive A and drive B. When using such a cable with a Gotek, however, make sure to not use the connector for drive B, which will have a twist in the cable near the connector (it's a good idea to cut off the section of the cable for drive B so you don't accidentally use it). Then it's just a matter of plugging the motherboard end of the cable into the BBC Micro's disk drive interface connector at the bottom of the machine, making sure that pin 1 of the connector lines up with pin 1 as indicated on the BBC Micro (the floppy drive cable connector will either have a triangle marking pin 1 or a pink/red stripe on the cable). The other end of the cable (drive A) needs to be plugged into the Gotek's 34-pin connector, making sure that pin 1 of the connector lines up with pin 1 as indicated on the Gotek PCB (see second photo above).

Before getting into the details of using the Gotek with the BBC Micro let's just have a look at the internals of the Gotek:

There are just two screws holding the top cover on which are accessed from the top and toward the middle. As you can see the main PCB is smaller than the enclosure and it connects to the LED display board using 2 connectors. The main chip, an ARM STM32F105, uses a Cortex-M3 core that can run up to 72MHz and may seem very advanced for a floppy drive emulator but allows for high flexibility and has native USB support, so is very ideal for the job. That said, because the Gotek is communicating with a floppy disk interface that does present a bottleneck even though flash drives are faster than floppy disks. From my tests, the Gotek is as fast as or slightly faster than a real floppy drive and the type of flash drive you use does affect disk operation speed somewhat.

With everything connected and a flash drive containing disk images for your machine inserted into the Gotek's USB socket, power on the computer that is connected to the Gotek. You should see some activity on the LED display which will soon settle down and show the currently selected floppy disk image: '000' for disk image 1, '001' for disk image 2, and so on. Press the buttons on the Gotek to select the disk image you want to use and then you should be able to access the files contained within the disk image using the disk commands of the computer the Gotek is attached to.

As mentioned, I had bought a Gotek for my BBC Micro but the first couple of disk images I put on the flash drive caused an error when I tried loading them using my BBC Micro but I now know the issue was either bad files or they were designed for the BBC Master (the later BBC Micro model). When I tried some other disk images I was able to load and run the files without any problems so I just got unlucky the first time. But when I wrote a very simple BASIC program and tried saving it, even though there was space on the disk the program would not save and I couldn't even delete any existing files on the disk (they weren't write protected). I looked online and it turns out that not being able to write to the virtual floppy disk could be a fault with the flash drive as it reports incorrectly to the Gotek that it's write protected. As I had tried a 1GB, no brand flash drive without success I formatted a Technika 256MB drive in the hope that it would let me write to it using the Gotek but again it wouldn't save any files. My last attempt was a 64GB Sony flash drive which was overkill for the job but I was glad I tested it as I was now able to load, save and delete programs on disk using the Gotek. However, even though it seems the flash drive was at fault, I had swapped between floppy drive cables by the time I got round to trying the Sony flash drive so when I tried the previous flash drives I was able to save and delete so perhaps the cable was at fault.

To go into further detail of the basics of using a Gotek with a BBC Micro (I have DFS 2.2J installed; other disk software versions may use different commands). With a disk image selected you can list the files on the disk using:

*CAT

To load a BASIC program from disk into memory:

*LOAD "filename"

Where filename is, of course, the name of the file.

If you want to save a BASIC program to disk:

*SAVE "filename"

To automatically load a game from disk that has a !BOOT file press SHIFT+BREAK.

If you want to remove a file from disk:

*DELETE "filename"

To format a 40 disk track issue these commands:

*ENABLE

*F40 0

Or replace *F40 0 with *F80 0 to format as 80 tracks. I found that if you don't specify the device number (0) then the operation fails. Since the Gotek doesn't let you format the flash drive (at least my version doesn't) the only want to have blank disks is to copy an existing disk to the flash drive and then format it using the BBC Micro.

If you are not sure what disk commands are available on your BBC Micro first issue *HELP. You will possibly get a result similar to this:

DFS

UTILS

To find out the disk commands use:

*HELP DFS

All the disk commands should be listed and for information on any particular disk command just specify it in this way:

*HELP DFS DELETE

For a video I did on using the Gotek with the BBC Micro please see below:

Gotek Troubleshooting

Please note that this section deals with Gotek devices that have the FlashFloppy firmware installed.

Configuration files FF.CFG and IMG.CFG

Because a Gotek can support so many different types of floppy drive images there can be situations where it will misinterpret how the data is stored, especially if it has a generic extension (.IMA or .IMG). I had the issue where I was using my Gotek with my Acorn BBC Master and I could not list the files on a particular type of virtual disk, that is, the file names would appear corrupted. The particular type of disk image I was having trouble with has the .IMG extension and is a hybrid between an Acorn and MS-DOS disk format. The first supposed remedy I tried was to add a FF.CFG configuration file to the flash drive I use on my Gotek and edit it so that host = acorn (from the default 'unspecified'). The FF.CFG file allows you to set a wide range of values that determine how a Gotek behaves.

Rather than create the file from scratch, however, you can download the FlashFloppy firmware from:

https://github.com/keirf/FlashFloppy/wiki/Downloads

Click the most recent download link and after it has downloaded, unzip it and copy the FF.CFG file from the examples folder to the flash drive and make the edit. Although this didn't help me with my issue it's a good first step.

What I found that does work is to add an IMG.CFG file to the flash drive which can also be obtained from the examples folder and this file allows you to tag certain disk image types with specific information as to how the data is laid out. To keep things simple as I only had one type of .IMG file I modified the '[default]' section by changing the necessary values (in my circumstance I only needed to alter 'secs' and 'bps'). What values you will need to change depends on the formatting of the disk image you are having trouble with but it's just a matter or looking up the various values and making the edits in the IMG.CFG file.

For more information about FF.CFG and IMG.CFG please see these links:

https://github.com/keirf/FlashFloppy/wiki/FF.CFG-Configuration-File

https://github.com/keirf/FlashFloppy/wiki/IMG.CFG-Configuration-File

All content of this and related pages is copyright (c) James S. 2020