Page 2 of 2
Re: Why is INT 0x13 AH=0x02 crashing?
Posted: Thu Apr 24, 2014 6:01 am
by Octocontrabass
Isaac wrote:Anything wrong with my DAP?
That depends. Where's the code to fill in the rest of it?
Re: Why is INT 0x13 AH=0x02 crashing?
Posted: Thu Apr 24, 2014 9:38 am
by iansjack
Isaac wrote:Anything wrong with my DAP?
Yes. Bytes 9-15 of it are undefined.
Re: Why is INT 0x13 AH=0x02 crashing?
Posted: Thu Apr 24, 2014 3:30 pm
by Isaac
I followed what they say on Wikipedia. Look:
http://en.wikipedia.org/wiki/INT_13H#IN ... From_Drive
The table shows that the last field in the DAP goes from 0x8-0xF. I filled in that field. Even though I didn't use up ALL the space, isn't it okay?
Re: Why is INT 0x13 AH=0x02 crashing?
Posted: Thu Apr 24, 2014 9:33 pm
by Octocontrabass
Isaac wrote:Even though I didn't use up ALL the space, isn't it okay?
You're missing some fundamental concepts of assembly programming.
If I do this:
Code: Select all
mov al, 5
mov [bx], al
mov ax, [bx]
What value will be stored to AX?
Re: Why is INT 0x13 AH=0x02 crashing?
Posted: Thu Apr 24, 2014 11:58 pm
by iansjack
Suppose that before you fill those 8 bytes they contain:
0xd 0x4 0x0 0x5 0x8 0x3 0x0 0x1
Now you write 0x2 to the first byte. What number does that 8-bit field (that says what sector you want to start reading at) now contain? And what are the chances that there is a sector of that number on your disk?
You have an uninitialized variable; that's one of the commonest bugs in programming. You need to write all 8 bytes of the number not just the least significant one. With a little simple debugging you would catch errors like this immediately.
Re: Why is INT 0x13 AH=0x02 crashing?
Posted: Sat Apr 26, 2014 9:31 pm
by Isaac
I fixed up my DAP:
Code: Select all
mov byte [bx],0x10
mov byte [bx+1],0x0
mov word [bx+2],4
mov dword [bx+4],0x9000
mov dword [bx+8],2
mov dword [bx+12],0
But it still prints an error message. Why is that?
Re: Why is INT 0x13 AH=0x02 crashing?
Posted: Sun Apr 27, 2014 12:01 am
by iansjack
I don't know. What error code is the BIOS call returning?
Re: Why is INT 0x13 AH=0x02 crashing?
Posted: Sun Apr 27, 2014 7:03 pm
by Isaac
I don't really know much about error codes. But the number returned in AH is 0x1.
Re: Why is INT 0x13 AH=0x02 crashing?
Posted: Mon Apr 28, 2014 12:09 am
by iansjack
Re: Why is INT 0x13 AH=0x02 crashing?
Posted: Mon Apr 28, 2014 12:13 am
by Octocontrabass
Ralf Brown's Interrupt List wrote:01h: invalid function in AH or invalid parameter
It sounds like there's still something wrong with the values being passed to int 0x13.
Re: Why is INT 0x13 AH=0x02 crashing?
Posted: Mon Apr 28, 2014 1:02 am
by iansjack
Or, possibly, the BIOS doesn't support the call. Less likely but it should be checked first.
Re: Why is INT 0x13 AH=0x02 crashing?
Posted: Tue Apr 29, 2014 4:16 pm
by Isaac
The BIOS supports the call. I just can't figure out what's wrong with my DAP.
Re: Why is INT 0x13 AH=0x02 crashing?
Posted: Tue Apr 29, 2014 9:37 pm
by thepowersgang
Could you please post the code that invokes the system call (not just the code that populates the DAP). Preferably in the form that you're compiling (not just cut+pasted from separate sections of code).
Re: Why is INT 0x13 AH=0x02 crashing?
Posted: Wed Apr 30, 2014 12:22 am
by Octocontrabass
Isaac wrote:I just can't figure out what's wrong with my DAP.
The DAP is not the only thing you need to check. Get in a debugger and make sure all of the values you're passing to int 0x13 are correct.
Re: Why is INT 0x13 AH=0x02 crashing?
Posted: Wed Apr 30, 2014 12:47 am
by iansjack
Isaac wrote:The BIOS supports the call. I just can't figure out what's wrong with my DAP.
How do you know? You haven't shown any code that tests this.
The DAP business is easy - use a debugger to inspect it just before you make the BIOS call. Is it what you expect it to be? And are your expectations correct?