Greetings again fellow OSDevers,
I've been planning to make a floppy disk driver to use instead of the BIOS one. The OSDev Wiki that stated I could use support PC-AT, PS/2 and Model 30 mode floppy disk controllers by using commands that are the same in all three mode but doesn't specify which ones. I hoping there was someone who has some knowledge in the area.
Which commands are present in all three modes? Which will only work in specific modes?
Using all three floppy disk modes
-
- Member
- Posts: 100
- Joined: Wed Mar 13, 2013 2:27 am
Using all three floppy disk modes
TachyonOS - Violates causality on 95% of attempts. Runs at approximately 1.5c.
Re: Using all three floppy disk modes
Hi,
82077AA Floppy Controller Datasheet. This datasheet includes "Chapter 7 - Compatability" that describes the differences between the modes. By following a few links you'd also find a datasheet for "Intel 8272 single/double density floppy controller" here.
If you've got both datasheets (old and new) you can compare them.
Cheers,
Brendan
At the bottom of the wiki page there's a "Reference Documents" section. The first link there is theProchamber wrote:Greetings again fellow OSDevers,
I've been planning to make a floppy disk driver to use instead of the BIOS one. The OSDev Wiki that stated I could use support PC-AT, PS/2 and Model 30 mode floppy disk controllers by using commands that are the same in all three mode but doesn't specify which ones. I hoping there was someone who has some knowledge in the area.
Which commands are present in all three modes? Which will only work in specific modes?
82077AA Floppy Controller Datasheet. This datasheet includes "Chapter 7 - Compatability" that describes the differences between the modes. By following a few links you'd also find a datasheet for "Intel 8272 single/double density floppy controller" here.
If you've got both datasheets (old and new) you can compare them.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
-
- Member
- Posts: 100
- Joined: Wed Mar 13, 2013 2:27 am
Re: Using all three floppy disk modes
Thanks for your help!
It seems that I can support most features on PC/AT,PS/2 and Model 30 drives. I can't use the SRA, SRB or DSR registers or perpendicular mode, none of these are any great lose. I'm not sure if CONFIGURE and LOCK are supported, it doesn't mention them in the compatibility section of the 80077AA sheet but they are not on the 8272 and it would be a huge pain if they weren't supported. I'll probably just go ahead and use the commands.
CMOS doesn't actually say how many drives there, as claimed on the Floppy Disk Controller page, it merely says the type of floppy at for the first and second drive. I'm thinking of trying to detect drives by use SENSE_INTERRUPT after doing a controller reset with drive polling on. If an interrupt doesn't come then within a timeout, the drive doesn't exist. Would this work?
It seems that I can support most features on PC/AT,PS/2 and Model 30 drives. I can't use the SRA, SRB or DSR registers or perpendicular mode, none of these are any great lose. I'm not sure if CONFIGURE and LOCK are supported, it doesn't mention them in the compatibility section of the 80077AA sheet but they are not on the 8272 and it would be a huge pain if they weren't supported. I'll probably just go ahead and use the commands.
CMOS doesn't actually say how many drives there, as claimed on the Floppy Disk Controller page, it merely says the type of floppy at for the first and second drive. I'm thinking of trying to detect drives by use SENSE_INTERRUPT after doing a controller reset with drive polling on. If an interrupt doesn't come then within a timeout, the drive doesn't exist. Would this work?
TachyonOS - Violates causality on 95% of attempts. Runs at approximately 1.5c.
Re: Using all three floppy disk modes
Hi,
For detecting if there's any disk drives connected to the controller; the SENSE_INTERRUPT won't work without a previous SEEK, and I'm not sure if there are any commands that can be used to tell the difference between "drive doesn't exist" and "drive exists but is empty".
I also don't think it's possible to detect what type of disk drive it is. However, if there's a floppy disk in the drive you can figure out what format it is and then make assumptions about the disk drive type from the floppy disk's format (e.g. if it's a 1440 KiB disk then assume the drive is 3.5 inch, and if the disk is 1200 KiB assume the drive is 5.25 inch).
Basically, auto-detection wasn't a priority when old hardware was designed, so it's very difficult to auto detect anything reliably (and it may be best to ask the user which disk drivers exist and what type they are).
Cheers,
Brendan
You can detect what sort of controller you're working with (using the "version" command) and have different code for different controllers for the pieces where it matters (mostly initialisation).Prochamber wrote:It seems that I can support most features on PC/AT,PS/2 and Model 30 drives. I can't use the SRA, SRB or DSR registers or perpendicular mode, none of these are any great lose.
CONFIGURE and LOCK are only supported on the enhanced controllers. Mostly they're only used for managing the FIFO queue (which doesn't exist on the older controllers). The LOCK command is so that old software written for old floppy controllers can't accidentally mess up the settings for newer features in newer controllers. For example, the BIOS might use the LOCK command so that old DOS applications don't cause problems. If your driver supports the newer controllers, and if only the driver and/or kernel can access the controller's registers, the LOCK command is pointless.Prochamber wrote:I'm not sure if CONFIGURE and LOCK are supported, it doesn't mention them in the compatibility section of the 80077AA sheet but they are not on the 8272 and it would be a huge pain if they weren't supported. I'll probably just go ahead and use the commands.
CMOS only tells you what the user set in the BIOS configuration thing (which may or may not have anything to do with what actually exists - e.g. if a system boots from hard drive the user can set anything they like for floppy types). It only covers the primary floppy controller, so if you've got 2 floppy disk controllers then you're out of luck.Prochamber wrote:CMOS doesn't actually say how many drives there, as claimed on the Floppy Disk Controller page, it merely says the type of floppy at for the first and second drive. I'm thinking of trying to detect drives by use SENSE_INTERRUPT after doing a controller reset with drive polling on. If an interrupt doesn't come then within a timeout, the drive doesn't exist. Would this work?
For detecting if there's any disk drives connected to the controller; the SENSE_INTERRUPT won't work without a previous SEEK, and I'm not sure if there are any commands that can be used to tell the difference between "drive doesn't exist" and "drive exists but is empty".
I also don't think it's possible to detect what type of disk drive it is. However, if there's a floppy disk in the drive you can figure out what format it is and then make assumptions about the disk drive type from the floppy disk's format (e.g. if it's a 1440 KiB disk then assume the drive is 3.5 inch, and if the disk is 1200 KiB assume the drive is 5.25 inch).
Basically, auto-detection wasn't a priority when old hardware was designed, so it's very difficult to auto detect anything reliably (and it may be best to ask the user which disk drivers exist and what type they are).
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
-
- Member
- Posts: 100
- Joined: Wed Mar 13, 2013 2:27 am
Re: Using all three floppy disk modes
Right, so I have multiple ways of doing the low-level things, like a regular method and a Model 30 enhanced method. I'll need to initialize the drives using a compatibility method then determine whether the enhanced method is supported.Brendan wrote:You can detect what sort of controller you're working with (using the "version" command) and have different code for different controllers for the pieces where it matters (mostly initialisation).
LOCK does stop you from having to do another CONFIGURE after every reset but I could easily just send CONFIGURE every time. Should I handle a non-DMA transfer mode with an interrupt after every byte?Brendan wrote:CONFIGURE and LOCK are only supported on the enhanced controllers. Mostly they're only used for managing the FIFO queue (which doesn't exist on the older controllers). The LOCK command is so that old software written for old floppy controllers can't accidentally mess up the settings for newer features in newer controllers. For example, the BIOS might use the LOCK command so that old DOS applications don't cause problems. If your driver supports the newer controllers, and if only the driver and/or kernel can access the controller's registers, the LOCK command is pointless.
Not good. I'll probably just avoid touching the drives unless a program requests it.Brendan wrote:Basically, auto-detection wasn't a priority when old hardware was designed, so it's very difficult to auto detect anything reliably (and it may be best to ask the user which disk drivers exist and what type they are).
I still don't have a method of representing paths and drives, you can access files in subdirectories by entering them but not specify a path. Maybe a Unix-style central directory, Window-style drive letters or even my own scheme.
Thanks for your help Brendan!
TachyonOS - Violates causality on 95% of attempts. Runs at approximately 1.5c.
-
- Member
- Posts: 170
- Joined: Wed Jul 18, 2007 5:51 am
Re: Using all three floppy disk modes
I will make the floppy driver read only.
If the disk has not already been formatted on another computer, it simply won't be readable or usable.
This avoids the situation where its not possible to "auto detect" the disk type.
If the disk has not already been formatted on another computer, it simply won't be readable or usable.
This avoids the situation where its not possible to "auto detect" the disk type.