VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

Anyone knows how the floppy's DDR setting (250,300,500,1MBit rate programmed) affects reads and writes from the floppy disk?
What happens if the data rate setup is higher than used for formatting the floppy? And what happens if it's lower?

Do higher rates programmed succeed always and lower rates fail? Or is it the opposite? Or does it need to match exactly?

I mean the low 2 bits of the CCR register. How does it affect low-rate formatted disks (like older floppies)?

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

Reply 1 of 6, by mkarcher

User metadata
Rank l33t
Rank
l33t
superfury wrote on 2025-05-04, 19:52:

Do higher rates programmed succeed always and lower rates fail? Or is it the opposite? Or does it need to match exactly?

They need to match exactly. The data rate is not for reserving bus bandwidth or stuff like that, but it tells the controller how fast the bits are supposed to be delivered from/to the medium. While the floppy controller does have a PLL to capture the exact bit rate, the capture range of that PLL is by far not wide enough to capture a 250kbps stream in 300kbps mode or vice versa. As the PLL is synchronized per sector, it is possible to have disks with different data rates on the same track, but it is very challenging to create such disks without using hardware like a Catweasel, KryoFlux or GreaseWeazle. Furthermore, a disk like this also wouldn't conform to any kind of standard, as a PC-type floppy disk is supposed to have a "start of track" header (a "soft index pulse") at the disk data rate as the first payload on the track, preceding the first sector header. Multi-mode floppy controller could contain logic that peeks for this header after a "hard index pulse", and recognizes the data rate of that header, and then switches to that data rate for the whole track. I never heard that any widespread floppy controller actually does this, though.

It's likely possible to create really weird disks with overlapping sectors of different data rates. I wouldn't be surprised if something like that was actually used for copy protection.

Reply 2 of 6, by superfury

User metadata
Rank l33t++
Rank
l33t++

Does the BIOS uses some way of detecting the correct rate to use? It looks to me that it always specifies the data rate according to the configured (or detected somehow) drive type?

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

Reply 3 of 6, by mkarcher

User metadata
Rank l33t
Rank
l33t
superfury wrote on 2025-05-04, 21:05:

Does the BIOS uses some way of detecting the correct rate to use? It looks to me that it always specifies the data rate according to the configured (or detected somehow) drive type?

The BIOS uses the CMOS drive type to determine what data rates make sense: 5 1/4 360K and 3 1/2 720K drives always use 250kbps. 1.2MB drives use 300kbps or 500kbps. 1.44MB drives use 250kbps or 500kbps. All drives except for 360K drives have a "change line" to signal a disk change since the last step. An active change line can be used by the BIOS not only to return "error code 6", but also to know that the data rate has to be re-established. Byte 40:90 (for drive A) in the BIOS data area contains the information used by the BIOS to use the correct data rate. Drive B uses 40:91.

Reply 4 of 6, by superfury

User metadata
Rank l33t++
Rank
l33t++
mkarcher wrote on 2025-05-04, 21:31:
superfury wrote on 2025-05-04, 21:05:

Does the BIOS uses some way of detecting the correct rate to use? It looks to me that it always specifies the data rate according to the configured (or detected somehow) drive type?

The BIOS uses the CMOS drive type to determine what data rates make sense: 5 1/4 360K and 3 1/2 720K drives always use 250kbps. 1.2MB drives use 300kbps or 500kbps. 1.44MB drives use 250kbps or 500kbps. All drives except for 360K drives have a "change line" to signal a disk change since the last step. An active change line can be used by the BIOS not only to return "error code 6", but also to know that the data rate has to be re-established. Byte 40:90 (for drive A) in the BIOS data area contains the information used by the BIOS to use the correct data rate. Drive B uses 40:91.

But from what I can see the BIOS just seems to set a drive type based on the floppy disk configured into it only? It doesn't perform any rate determination from what I can see?
How will the BIOS know that a sector ID is present for a certain rate? I only see it running seeking to the requested track and executing a read ID command, which obviously fails if the CCR register's rate doesn't match the disk's required speed? It seems to simply re-execute the same set of seek followed by read ID, failing because the rate isn't properly setup?

For example, for a 2.88MB floppy drive, it always sets the CCR to 3 (thus 1MBits/s), even though the disk is a 1.44MB floppy disk, thus failing any accesses to non-2.88MB disks?

Last edited by superfury on 2025-05-04, 22:12. 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 6, by DaveDDS

User metadata
Rank Oldbie
Rank
Oldbie

Different data rates are used for different drives/media.

Quick summary(for 5,25"): DD=250k(300rpm 360k drive), HD=500k(360rpm, 1.2M drive)
DD in HD drive=300k(360rpm1, 1.2Mdrive)

See my ImageDisk docs for a (imho) decent more detailed description.

Dave ::: https://dunfield.themindfactory.com ::: "Daves Old Computers"->Personal

Reply 6 of 6, by superfury

User metadata
Rank l33t++
Rank
l33t++

The issue is that the BIOS only sets the data rate to the maximum the drive supports, thus is lower capacity formatted media is inserted, all accesses would fail.

My 2.88MB floppy disk setup is setup for 2.88MB in the BIOS, then it tries to read a 1.44MB (or smaller) floppy at the 1MB rate always, so it can't boot anything? It never seems to attempt to change the data rate.

My floppy disk emulation simply reports this as ST1/ST2 being 01h (couldn't find the sector, data address mark not found). Or should it report something different in this case?

Perhaps that should be 25h (ST1) and 21h(ST2) respectively?

Or 24h and 00h?
What values in those registers would indicate that the wrong rate is being used?

Edit: OK. Managed to get the BIOS to drop the rate down to #0(500K), using ST1=25h, ST2=20h. Using a simple 1.44MB floppy of course.
Now to check what happens when I put it even lower (a lower density floppy).
Edit: The BIOS seems to cycle through the rates now (during read ID commands (also after swapping disks), before performing actual reads afterwards)! 😁
I at least hope that's the solution?
Idk if it also works with operating systems?

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