How to rw harddisk in pmode?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
raz0r
Posts: 19
Joined: Sat Apr 30, 2011 6:02 pm

How to rw harddisk in pmode?

Post 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.
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: How to rw harddisk in pmode?

Post 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 ?
If a trainstation is where trains stop, what is a workstation ?
TylerH
Member
Member
Posts: 285
Joined: Tue Apr 13, 2010 8:00 pm
Contact:

Re: How to rw harddisk in pmode?

Post by TylerH »

raz0r
Posts: 19
Joined: Sat Apr 30, 2011 6:02 pm

Re: How to rw harddisk in pmode?

Post 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)
raz0r
Posts: 19
Joined: Sat Apr 30, 2011 6:02 pm

Re: How to rw harddisk in pmode?

Post 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...
Post Reply