Page 1 of 2

Floppy Disk I/O What's Wrong?

Posted: Sat Jul 06, 2002 11:00 pm
by anon
The Code:

Uses NASM

This code is run in PMode

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov dx, 0x03F2
mov al, 00010100b
out dx, al ; turn motor on

mrqloopa:
mov dx, 0x03F4
in al, dx
and al, 0xC0
cmp al, 0x80
jne short mrqloopa

mov dx, 0x03F5
mov al, 00000011b
out dx, al ; set timings
mov al, 11110001b
out dx, al ; Step Rate (1ms) | Head Unload Time (16ms)
mov al, 00000011b
out dx, al ; Head Load Time (2ms) | non-DMA (true)

mrqloopb:
mov dx, 0x03F4
in al, dx
and al, 0xC0
cmp al, 0x80
jne short mrqloopb

mov dx, 0x03F5
mov al, 00001111b
out dx, al ; Seek
mov al, 00000000b
out dx, al ; x x x x x Head Dr1 Dr0
mov al, 00000000b
out dx, al ; Cylinder 0

mrqloopc:
mov dx, 0x03F4
in al, dx
and al, 0xC0
cmp al, 0x80
jne short mrqloopc

mov dx, 0x03F5
mov al, 00001000b
out dx, al ; Check Interrupt Status
in al, dx
test al, 80h
in al, dx
jnz short $

seek_ok:
mov dx, 0x03F5
mov al, 01000110b
out dx, al ; read sector
mov al, 00000000b
out dx, al ; x x x x x Head DR1 DR0
mov al, 0
out dx, al ; Cylinder
mov al, 0
out dx, al ; Head
mov al, 1
out dx, al ; Sector Number
mov al, 02h
out dx, al ; Sector Size (Bytes per Sector)
mov al, 18
out dx, al ; Track Length
mov al, 27
out dx, al ; Length of GAP3
mov al, 0FFh
out dx, al ; Data Length

mov ecx, 0

iloopa:
mov dx, 0x03F5
mov al, 00001000b
out dx, al ; Check Interrupt Status
in al, dx
test al, 80h
in al, dx
jnz short iloopa
in al, dx
inc ecx
inc ecx
mov byte [gs:0xB8000 + ecx], al
jmp short iloopa
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Please help

Posted: Sun Jul 07, 2002 11:00 pm
by anon
I really need an answer to this... I can't really continue my OS without it..

Thanks in Advance,
Anon

RE:Floppy Disk I/O What's Wrong?

Posted: Mon Jul 08, 2002 11:00 pm
by bdjames
I believe it not enough to just check the interrupt flag, you
must respond to it. So without setting up interrupts, you can only do
one op. If you are trying to get the sector after the bootloader in the bootloader
then you do not need to seek, you are there.

How do you set up interrupts?

Posted: Mon Jul 08, 2002 11:00 pm
by anon
Thanks, but how do you set up interrupts and respond to them?


/\  |\ |  /-\  |\ |
/--\ | \|  \_/  | \|

URGENT ANSWER NEEDED

Posted: Wed Jul 10, 2002 11:00 pm
by anon
I REALLY need an answer to this. It is halting progress on my OS.

Thanks in advance,
Anon

AAAAAHHHHH

Posted: Sat Jul 13, 2002 11:00 pm
by anon
I really need to know how to read/write (non-DMA) to a floppy disk using ports. Any sample code would be helpful as well as floppy disk controller and interrupts info (how do you set them up and use them?).

Anon

RE:AAAAAHHHHH

Posted: Thu Jul 18, 2002 11:00 pm
by HuntrCkr
Anon,

Grab a copy of the UnixOS source code. This really helped me figure out the FDC and reading and writing to the disk. Unfortunately, this code uses DMA, so if this is a big problem, you might have to look elsewhere

Hope it helps :)
   HuntrCkr

RE:AAAAAHHHHH

Posted: Thu Jul 18, 2002 11:00 pm
by HuntrCkr
Hmmm... my mistake... that B and N key are right next to one another :D

try UbixOS, instead of UnixOS ;p

HuntrCkr

RE:AAAAAHHHHH

Posted: Thu Jul 18, 2002 11:00 pm
by Anon
lol. I couldn't find much on UnixOS. :D

Anon

Wheres UbixOS?

Posted: Thu Jul 18, 2002 11:00 pm
by Anon
BTW, wheres the site for UbixOS?

Anon

RE:Wheres UbixOS?

Posted: Thu Jul 18, 2002 11:00 pm
by HuntrCkr
http://www.ubixos.com/

You'll need a cvs client though... the source code is only available through CVS...

RE:Wheres UbixOS?

Posted: Thu Jul 18, 2002 11:00 pm
by Anon
I used WinCVS as anonymous and it asked for a password and disconnected. How did you get in?

Anon

RE:Wheres UbixOS?

Posted: Fri Jul 19, 2002 11:00 pm
by HuntrCkr
Well, I just put in the address as it is specified on the website as the CVSROOT for the Checkout, and as for the module to checkout, I just enter ubixos. then it works on mine...

Not sure what you are doing wrong though? I'm new to WinCVS... very new :)

WinCVS = Garbage

Posted: Fri Jul 19, 2002 11:00 pm
by Anon
WinCVS = Garbage... I deleted it and got a new one from download.com (not WinCVS) and it worked... I'm gonna chack out the sources now...

Anon

WinCVS = Garbage

Posted: Fri Jul 19, 2002 11:00 pm
by Anon
WinCVS = Garbage... I deleted it and got a new one from download.com (not WinCVS) and it worked... I'm gonna check out the sources now...

Anon