Reading from the hard drive
Posted: Wed Nov 21, 2007 11:24 am
Hello.
I have found tutorials on how to read from a hard drive. My code does read something (not sure if that is what it should read) but I wanted to ask about one parameter sent to port 0x1F6. For giving a request I have this code:
I am not sure what should be passed on instead of DRIVE. All I know is that it is called 'drive indicator'. What does that mean?
Also, what data types should be used for each variable? sectors, DRIVE and block_addr.
Thanks![/i]
I have found tutorials on how to read from a hard drive. My code does read something (not sure if that is what it should read) but I wanted to ask about one parameter sent to port 0x1F6. For giving a request I have this code:
Code: Select all
outportb(0x1F1, 0x00);
outportb(0x1F2, sectors);
outportb(0x1F3, (unsigned char)(block_addr));
outportb(0x1F4, (unsigned char)(block_addr>> 8));
outportb(0x1F5, (unsigned char)(block_addr>> 16));
outportb(0x1F6, 0xE0 | (DRIVE << 4) | ((block_addr>> 24) & 0x0F));
outportb(0x1F7, 0x20);
Also, what data types should be used for each variable? sectors, DRIVE and block_addr.
Thanks![/i]