How the floppy drive works?
Posted: Sun May 30, 2004 11:32 pm
Hi
i just join this forum
i wish to write my own OS and i guess i want to start it from creating a floppy disk boot copier like *(fdimage).
i can program in asm but i don't know how the floppy drive works
i already wrote the code but i heard loud sound when my program copy the data to floppy disk.
i put the data into floppy disk in this order
i copy the data into floppy disk SECTOR BY SECTOR.
eg. (*this is imaginary code for explanation purpose)
i am using int 13h function 3h to write my buffer into floppy disk.
so CH (Track Number) will increase value from 0 to 79
CL (Sector Number) will increase value from 1 to 18 and
DH (Head Number) will have 0 or 1.
my code will put the data straight away to the floppy disk once it reads from
the provided file. i wonder, should i park the floppy writer arm somewhere before i use it or ... ? coz i heard loud sound when my code runs and i not really yet wish to burn my floppy drive.
care to tell me where is wrong?
sincerely,
ThinkLogic.
i just join this forum
i wish to write my own OS and i guess i want to start it from creating a floppy disk boot copier like *(fdimage).
i can program in asm but i don't know how the floppy drive works
i already wrote the code but i heard loud sound when my program copy the data to floppy disk.
i put the data into floppy disk in this order
i copy the data into floppy disk SECTOR BY SECTOR.
eg. (*this is imaginary code for explanation purpose)
Code: Select all
; variable declaration
; ====================
$track???= 0 ;(accept value 0 to 79)
$head???= 0 ;(accept value 0 or 1)
$sector???= 1 ;(accept value from 1 to 18)
; convert submitted param into number and fill it into variables
; valid $track, $head and $sector values
; ==============================================================
; this is how i put the data into disk
; ====================================
for(!eof) {
???if($sector == 19) {
??????$head???+= 1;
??????$sector???= 0;
???} else $sector += 1;
???if($head == 2) {
??????$head???= 0;
??????$track???+= 1;
???}
???
???if($track == 80) exit();
???
???$floppyLocation = $track, $head, $sector;
???copy($floppyLocation, $currentBuffer512Byte); (interrupt 13h with function 3h)
}
so CH (Track Number) will increase value from 0 to 79
CL (Sector Number) will increase value from 1 to 18 and
DH (Head Number) will have 0 or 1.
my code will put the data straight away to the floppy disk once it reads from
the provided file. i wonder, should i park the floppy writer arm somewhere before i use it or ... ? coz i heard loud sound when my code runs and i not really yet wish to burn my floppy drive.
care to tell me where is wrong?
sincerely,
ThinkLogic.