Floppy Detection? Ports?
Posted: Fri Jan 10, 2003 12:30 am
my question is about a specfic piece of code, but it expands out to other questions. This code here:
detects floppys, works well and everything, but what I was wondering is HOW does it know its a floppy and the type? i know this line:
outportb(0x70, 0x10);
does that, but how do we know that 0x70 and 0x10 are the ports to look at? is there a list of these ports? I'm just kinda lost about the whole port thing, any help would be so grateful!
thanks in advance
Code: Select all
void detect_floppy(char *f0, char *f1)
{
u8bit type;
char *floppy_type[] = { "no floppy drive",
"360kb 5.25in floppy drive",
"1.2mb 5.25in floppy drive",
"720kb 3.5in",
"1.44mb 3.5in",
"2.88mb 3.5in" };
outportb(0x70, 0x10); // get floppy type for drive a/b
type = inportb(0x71); // get type
strcpy(f0, floppy_type[(type >> 4)]);
strcpy(f1, floppy_type[(type & 0xF)]);
}outportb(0x70, 0x10);
does that, but how do we know that 0x70 and 0x10 are the ports to look at? is there a list of these ports? I'm just kinda lost about the whole port thing, any help would be so grateful!
thanks in advance