Page 1 of 1

Question about FDC

Posted: Wed Sep 01, 2004 11:40 pm
by Jathenal
Hi all!
Is there somebody who knows about some datasheet or document about the Floppy disk controller?
I'm developping a tiny os,go on with the floppy driver in protected mode,but knows poor about FDC.
Other question is,can I use the int13 in the protected mode,or V86 mode,or fast switching to real mode,then call int13,and fast return to protected mode,does it invokable?
Give me some suggestion please,thanx all!

by the way,where is the region of the forum?
I comes from China,this is my 1st time visiting the forum.
Does this forum support easten characters?
中文字体测试

Re:Question about FDC

Posted: Thu Sep 02, 2004 3:07 am
by Pype.Clicker
there should be plenty of such datasheet in both OSRC (if recovered) and BonaFide. You may get links either through .:QuickLinkz:. or via the WikiFAQ (click the banner)

You may not call INT13 directly from pmode. You should either set up a full V86 monitor or turn back in real mode for the operation. But the question is why do you want to use INT13 after the pmode switch ? can't you anticipate the need for I/O and do them while you're still in realmode ? ...

Actually, using V86 (or realmode) for disk I/O is not a good idea, since you'll have to find workaround for the DMA, will suffer from CPU consumed by idle waiting while your pmode code could have switched to another task, etc.

And no, the board doesn't support kanjii characters, as it's meant to be a english-speaking board (despite the 'mega-tokyo' name ;) ...

Re:Question about FDC

Posted: Thu Sep 02, 2004 6:00 am
by Jathenal
Thanx for the comment of moderator Pype.Clicker.
And excuse me for my poor english ;D

I also think programming the FDC with I/O in the protected mode is the best method.
But I even know nothing about the FDC and I've no enough time now.

(The situation is that... ooops,You can just skip the useless explanation...
I'm a college student and my exam project of this term is "Design a simple OS",the least requirement of the OS is support or demo the function of "Multiple task","Standard Char I/O","Dynamic memory manage" and "Fat12 system".
At first I wrote the OS in real mode with the 16bits ASM of x86.As we know,the real mode programming is simply and easily understandable.When I was about to finish it,I found that all of the other classmates wrote the OS in 32bits ASM or C ???,then I found the LAST requirement of the OS is "Running in Protected Mode"...... :o :o :o)

So I need to re-write all the OS code in protect mode,that's really a terrible thing.
The bigger trouble is that original Fat12 System is based on the INT13,but I found is seems to be unavailable in protected mode now.

I found some reference of the FDC programming like below:
http://debs.future.easyspace.com/Progra ... loppy.html
But I couldn't understand it accurately because my poor brain and poor english. :-\
I'm familiar with the 16bits ASM,so I have an idea of call INT13 by switch mode,for example of Read Floppy Disk:

SysIntCall_xx(Pmode) -> Read IDT -> Int-Routine ->Set buffers and save Regs to 16bits -> Switch to Rmode -> Int13 -> Switch to Pmode -> Read data from buffers -> Return of IntCall

It may cause minimal change of the code if the param of the SysIntCall_xx is compatible with the INT13 as current situation,I guess.

Does it sounds to be practical? What's the best solution under current situation?
Sincerely expect for everyone's suggestion.Thanx again!

Re:Question about FDC

Posted: Thu Sep 02, 2004 8:51 am
by Pype.Clicker
maybe you should ask your teacher, but you could do FAT12 support on an in-ram image of the floppy rather than directly on the floppy ...

Re:Question about FDC

Posted: Thu Sep 02, 2004 8:57 am
by Curufir
Pype.Clicker wrote: maybe you should ask your teacher, but you could do FAT12 support on an in-ram image of the floppy rather than directly on the floppy ...
lmao.

Sneaky, very sneaky.

Re:Question about FDC

Posted: Sat Sep 04, 2004 11:40 pm
by Jathenal
Well,my last solution is "Copy&Paste" from my classmate's code.
Hehe,I hope my teacher won't exam the code carefully enough...

But I'm interest in the "FAT12 support on an in-ram image",I wonder to know what does it mean?

Re:Question about FDC

Posted: Sun Sep 05, 2004 12:38 pm
by Pype.Clicker
Jathenal wrote: Well,my last solution is "Copy&Paste" from my classmate's code.
Hehe,I hope my teacher won't exam the code carefully enough...
Being some examinator myself (not of your stuff, of course, but still), i have to discourage you strongly ... it's usually quite easy to identify similarities in codes, even only by similarities in bugs ...
But I'm interest in the "FAT12 support on an in-ram image",I wonder to know what does it mean?
Let's say you make your real-mode loader read *all* the content of the floppy and put it at some well-known (by you) location. Then you can read the files and do the FAT12 stuff on top of a ramdisk: when you ask the ramdisk for a block, it gets it from the image in RAM rather than loading the sector from the disk ...

Now, maybe the Floppy disk programming tutorials would become easier to understand with a basic tutorial about floppies (CHS addressing, FAT structure and things alike) and another basic tutorial about DMA (what it is, how it works, etc)