Turn off the floppydrive

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.
Post Reply
PHPnerd
Member
Member
Posts: 34
Joined: Mon Nov 05, 2007 11:15 am
Location: The Netherlands
Contact:

Turn off the floppydrive

Post 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
Jinix
User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Post 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
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
Post Reply