floppy in pmode
floppy in pmode
hello all, i've read so many tutorials about disks in pmode, but most if not all are just theory about dma and stuff does anyone have examples or know where to find them, thx
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:floppy in pmode
thx, but, his tutorial page is down or something, and his fdc.c is so far advanced its not helpful, mabey what i need is a tutoial with examples
-
- Member
- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:floppy in pmode
Tim's fdc.c is (to my knowledge, I've avoided looking at it since my last try) a mess to read despite being very far advanced : the main function full of NONONONO-Goto's, which make it very hard to read, to be honest.
I recommend you to carry out a search on this forum for either "floppy driver tutorial" or "fdc". Code Slasher f. ex. has published a very good FDC tutorial.
Other possibility is that you drop an eye to www.osdever.net - section "tutorials".
I recommend you to carry out a search on this forum for either "floppy driver tutorial" or "fdc". Code Slasher f. ex. has published a very good FDC tutorial.
Other possibility is that you drop an eye to www.osdever.net - section "tutorials".
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:floppy in pmode
well, those GOTO simply model the fact that you're stepping a state machine ... sometimes you have to wait for an IRQ before you can go on, and other times you simply go 'till the next state. As those steps are usually occuring from an IRQ handler.
The thing i find nice in Mobius driver is that the state machine captures all the context you need in the next interrupt so that it'll work nicely in a multithreaded environment ...
now, i agree it'll be overkill for a bootloader or something alike ...
The thing i find nice in Mobius driver is that the state machine captures all the context you need in the next interrupt so that it'll work nicely in a multithreaded environment ...
now, i agree it'll be overkill for a bootloader or something alike ...
Re:floppy in pmode
The Intel pdf has all the info you need: http://www.osdever.net/documents/82077A ... ?the_id=41
this along with code from bubach's site: http://bos.asmhackers.net/docs/floppy/
If you can not work out how to make a pmode floppy driver from all this info, you will be in big trouble, when you come to program things like usb etc.
this along with code from bubach's site: http://bos.asmhackers.net/docs/floppy/
If you can not work out how to make a pmode floppy driver from all this info, you will be in big trouble, when you come to program things like usb etc.
Re:floppy in pmode
Code Slasher's tutorial is also in my "collection": http://bos.asmhackers.net/docs/floppy/d ... torial.txt
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:floppy in pmode
http://www.osdev.org/osfaq2/index.php/FloppyDriver
here's a start... if you have valuable advice to spice it up ...
here's a start... if you have valuable advice to spice it up ...
Re:floppy in pmode
hmm... that is hard to understand, mabey my kernel needs more. does anyone know about a good dma tutorial ???
-
- Member
- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:floppy in pmode
@pype: well, the state machine paradigm is ok. I daresay, I might have overseen that. Nevertheless, it's a wee bit of an overkill for a noob to follow the goto's and check out the switch statements. One can learn by looking at this driver how to make something a state machine.
Actually, I think it's kinda monolithic - have looked at it again today , and I miss quite some splitting up in smaller tasks. There are some parts in the main functions (handle_io? and fdc_isr) which definitely could deserve functions of their own.
Hm ... ranting about coding style isn't really asked for, is it? It's just my 2 eurocent. *gg* and me being micro kernel spoiled would have made that fdc driver be a thread of its own receiving and replying messages.
Actually, I think it's kinda monolithic - have looked at it again today , and I miss quite some splitting up in smaller tasks. There are some parts in the main functions (handle_io? and fdc_isr) which definitely could deserve functions of their own.
Hm ... ranting about coding style isn't really asked for, is it? It's just my 2 eurocent. *gg* and me being micro kernel spoiled would have made that fdc driver be a thread of its own receiving and replying messages.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image
Re:floppy in pmode
what confused me on http://bos.asmhackers.net/docs/floppy/d ... torial.txt tutorial was it wasn't very portable
1.) what if my bios dosn't store data at that address
2.) my kernel doesn't have a "floppy_mailbox" what irq does the floppy use(well i now what it is sopose to)
but thx for the dma totorial not to much info, but still good.
1.) what if my bios dosn't store data at that address
2.) my kernel doesn't have a "floppy_mailbox" what irq does the floppy use(well i now what it is sopose to)
but thx for the dma totorial not to much info, but still good.
Re:floppy in pmode
based on http://inglorion.net/documents/tutorial ... ut/floppy/
how do you do dma in pmode ???:
void set_dma(char *buff, short size)
{
char page;
short offset;
// ??? buff address to page:offset ??? //
outport(0x0A, 6);
outport(0x0B, 70);
outport(0x0C, 1);
outport(0x04, offset | 0xFF);
outport(0x04, offset >> 4);
outport(0x81, page);
outport(0x0C, 1);
outport(0x05, size | 0xFF);
outport(0x05, size >> 4);
outport(0x0A, 2);
}
need help converting liner to p:o
p.s. does that mean only lower memory ???
how do you do dma in pmode ???:
void set_dma(char *buff, short size)
{
char page;
short offset;
// ??? buff address to page:offset ??? //
outport(0x0A, 6);
outport(0x0B, 70);
outport(0x0C, 1);
outport(0x04, offset | 0xFF);
outport(0x04, offset >> 4);
outport(0x81, page);
outport(0x0C, 1);
outport(0x05, size | 0xFF);
outport(0x05, size >> 4);
outport(0x0A, 2);
}
need help converting liner to p:o
p.s. does that mean only lower memory ???
Re:floppy in pmode
Which seems to be the case of fd1.. :-\1.) what if my bios dosn't store data at that address
Let me explain myself, it have worked fine for me to take the needed values from that address, it's just that when I tested yesterday with drive B in BOCHS, it looked like I got rubbish.
I have read that the BIOS is supposed to store another 11 bytes for drive B right after the first 11 ones. Either that text was wrong or BOCHS doesn't do that.
Either way, I'm beginning to think that keeping track of those values myself might be the best choice..
Over to your questions:
You can only use memory below the 16mb border for DMA transfers, thats becasue you specify the memory location with a (1 byte) number to a 64kb page.
So with that byte having a max value of 255, thats (255*64)/1024 =~ 16mb.
After that you can also start at an offset within that 64kb page, but I don't. I just use page 8 at offset 0 = address 0x80000.
Here's an example of how to set up DMA in pmode & C:
http://cvs.sourceforge.net/viewcvs.py/gazos/gazos/mem/dma.c?rev=1.1.1.1&view=auto
/ Christoffer
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:floppy in pmode
I was just wondering ... when exactly are we supposed to issue "recalibrate" or "seek" commands ? the "read data" and "read track" command all have a "cylinder number" parameter so will the controller seek to the correct track before trying to read ?
oh, and if you could check i made no mistake on FloppyDriver page on the FAQ ...
oh, and if you could check i made no mistake on FloppyDriver page on the FAQ ...