Page 1 of 1

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

Posted: Thu Aug 28, 2014 11:13 am
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.

Re: Problem with int 0x13 ah=0x48

Posted: Thu Aug 28, 2014 12:06 pm
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.

Re: Problem with int 0x13 ah=0x48

Posted: Thu Aug 28, 2014 12:24 pm
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.