Problem with stack based implementation of function 0x42 of int 0x13

Posted by IceCoder on Stack Overflow See other posts from Stack Overflow or by IceCoder
Published on 2010-06-17T21:41:16Z Indexed on 2010/06/17 22:33 UTC
Read the original article Hit count: 447

Filed under:
|
|
|
|

I'm trying a new approach to int 0x13 (just to learn more about the way the system works): using stack to create a DAP..

Assuming that DL contains the disk number, AX contains the address of the bootable entry in PT, DS is updated to the right segment and the stack is correctly set, this is the code:

push DWORD 0x00000000
add ax, 0x0008
mov si, ax
push DWORD [ds:(si)]
push DWORD 0x00007c00
push WORD 0x0001
push WORD 0x0010
push ss
pop ds
mov si, sp
mov sp, bp
mov ah, 0x42
int 0x13

As you can see: I push the dap structure onto the stack, update DS:SI in order to point to it, DL is already set, then set AX to 0x42 and call int 0x13

the result is error 0x01 in AH and obviously CF set. No sectors are transferred. I checked the stack trace endlessly and it is ok, the partition table is ok too.. I cannot figure out what I'm missing...

This is the stack trace portion of the disk address packet:

   0x000079ea:    10 00   adc    %al,(%bx,%si)
   0x000079ec:    01 00   add    %ax,(%bx,%si)
   0x000079ee:    00 7c 00   add    %bh,0x0(%si)
   0x000079f1:    00 00   add    %al,(%bx,%si)
   0x000079f3:    08 00   or     %al,(%bx,%si)
   0x000079f5:    00 00   add    %al,(%bx,%si)
   0x000079f7:    00 00   add    %al,(%bx,%si)
   0x000079f9:    00 a0 07 be   add    %ah,-0x41f9(%bx,%si)

I'm using qemu latest version and trying to read from hard drive (0x80), have also tried with a 4bytes alignment for the structure with the same result (CF 1 AH 0x01), the extensions are present.

© Stack Overflow or respective owner

Related posts about x86

Related posts about interrupt