Detecting an empty drive with a NEC uPD765A or compatible FDC is theoretically easy using the ‘drive ready’ signal. In practice, the drive ready mechanism is completely unusable on IBM PCs and compatibles due to the way the FDC is wired.
AT-style controllers and drives support the disk change line signal which more or less replicates the drive ready functionality. To recap, the change line signal is controlled by the drive (the FDC merely selects which drive should be reporting it) and it goes active when the drive door is open. To deactivate the change line signal, there must be a medium inserted in the drive and the drive must receive a step pulse.
In the absence of a change line signal, software often implements a pessimistic/optimistic algorithm. If the drive has been idle for a while (typically two seconds), the medium is considered changed. As long as the drive is working, the medium is thought not to have changed. This algorithm works well in practice: It is very difficult to swap a disk in less than two seconds, and any attempt to remove the medium while the drive is busy will be detected as an error.
The OS/2 floppy driver (IBM1FLPY.ADD) uses both of these approaches. If there is no change line support, the logic is approximated. When the change line is available, more straightforward media change reporting is implemented.
A minor fly in the ointment is that some floppy controllers (notably PS/2 Model 30) use inverted change line levels. OS/2 detects normal or inverted change line logic by deselecting all drives and checking the DSKCHG bit in the Digital Input Register (DIR).
The IBM1FLPY.ADD driver also accepts command line parameters to override change line support detection. This can be used to trigger an interesting error in some OS/2 system applications, notably the installer.
The OS/2 installer likes to ask the user to remove any floppy from the boot drive before exiting. The idea that the system needs to be rebooted (either by the user or by the installer itself), hence no floppy should be left in the boot drive.
When the floppy driver is not using change line support, the OS/2 installer gets confused, refuses to quit and keeps asking the user to remove the disk from the drive even if no disk is inserted.
This is a subtle bug in the installer. The code attempts a floppy access operation and examines the return code. It is only satisfied by an IOERR_MEDIA_NOT_PRESENT error. Unfortunately, without change line support, the best the floppy driver can do is an IOERR_MEDIA_CHANGED error—as explained above, without the change line the floppy driver simply has no chance to distinguish an empty drive from an unreadable disk.
Relying on specific error codes which are not guaranteed to occur is a fairly common programming mistake. That said, it could be argued that in this case it is incorrect design, because detecting an empty floppy drive requires specific hardware support which may not be present. If the OS/2 floppy driver does not require change line support, the OS/2 installer shouldn’t either. In practice, this is very unlikely to happen on real hardware because finding a system which has no change line support and can run 32-bit OS/2 would be quite difficult.