Floppy Drive "Twaddle"

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
640KB
Posts: 1
Joined: Wed Oct 12, 2022 10:17 am
Location: NYC
Contact:

Floppy Drive "Twaddle"

Post by 640KB »

Hello everyone. I've asked this question around a few places so apologies if you've seen this before elsewhere.
 
This article on wiki.osdev.org describes a method referred to as "twaddling" to reset the disk change line on a floppy drive that's simpler than the usual way of seeking to track 1 then track 0. From the article:
Apparently, a small number of floppy drives also support one additional way to clear the bit -- something that Linux calls a "twaddle". Simply toggle the drive motor bit on, off, and then on again. When your driver tries to clear the Disk Change bit the first time, it can try a twaddle, and see if it works, and keep a flag if it does.
Indeed, the Linux floppy driver source does implement this as the article says.

Have tried this method on several PCs with varying generations of drives and controllers and this method has not worked on any (nor does it work on 86Box). The code is obviously quite simple, and I've tried adding various delays and no delay between the motor control register (3F2H) writes but no difference. Obviously, the article says "a small number of floppy drives" so entirely possible none of my drives are in that small number. However, I have tried some very common drive models such as the Teac FD-55G series, various common Sony/Teac/Mitsumi 1.44 drives and even a Sony 2.88 drive, so if those aren't compatible I'd imagine this was indeed a "small number".

Does anyone know anything more about this and any info about what kinds of drives might have actually supported it? Was it actually a specific controller/drive combination that made it work?

Or is it possible this test code is missing something? (I do hope it is that, otherwise this would be supported by literally no drives!)

Code: Select all

    MOV    DX, 03F2H            ; FDC DOR
    MOV    AL, 00011100B        ; drive 0 motor ON, select drive 0, DMA+FDC enable
    OUT    DX, AL               ; motor ON
    DELAY_LOOP                  ; insert some delay here (or not)
    XOR    AL, 00010000B        ; drive 0 motor OFF
    OUT    DX, AL               ; motor OFF
    DELAY_LOOP                  ; insert some delay here (or not)
    XOR    AL, 00010000B        ; drive 0 motor ON
    OUT    DX, AL               ; motor ON
    DELAY_LOOP                  ; insert some delay here (or not)
    MOV    DX, 03F7H            ; FDC DIR
    IN     AL, DX               ; read change line state
    TEST   AL, 10000000B        ; expect ZF indicating no change (change latch has been reset)
Octocontrabass
Member
Member
Posts: 5487
Joined: Mon Mar 25, 2013 7:01 pm

Re: Floppy Drive "Twaddle"

Post by Octocontrabass »

Rapidly toggling a motor on and off sounds like a good way to glitch nearby circuits into misbehaving.

Unfortunately, it doesn't look like the author of that code bothered to write down which drive/controller combination it's supposed to work with, so I don't think you'll be able to confirm if it ever really worked. I tried looking through some floppy drive datasheets, but according to all the ones I checked, only step pulses can clear the change bit. I also tried looking through some floppy drive controller datasheets, but the ones I checked seem to pass the change bit to the CPU with no way to forcibly clear it. One datasheet mentioned latching the bit, but with no other details, I can only assume the latch is there to make a synchronous signal out of an asynchronous signal.
Post Reply