Page 2 of 2

Re: How can I replace INT instruction ?

Posted: Tue May 17, 2011 4:57 pm
by raz0r
gerryg400 wrote:data_readBuffer must be a char [512]. Not a char.
In that code im trying to check if in the var data_readBuffer are the 256 bytes information of the harddisk.
Comments like this make me think that you are not really reading the documentation. There are 256 x 16-bit words to read. Not 256 bytes. Not even 512 bytes.

Also my personal opinion is that the code in the ATA/IDE tutorial should not be used if you want a reliable, maintainable driver. The ATA PIO mode article is better. You also need the real ATA specs.
Yes, data_readBuffer must be a char*, sorry.
I understood bad the documentation, thanks for the clarification.

Do you have any idea about what changes should I make in my code for put the information in data_readBuffer ?
I sent all ports that I need, I think that this step should not be very difficult.

Maybe Im not reading complete sectors... but how to.. :/

Re: How can I replace INT instruction ?

Posted: Tue May 17, 2011 5:16 pm
by gerryg400
Yes, data_readBuffer must be a char*, sorry.
Not

Code: Select all

char *
It must be an array big enough to hold a sector.

Re: How can I replace INT instruction ?

Posted: Tue May 17, 2011 5:27 pm
by gerryg400
Reading data from a hard-drive is not as simple as just reading from a port. It may work on some computers but not others, depending on the initial state of the device. That's why, in general, you need to write a complete driver to do it. You need to be able to reset the drive, wait for its status to change, optionally handle interrupts, check for and recover from errors, and more.

To see a basic working driver that is reasonably easy to understand, have a look at the public domain mmurtl IDE driver.

http://www.ipdatacorp.com/mmpd.html