Page 1 of 1

Turn off the floppydrive

Posted: Mon Nov 05, 2007 11:37 am
by PHPnerd
Hello

The first problem with my OS is this:
when the kernel is loaded, and de os is working
correctly, the floppy drive is still reading.
How can I stop it and restart it when I need it?

Thanks in advance,
PHPnerd

Posted: Mon Nov 05, 2007 12:40 pm
by inflater
It's reading? i think only the motor is on :)
To shut it off, execute

mov dx,0x3F2
mov al,0
out dx,al

or if your OS is 16-bit, you can use BIOS (AX=0, INT 13h).

To read and write to the floppy, you must build your own driver and remap the PIC to get the correct IRQ (floppy PIO).
If your OS is 16-bit and you do not plan to use multitasking and protected mode, you can use BIOS (functions 02,03 on interrupt 13h will sure help you get started).
Or you can exit from pmode temporarily, do the BIOS int, and switch back. But this is somewhat more complicated. :)

Regards
inflater