flat assembler
Message board for the users of flat assembler.

Index > DOS > Interrupt 13h

Author
Thread Post new topic Reply to topic
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat 07 Dec 2006, 01:13
Hey, I'm wondering, I want to access my hard disk using int 13h, and I read on RB's Int list that bit 7 (or eight, depending on if you start counting with 0 or 1) is set for the hard disk. Does that mean that I'd put in 80h to access the hard disk?

-Rhyno
Post 07 Dec 2006, 01:13
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 07 Dec 2006, 01:31
Setting DL to 80 you access the first HDD. Note that this DOES NOT work under WinNT/2000/XP but it's OK on Win9x/Me (and in DOS and boot codes of course).
Post 07 Dec 2006, 01:31
View user's profile Send private message Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat 07 Dec 2006, 01:43
Dang, so that's why I'm getting that error. What I'm trying to do is access the MBR, read from it, and print out the results. I get 10 extra credit points in my computer science class if I can do it. Another way I'm thinking of doing it is setting the segment to 0000 and the offset of that to 7C00h and reading from there. But one thing that confuses me about that is I read on this site shown below that the MBR changes places to 0600h after it loads. Is that true for all of it or just part of it?

Here's the site:
http://www.ata-atapi.com/hiwdos.htm

And thanks for the help!
Post 07 Dec 2006, 01:43
View user's profile Send private message Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 557
smiddy 07 Dec 2006, 02:18
It is true that some OS' do change the segment to 0060h or linear 600h. They do this by moving their loaded code from 7C00h to 0600h and thus jumping to that segment (realmode 60:0000h). But a blank 1st sector shouldn't be moving code from 7C00h to 0600h. An example can be found here in the file bootE820.ASM. It shows how it happens. The reason for this is to get your code as close to the bottom of useable real memory as possible. Potentially, you could start your code at 0:0h, but you would have to do a lot of things to ensure the system doesn't crash since there is the IVT down there, but it is do-able.
Post 07 Dec 2006, 02:18
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 07 Dec 2006, 02:19
MBR code relocates itself because it has to load to 7C00h the boot code of the active partition and jump to it. If I'm remember right 600h is the first address free to be used and lower addresses contain BIOS data and the interrupt vector table so that could be a good reason of why that address is typically choose.

Now I don't understand what are you doing, a boot code that when gets booted it reads the MBR from first HDD and prints it out?

PS: Note that my warnings was that NT-like Windowses will stop your program showing you a message box telling that your program is attempting to access the hard disk and it's not allowed (and with buttons "Close" and "Ignore").

[edit]Sorry Smiddy, when I was writing your post didn't exist yet.[/edit]
Post 07 Dec 2006, 02:19
View user's profile Send private message Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat 07 Dec 2006, 02:53
Loco, yeah, I think I got it working though, I'm now directlyh dealing with segment 0000h and offset 7C00h and printing out the values from there. I also tried seg 0000h and offset 0600h and it showed the same, therefore I think I got it right. Thank you all!
Post 07 Dec 2006, 02:53
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.