HELP: int 13 extended read

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
Thanos

HELP: int 13 extended read

Post by Thanos »

Can someone pleaseeee help, I have been starring at this problem for a week now.

I am trying to use int 13 extended read AH=42 and most of the time it doesnt work unless I use specific values.
Basically LBA block 0 is loaded to 0x0000:0x7C00 and that code tries to read block 1 through n into memory address 0x1000:0x0000  all of this is in real mode by the way.

The problem I am having is that reading block 1 seems to just lock up.
The code in block 1 simply prints 'Hi' to the screen.  As a sanity check, instead of loading block 1 i load block zero to 0x1000:0x0000 and that seems to work fine because it successfully reads the harddrive and then correctly jumps to that seg:off.

Another problem I am having is that changing the # blocks to read from say 1 to something like 0x0f or 0x7f it also causes it to lock up...

My assembly for reading using int 13 is below,  any help would be greatly appreciated.

read:
   pusha
   movw     $0x0000, %ax
   pushw    %ax         # LBA Word 4
   pushw    %ax         # LBA Word 3
   pushw    %ax         # LBA Word 2
   movw     $0x0000, %ax
   pushw    %ax         # LBA Word 1
   movw     $0x1000, %ax
   pushw    %ax         # Target segment
   movw     $0x0000, %ax
   pushw    %ax         # Target offset
   movw     $0x0001, %ax
   pushw    %ax         # Blocks to read
   movw     $0x0010, %ax
   pushw    %ax         # Packet size
   movb     $0x80, %dl  # Drive number
   movw     %ss, %ax    #
   movw     %ax, %ds    #
   movw     %sp, %si    # ds:si pointing to packet
   movb     $0x42, %ah  # Int 13 Extended Read
   int      $0x13       # Read
   popa
   popa
   jnb      ret_read

message_int13_read_failed:
   leaw     string_int13_read_failed, %si
   call     print_string
   jmp      halt

ret_read:
   ret
Post Reply