Floppy Disk I/O What's Wrong?
Floppy Disk I/O What's Wrong?
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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
I really need an answer to this... I can't really continue my OS without it..
Thanks in Advance,
Anon
Thanks in Advance,
Anon
RE:Floppy Disk I/O What's Wrong?
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.
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?
Thanks, but how do you set up interrupts and respond to them?
/\ |\ | /-\ |\ |
/--\ | \| \_/ | \|
/\ |\ | /-\ |\ |
/--\ | \| \_/ | \|
URGENT ANSWER NEEDED
I REALLY need an answer to this. It is halting progress on my OS.
Thanks in advance,
Anon
Thanks in advance,
Anon
AAAAAHHHHH
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
Anon
RE:AAAAAHHHHH
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
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
Hmmm... my mistake... that B and N key are right next to one another 
try UbixOS, instead of UnixOS ;p
HuntrCkr

try UbixOS, instead of UnixOS ;p
HuntrCkr
RE:Wheres UbixOS?
http://www.ubixos.com/
You'll need a cvs client though... the source code is only available through CVS...
You'll need a cvs client though... the source code is only available through CVS...
RE:Wheres UbixOS?
I used WinCVS as anonymous and it asked for a password and disconnected. How did you get in?
Anon
Anon
RE:Wheres UbixOS?
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
Not sure what you are doing wrong though? I'm new to WinCVS... very new

WinCVS = Garbage
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
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
Anon