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.
Well I am testing with a USB-to-Floppy since my laptop has no floppy disk drive and my desktop's drive doesn't work. Also, when testing in VirtualBox to see if the motor turns on, nothing happens. I would be able to hear the motor right? Here's my motor controlling code:
void fdc_motor(bool ed) {
// check if we need to turn on the motor
if(ed) {
uint8 mctl;
// figure out which motor we need to control
switch(drive) {
case 0:
mctl = FDC_DOR_MASK_MCTL_DR0;
break;
case 1:
mctl = FDC_DOR_MASK_MCTL_DR1;
break;
case 2:
mctl = FDC_DOR_MASK_MCTL_DR2;
break;
case 3:
mctl = FDC_DOR_MASK_MCTL_DR3;
}
// write the DOR to start the motor of the current drive
fdc_write_dor(mctl | FDC_DOR_MASK_ENABLE | FDC_DOR_MASK_DMA_MODE | drive);
}
else {
// write the DOR to stop the motor of the current drive
fdc_write_dor(FDC_DOR_MASK_ENABLE);
}
}
It is my understanding that USB floppy drives do not use the FDC or the FDC IO ports at all, on real hardware. You can only access USB floppies by using USB packet encoding over the USB bus -- it's an entirely different software driver. So I think that completely explains why this isn't working (and you aren't getting any IRQs) on your laptop, then. The FDC stuff is only for desktop machines with internal floppy drives. -- I will add a note to the FDC wiki article to make that clear.
As for VirtualBox -- I do not think that you have direct control over the floppy motor from inside VirtualBox. So no, I do not think the motor would come on at all until you try to read/write an actual sector.
Ah. Well that explains a lot. Would using a VFD make a difference? If not what exactly should I do? I was thinking I could use V8086 and use BIOS interrupts until I can write a USB driver to get this all working.
I am not the expert to be answering your questions about VFD and BIOS access -- but since nobody else answered:
I suspect that using a VFD would be the easiest solution. Using RealMode "thunks" and BIOS accesses would be second easiest, and V86 mode BIOS accesses would be third easiest, until you get a pmode USB driver completed. But all of those should work.
I have made some pretty significant changes to the wiki article, but I think it is nearly complete, and very accurate -- you may want to reread it to fix any misinformation from your first reading of it.