Reading floppy using ports...

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.
Peter_Vigren

Reading floppy using ports...

Post by Peter_Vigren »

Anyone out there having a sample code in assembly (preferable nasm) that describes how to read from a floppy using ports (not with int 13h and preferable using DMA)??? I have read several but when I put them into a program it doesn't work at all... Please help me... I had planned to complete my floppy-routine before the summer holiday ends...

Best regards,
Peter Vigren *hopefull*
Thomas

Re: Reading floppy using ports...

Post by Thomas »

I write an OS myself and i was trying and trying to read ONE Fu**ing Sector from Disk. Now i finally did it. Its just a Demo and u will need to dump a special bootsector on the disk in order to use it...but if u want it mail me.
By the Way....doing the same thing in C is pretty shitty...
i cant find the error(s).... Statusregs look OK ... but no Data is Read...
Thomas

Re: Reading floppy using ports...

Post by Thomas »

and?....did it work/help ya?
Peter_Vigren

Re: Reading floppy using ports...

Post by Peter_Vigren »

To Thomas: Haven't had the time to try it yet...
To Chris Giese: The second link is broken...
Chris Giese

Re: Reading floppy using ports...

Post by Chris Giese »

Guest

Re:Reading floppy using ports...

Post by Guest »

I just wanted to know how do we determine the base port address of the floppy controller. I read that it is 'usually' 0x3f2. I just wanted to know how to get the actual base port address. Please help me.
Therx

Re:Reading floppy using ports...

Post by Therx »

[0] A good tutorial : here
[0] Chris those links are still broken but luckily I have a copy on my site : here

Pete
Guest

Re:Reading floppy using ports...

Post by Guest »

The base port address used for the controller is dependant on whether the controller is configured as the primary or secondary controller. This base address controls the port addresses used for each of the registers on the controller.
this still does not give me the info i need. how do i determine the base port address?
Tim

Re:Reading floppy using ports...

Post by Tim »

Hard-code it, but define it as a constant in case you come up with a better method of determining it later.

Code: Select all

#define FDC_BASE_ADDRESS 0x3f0
#define FLOPPY_IRQ 6
Guest

Re:Reading floppy using ports...

Post by Guest »

I just wanted to know if anyone had a good method of detrmining this?
Some algorithm perhaps.
Tim

Re:Reading floppy using ports...

Post by Tim »

It's hard-coded. On newer machines the address of the floppy controller might be decided by ACPI, but any machine where the floppy controller isn't at that address/IRQ can't call itself a PC compatible -- it won't run older OSes, and it won't run new ones without special drivers.
mr. xsism

Re:Reading floppy using ports...

Post by mr. xsism »

http://www.nondot.org/sabre/os/files/Disk/FLOPPY.TXT

Print that out as it will be very useful once you understand the basics. It lists the transfer of bytes needed for ops like seek, rebalicrating, reading, etc. Plus it gives ou the list of ports for the FDC
Slasher

Re:Reading floppy using ports...

Post by Slasher »

I know this isn't done with ports but it can help
http://www.mega-tokyo.com/forum/index.p ... 77;start=0
guest

Re:Reading floppy using ports...

Post by guest »

I'm having some trouble with the floppy driver. when i try to read a sector (0x66) i keep geting the value ST0=0x40 (error). I think this means that the index hole is passed twice. does anyone know why this happens and how it can be corrected?
Post Reply