Floppy Disk Controller's Main Status Register

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.
Post Reply
User avatar
XCHG
Member
Member
Posts: 416
Joined: Sat Nov 25, 2006 3:55 am
Location: Wisconsin
Contact:

Floppy Disk Controller's Main Status Register

Post by XCHG »

Do we have to have a TIMEOUT for the MRQ bit (Bit #7) in the MSR of the Floppy Disk Controller to become 1 before attempting to reset the drive? I'd appreciate your responses.
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

Do you mean this

Code: Select all

 ;----------------------------------------------------;
 ; FdcSendByteReady   ;floppy control  sendbyte ready ;
 ;----------------------------------------------------;

FdcSendByteReady:
        push  eax
        push  edx
        mov   [Timer],30 	                        ; 20 = about 1 second,we use (1.5 seconds).
        mov   [TimerOn],1                               ; start couting.
FdcSendByteReadyLoop:
        mov   al,[TimerOn]                              ; we test if
	or    al,al                                     ; timeout is up yet?.
        jz    FdcSendByteReadyError                     ; if it is we exit,with error.
        mov   dx,MsReg                                  ; check status reg
        in    al,dx
        and   al,11000000b
        cmp   al,10000000b                              ; are we ok to write
        jnz   FdcSendByteReadyLoop                      ; if not do another loop.
        pop   edx
        pop   eax
        clc                                             ; we end here if we write:-)
	ret

FdcSendByteReadyError:                                  ; we end up here if we run out of time:-(.
        pop   edx
        pop   eax
        stc
        ret
example from DexOS floppy driver, if so then yes, but you just return with error and error-code, then like in int 13h, you should try to read/write 3 times, with a reset.
User avatar
XCHG
Member
Member
Posts: 416
Joined: Sat Nov 25, 2006 3:55 am
Location: Wisconsin
Contact:

Post by XCHG »

Thank you Dex, that code really helped me understand some points. My question now is that when I attempt to send the Fix Drive Data command to th FDD, I get this error message by Bochs:
Bochs wrote:write 0x03f5: receiving new command 0x03, old one (0x08) pending
Well command 0x08 is for Check Interrupt Status which I have sent before Fix Drive Data but what does that message mean. Does it mean that the FDD has not yet processed my first command? Do I have to wait for a certain amount of time before it processes my request?

Thanks in advance.
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

Here is my full floppy code it is commented to go with the per-do code in the Intel floppy controller pdf.

Also try to do has much testing on real floppy drives, because alot of time it works OK in emulators, but not on real PC, eg: delays are more important on real floppy drives than emulators.
Attachments
Fdd.asm
(31.23 KiB) Downloaded 50 times
FddInfo.asm
(2.25 KiB) Downloaded 51 times
DMA.asm
(6.94 KiB) Downloaded 21 times
User avatar
XCHG
Member
Member
Posts: 416
Joined: Sat Nov 25, 2006 3:55 am
Location: Wisconsin
Contact:

Post by XCHG »

Thank you so much Dex. I think for now there is something much more important for me to implement in my kernel which is paging. Then I will be able to use DMA and thus implement the floppy driver.
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Post by bubach »

Pages as referred to in the DMA code is more like real mode segments and has nothing to do with paging. DMA code works fine without paging enabled, all you have to do is chose an address below 16mb for DMA buffer.
Last edited by bubach on Wed Mar 28, 2007 10:58 am, edited 1 time in total.
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

Bubach is right, the word paging in DMA is miss leading and has nothing to do with paging as in the normal pmode sense.
DexOS has not got paging enabled, but DexOS floppy driver users DMA.
So you should be fine :) .
User avatar
XCHG
Member
Member
Posts: 416
Joined: Sat Nov 25, 2006 3:55 am
Location: Wisconsin
Contact:

Post by XCHG »

Well then that's awesome. Thank you guys. Appreciations.
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
Post Reply