VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

When does a write command perform implied seek? Before or after the data transfer to disk?

What happens if the media is changed or removed while seeking during reads and writes?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 1 of 8, by Jo22

User metadata
Rank l33t++
Rank
l33t++

Hi! I don't know. But if you like to experiment with floppy drives,
you may also like to have a look at PC-Backup/PC-Restore of Central Point's PC Tools Deluxe 4.x.
It does some weird stuff with the floppy drive.
It detects the insertion of a floppy on its own, for example.
Anyway, this is just something I remember. Maybe I'm wrong. My memory isn't best anymore, some people say. 😅

"Time, it seems, doesn't flow. For some it's fast, for some it's slow.
In what to one race is no time at all, another race can rise and fall..." - The Minstrel

//My video channel//

Reply 2 of 8, by superfury

User metadata
Rank l33t++
Rank
l33t++

I just looked a bit further. In the 82077AA manual, it mentions that the implied seek is performed before a read or write command.
So if it's before a command, that means before the data phase/transfer starts.

I've also modified the read/write commands to perform an implied seek through normal timing mechanisms now! 😁
Previously it would just instantly change to the selected cylinder. Now it will simply use the normal seek mechanisms and timing, interrupting the read/write command until the seek completes.
Although it won't report the error correctly yet if the seek fails. That still needs to be implemented.
Edit: Just implemented the error handling of failed implicit seeks.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 3 of 8, by Battler

User metadata
Rank Member
Rank
Member
superfury wrote:

When does a write command perform implied seek? Before or after the data transfer to disk?

Before. If implied seeks are enabled, when a READ SECTOR ID, READ TRACK, READ DATA, READ DELETED DATA, WRITE DATA, or WRITE DELETED DATA command is issued, the FDC compares the specified sector ID's cylinder (C) field to the current value of its physical cylinder number (PCN) register for the selected drive and if they do not match, it seeks to the specific cylinder.

Reply 4 of 8, by superfury

User metadata
Rank l33t++
Rank
l33t++
Battler wrote on 2021-06-12, 15:09:
superfury wrote:

When does a write command perform implied seek? Before or after the data transfer to disk?

Before. If implied seeks are enabled, when a READ SECTOR ID, READ TRACK, READ DATA, READ DELETED DATA, WRITE DATA, or WRITE DELETED DATA command is issued, the FDC compares the specified sector ID's cylinder (C) field to the current value of its physical cylinder number (PCN) register for the selected drive and if they do not match, it seeks to the specific cylinder.

Makes sense. And what should happen if the disk is changed (a different disk being inserted) before the seek completes (for example, in a paused emulator)? Does the FDC detect this and take a specific action on it? Error out in a specific way? So what happens during any seek, read or write (including formatting etc.) command when the disk is ejected during the command or when seeking (implied and not implied)?

Edit: After improving the floppy disk controller a bit (it reacting to read-only and disk changed bits during read/write/format), somehow the booting starts with C/H/S 0/1/1 instead of 0/0/1 on the i430fx? Weird?
Edit: Said issue with the CHS seemed to be because of some corrupted i430fx CMOS data somehow. Clearing the CMOS and reconfiguring it seemed to fix the problem, causing proper booting from floppy disk again. 😁

Last edited by superfury on 2021-06-13, 12:09. Edited 1 time in total.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 5 of 8, by Battler

User metadata
Rank Member
Rank
Member

If the disk is ejected during seeking, the seek would complete without issues (the drive's step motor is still going to move the head), but the read command is not going obtain any data from the drive, and therefore most likely time out, which would cause DOS to report "Not ready reading drive A:".

Reply 6 of 8, by superfury

User metadata
Rank l33t++
Rank
l33t++
Battler wrote on 2021-06-12, 23:21:

If the disk is ejected during seeking, the seek would complete without issues (the drive's step motor is still going to move the head), but the read command is not going obtain any data from the drive, and therefore most likely time out, which would cause DOS to report "Not ready reading drive A:".

So reading or writing a sector from the disk while ejecting or changing said disk(inserting another one fast enough) would cause the drive to lock up (because the disk change line is set) instead of actually reading/writing the sector?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 8 of 8, by superfury

User metadata
Rank l33t++
Rank
l33t++

So the drive, when ejecting a disk during a seek/read/write command, causes it to stop responding to the FDC until the next command starts (timing out any command pending for a read/write, both with and without implied seek)?

What would be reported in ST0/1/2 in that case?
Would that simply set the NO DATA bit in the ST registers and abort the command with an error condition?

So abnormal terminationation+unit check in ST0(others bits act normal for read/write/format abort, but values for the terminated sector that was read/written), DE+NDAT in ST1, NDAM in ST2, ESIG in ST3, all other bits in ST1-3 cleared(except perhaps CRCE in ST2 set if transferring a sector's data when it happens)?
Edit: Just implemented said behaviour for read/write/format when a full sector is processed. Ejecting during the command will cause those bits to be set(and erroring out. The registers ST1-2 other bits being cleared, ST0 being the same as normal successful finish, except error condition and drive fault being set).

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io