| | |
Controlling Floppy Disk Head using C
Thread Solved
![]() |
•
•
Join Date: Dec 2008
Posts: 7
Reputation:
Solved Threads: 0
Hi All,
I am researching writing a program in C that will allow me to control the read/write on a FDD and then to move onto HDD's. I have been given some code that will allow me to do this by one of my lecturers but uses the DOS.H library which the commands for controlling and storing data in the general purpose registers AH,AL,CX and DX are now redundant as i understand they were not carried forward onto 32-bit processor architecture for whatever reason.
While trying to look for a solution to this i noticed something about using Assembler code within the C (inline) to control the registers but i am wondering what is the best way to go about doing this. I am not looking for a program that already does this as it would defeat the point and not aid in my understanding.
If i were to use assembler code within the C would i be able pass through values that would allow me to write a file from a hard disk into specific sectors on a floopy? For the project i'm doing i cannot use the standard fwrite or fprintf functions available because i need to do it without the file system (FAT) being corrupted. Any help or links would be greatly appreciated.
Thanks,
Dinklebaga
I am researching writing a program in C that will allow me to control the read/write on a FDD and then to move onto HDD's. I have been given some code that will allow me to do this by one of my lecturers but uses the DOS.H library which the commands for controlling and storing data in the general purpose registers AH,AL,CX and DX are now redundant as i understand they were not carried forward onto 32-bit processor architecture for whatever reason.
While trying to look for a solution to this i noticed something about using Assembler code within the C (inline) to control the registers but i am wondering what is the best way to go about doing this. I am not looking for a program that already does this as it would defeat the point and not aid in my understanding.
If i were to use assembler code within the C would i be able pass through values that would allow me to write a file from a hard disk into specific sectors on a floopy? For the project i'm doing i cannot use the standard fwrite or fprintf functions available because i need to do it without the file system (FAT) being corrupted. Any help or links would be greatly appreciated.
Thanks,
Dinklebaga
Conceptually, you'll need 4 files.
main.c - the portable part of your application, and #includes port.h
port.h - your abstracted interface to your floppy, with say move_head(int track);
port_win32.c - implements move_head(int track) and the rest of the API, for win32
port_linux.c - implements move_head(int track) and the rest of the API, for linux. If possible, try to do this using the POSIX API as much as possible. It'll save time when moving to other POSIX systems.
When you build a system, you choose (in your project / makefile) the appropriate port_xxx.c for the environment in which you're working.
Do you have specific questions for specific platforms still?
main.c - the portable part of your application, and #includes port.h
port.h - your abstracted interface to your floppy, with say move_head(int track);
port_win32.c - implements move_head(int track) and the rest of the API, for win32
port_linux.c - implements move_head(int track) and the rest of the API, for linux. If possible, try to do this using the POSIX API as much as possible. It'll save time when moving to other POSIX systems.
When you build a system, you choose (in your project / makefile) the appropriate port_xxx.c for the environment in which you're working.
Do you have specific questions for specific platforms still?
![]() |
Other Threads in the C Forum
- Previous Thread: changing color of a pushbutton on a dialog box
- Next Thread: Need Help..!!
| Thread Tools | Search this Thread |
* adobe api array asterisks binarysearch calculate changingto char character cm copyanyfile copyimagefile copypdffile creafecopyofanytypeoffileinc createcopyoffile createprocess() csyntax database directory feet fgets file floatingpointvalidation forloop frequency function givemetehcodez global grade gtkgcurlcompiling gtkwinlinux hacking highest histogram homework i/o infiniteloop input interest intmain() iso kernel keyboard kilometer km linked linkedlist linux looping loopinsideloop. lowest meter microsoft mqqueue mysql number oddnumber odf open openwebfoundation owf pdf performance posix power probleminc process programming pyramidusingturboccodes radix read recv recvblocked repetition research reversing scheduling segmentationfault send sequential single socket socketprogramming stack standard string suggestions systemcall threads turboc unix urboc user variable wab whythiscodecausesegmentationfault win32api windows.h windowsapi






