Page 1 of 1

How to rw harddisk in pmode?

Posted: Wed May 11, 2011 8:16 pm
by raz0r
Hi,

I'm trying to develop an IDE/ATA Driver for my OS and I need write and read byte/word in the harddisk (very easy. I don't need access to the FAT, I only need write a byte and read that byte).

The question is how to rw in pmode? any simple example? I cant use ints 13h, etc.
I read this thread and I tested the asm code: http://forum.osdev.org/viewtopic.php?t=12268 but it uses int13h, int 20h, etc.

Im using nasm / ansi c / bochs
(standard intel instructions)

PD: I also read that I could switch to real mode, but its very slow.

Re: How to rw harddisk in pmode?

Posted: Wed May 11, 2011 8:52 pm
by gerryg400
raz0r wrote:Hi,

I'm trying to develop an IDE/ATA Driver for my OS and I need write and read byte/word in the harddisk (very easy. I don't need access to the FAT, I only need write a byte and read that byte).

The question is how to rw in pmode? any simple example? I cant use ints 13h, etc.
I read this thread and I tested the asm code: http://forum.osdev.org/viewtopic.php?t=12268 but it uses int13h, int 20h, etc.

Im using nasm / ansi c / bochs
(standard intel instructions)

PD: I also read that I could switch to real mode, but its very slow.
Do you mean you only need to read and write a single byte/word ? Or are you trying to write a complete driver ?

Re: How to rw harddisk in pmode?

Posted: Wed May 11, 2011 9:08 pm
by TylerH

Re: How to rw harddisk in pmode?

Posted: Thu May 12, 2011 6:14 am
by raz0r
Gerry, I need only read/write byte/word. Im trying to develop very simple driver with that only 2 functions.

Tyler, I read that page but the ATA Driver Example dont works in bochs (read the "Comments" at the end of the page)

Re: How to rw harddisk in pmode?

Posted: Thu May 12, 2011 2:24 pm
by raz0r
berkus wrote:
raz0r wrote:Gerry, I need only read/write byte/word. Im trying to develop very simple driver with that only 2 functions.
Disk drive is a block device, you cannot read/write single bytes.
yep, rw a simple block... (I think that ill complete with 0).
do you know any simple method for do this in pmode?

...or how can i switch to realmode for execute int 13h...