That depends. Where's the code to fill in the rest of it?Isaac wrote:Anything wrong with my DAP?
Why is INT 0x13 AH=0x02 crashing?
-
- Member
- Posts: 5604
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Why is INT 0x13 AH=0x02 crashing?
Re: Why is INT 0x13 AH=0x02 crashing?
Yes. Bytes 9-15 of it are undefined.Isaac wrote:Anything wrong with my DAP?
Re: Why is INT 0x13 AH=0x02 crashing?
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?
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?
-
- Member
- Posts: 5604
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Why is INT 0x13 AH=0x02 crashing?
You're missing some fundamental concepts of assembly programming.Isaac wrote:Even though I didn't use up ALL the space, isn't it okay?
If I do this:
Code: Select all
mov al, 5
mov [bx], al
mov ax, [bx]
Re: Why is INT 0x13 AH=0x02 crashing?
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.
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?
I fixed up my DAP:
But it still prints an error message. Why is that?
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
Re: Why is INT 0x13 AH=0x02 crashing?
I don't know. What error code is the BIOS call returning?
Re: Why is INT 0x13 AH=0x02 crashing?
I don't really know much about error codes. But the number returned in AH is 0x1.
-
- Member
- Posts: 5604
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Why is INT 0x13 AH=0x02 crashing?
It sounds like there's still something wrong with the values being passed to int 0x13.Ralf Brown's Interrupt List wrote:01h: invalid function in AH or invalid parameter
Re: Why is INT 0x13 AH=0x02 crashing?
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?
The BIOS supports the call. I just can't figure out what's wrong with my DAP.
- thepowersgang
- Member
- Posts: 734
- Joined: Tue Dec 25, 2007 6:03 am
- Libera.chat IRC: thePowersGang
- Location: Perth, Western Australia
- Contact:
Re: Why is INT 0x13 AH=0x02 crashing?
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).
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
-
- Member
- Posts: 5604
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Why is INT 0x13 AH=0x02 crashing?
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.Isaac wrote:I just can't figure out what's wrong with my DAP.
Re: Why is INT 0x13 AH=0x02 crashing?
How do you know? You haven't shown any code that tests this.Isaac wrote:The BIOS supports the call. I just can't figure out what's wrong with my DAP.
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?