Page 1 of 1

INT13h Dilemma !

Posted: Wed Jul 23, 2008 1:57 am
by deph
Here is something strange !
- I implemented a bootloader, which reads from disk using INT13 AH=08.
Code looks something like this:

Code: Select all

        xorw    %bx           , %bx
        movw    $STAGE2_SEG   , %ax
        movw    %ax           , %es
        movb    $0x02         , %ah
        movb    $STAGE2_SECTORS, %al
        movb    $0            , %ch
        movb    $2            , %cl
        movb    $0            , %dh
        int     $0x13
STAGE2_SECTORS is a macro, defined at 25 (size in blocks of stage2) ... On Bochs this works fine, but when I boot my computer using a floppy, the function fails, setting CF;
This is strange, because, I've seen that other bootloaders read one sector at a time, using loops for reading consecutive sectors. Should I read sectors that way too ?

Re: INT13h Dilemma !

Posted: Wed Jul 23, 2008 3:04 am
by bewing
Many (perhaps most) BIOSes will not allow you to cross a track boundary with an INT13h command.
There are 18 sectors in a track on a 1.44M floppy. If you start at sector 1, you can read 18 sectors. If you start at sector 10, you can read 9 sectors. Then you have to do another read, starting at sector 19, if you want to read more.