Floppy Disk I/O What's Wrong?

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

Floppy Disk I/O What's Wrong?

Post 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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
anon

Please help

Post by anon »

I really need an answer to this... I can't really continue my OS without it..

Thanks in Advance,
Anon
bdjames

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

Post 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.
anon

How do you set up interrupts?

Post by anon »

Thanks, but how do you set up interrupts and respond to them?


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

URGENT ANSWER NEEDED

Post by anon »

I REALLY need an answer to this. It is halting progress on my OS.

Thanks in advance,
Anon
anon

AAAAAHHHHH

Post 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
HuntrCkr

RE:AAAAAHHHHH

Post 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
HuntrCkr

RE:AAAAAHHHHH

Post by HuntrCkr »

Hmmm... my mistake... that B and N key are right next to one another :D

try UbixOS, instead of UnixOS ;p

HuntrCkr
Anon

RE:AAAAAHHHHH

Post by Anon »

lol. I couldn't find much on UnixOS. :D

Anon
Anon

Wheres UbixOS?

Post by Anon »

BTW, wheres the site for UbixOS?

Anon
HuntrCkr

RE:Wheres UbixOS?

Post by HuntrCkr »

http://www.ubixos.com/

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

RE:Wheres UbixOS?

Post by Anon »

I used WinCVS as anonymous and it asked for a password and disconnected. How did you get in?

Anon
HuntrCkr

RE:Wheres UbixOS?

Post 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 :)
Anon

WinCVS = Garbage

Post 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
Anon

WinCVS = Garbage

Post 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
Post Reply