INT13h Dilemma !

All off topic discussions go here. Everything from the funny thing your cat did to your favorite tv shows. Non-programming computer questions are ok too.
Post Reply
deph
Posts: 13
Joined: Sun Jun 22, 2008 6:04 am

INT13h Dilemma !

Post 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 ?
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Re: INT13h Dilemma !

Post 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.
Post Reply