[SOLVED] Problem with int 0x13 ah=0x48

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
Roman
Member
Member
Posts: 568
Joined: Thu Mar 27, 2014 3:57 am
Location: Moscow, Russia
Contact:

[SOLVED] Problem with int 0x13 ah=0x48

Post by Roman »

Today I decided to add boot device locator (should convert initial DL to ATA port number and master/slave bit).

This is code from my stage 2 bootloader:

Code: Select all

...
        xor eax, eax
        mov al, [edx] ; Restores DL.
        mov edx, eax
        mov ah, 0x48
        mov si, 0x500
        int 0x13
        jc disk_io_err

        cli ; Fake breakpoint for testing.
        hlt
...
But something goes wrong (carry flag sets).

EDIT: I am 100% sure it restores DL right.
Last edited by Roman on Thu Aug 28, 2014 12:24 pm, edited 1 time in total.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay
User avatar
iansjack
Member
Member
Posts: 4709
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Problem with int 0x13 ah=0x48

Post by iansjack »

Well, there are only two parameters, so one of them must be wrong. Either it's the buffer (which seems unlikely) or your 100% certainty is a little overconfident.

What does the error code tell you?

Edit: Of course, I'm assuming that you have checked that the BIOS supports the extensions. Again, the error code will help you here. It's the essential bit of information that you haven't given us.
User avatar
Roman
Member
Member
Posts: 568
Joined: Thu Mar 27, 2014 3:57 am
Location: Moscow, Russia
Contact:

Re: Problem with int 0x13 ah=0x48

Post by Roman »

iansjack wrote:Well, there are only two parameters, so one of them must be wrong. Either it's the buffer (which seems unlikely) or your 100% certainty is a little overconfident.

What does the error code tell you?

Edit: Of course, I'm assuming that you have checked that the BIOS supports the extensions. Again, the error code will help you here. It's the essential bit of information that you haven't given us.
It turned out, that memory at DS:SI must contain the size of the buffer.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay
Post Reply