drive access

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
User avatar
Woellchen
Posts: 19
Joined: Sat Apr 26, 2008 1:19 pm

drive access

Post by Woellchen »

hi
my problem is the following:
i have a kernel in protected mode written in c
my question is how to access to the drives like floppy and hard disk because i cant use int 13h anymore as you know
is there any address like 0xB8000 for the video memory?
i hope you can help me
thanks
svdmeer
Member
Member
Posts: 87
Joined: Tue May 06, 2008 9:32 am
Location: The Netherlands

Post by svdmeer »

With a segment selector and pagetable pointing to physical address b8000 you can access textmode-memory. With physical address a0000 you can access graphics memory.
User avatar
Woellchen
Posts: 19
Joined: Sat Apr 26, 2008 1:19 pm

Post by Woellchen »

..my question was how to access a floppy or a hard drive..
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post by pcmattman »

You can't access disks at a memory address, because even for the text framebuffer it's all MMIO (memory mapped i/o) and there isn't any mapping for hard disks or floppy drives (because they're custom additions to the system).

You need to use CPU ports (at least, you do on x86) to talk to the hard disk or floppy drive - I highly suggest getting the ATA specification and googling for floppy drivers (I'm pretty sure the wiki has something on the floppy drive).
User avatar
Woellchen
Posts: 19
Joined: Sat Apr 26, 2008 1:19 pm

Post by Woellchen »

so in fact i have to use the out and in functions in assembler?
its the only thing i want to know because i didnt know that
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Post by neon »

Basically, yes.

btw, out and in are instructions not functions.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Post by bewing »

Here is the wiki page I wrote, with instructions on the simplest method of how to use a hard disk, once you are not using the BIOS anymore.
http://www.osdev.org/wiki/ATA_PIO_Mode

Good luck.
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

Post Reply