Page 2 of 2

Re: Problem with CALIBRATE and SEEK commands

Posted: Thu Dec 10, 2009 9:26 pm
by oib111
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:

Code: Select all

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);
	}
}

Re: Problem with CALIBRATE and SEEK commands

Posted: Fri Dec 11, 2009 3:53 pm
by bewing
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.

Re: Problem with CALIBRATE and SEEK commands

Posted: Fri Dec 11, 2009 8:29 pm
by oib111
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.

Re: Problem with CALIBRATE and SEEK commands

Posted: Wed Dec 23, 2009 8:25 pm
by bewing
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.

Re: Problem with CALIBRATE and SEEK commands

Posted: Wed Dec 23, 2009 8:38 pm
by oib111
I think I may just use V86 since it will probably come in handy later. I'll reread the article when I have a chance. Thanks for all your help :)