int 13 extensions problem

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
johnsa
Member
Member
Posts: 296
Joined: Mon Oct 15, 2007 3:04 pm

int 13 extensions problem

Post by johnsa »

Hey,

Can anyone see an issue with this? I'm sure this used to work 100% but now while testing it seems to return complete junk under bochs and real h/w.

Code: Select all


	;--------------------------------------------------------------------------------
	; Check for EDD / Int13h extensions.
	;--------------------------------------------------------------------------------
	mov ah,41h
	mov bx,55aah
	mov dl,[m_driveNo]
	int 13h
	jc short no_extensions
	cmp bx,0aa55h
	jne short no_extensions

	;--------------------------------------------------------------------------------
	; Obtain drive info/geometry from Int13h extensions.
	; -> Result Packet will be at 0000:0500h
	;--------------------------------------------------------------------------------
	mov ah,48h
	mov dl,[m_driveNo]
	push ds
	xor ax,ax
	mov ds,ax
	mov si,500h
	mov word [ds:si],30			; tried 26/30/66 etc.. didn't make a difference
	mov word [ds:si+2],0									; PhoenixBIOS 4 rel. 6 fails on this function if the flags word isn't 0 on entry.
	int 13h
	pop ds
	jc short no_extensions									; If the carry is set the function call failed and we'll fall back to use legacy int13h calls.
	cmp ah,0												; Double check the errorcode as well in case the BIOS doesn't set the carry correctly.
	jne short no_extensions
	
	xor ax,ax
	mov es,ax
	mov ax,[es:500h+24]
	mov [m_sectorsize],ax									; Get reported bytes per sector. COMPLETE GARBAGE HERE... either 0000h or 0606h ??

smeezekitty
Member
Member
Posts: 50
Joined: Sat Mar 21, 2009 9:42 pm

Re: int 13 extensions problem

Post by smeezekitty »

I hope your in real mode because trying from protected mode is a waste of time.
sebihepp
Member
Member
Posts: 194
Joined: Tue Aug 26, 2008 11:24 am
GitHub: https://github.com/sebihepp

Re: int 13 extensions problem

Post by sebihepp »

I finally find an error:
You set AH to 0x48 but later you make a XOR AX, AX, wich zeroes it. This is okay,
because you want to write the zero to ds, BUT you have to restore the value in ah.
You are currently calling INT 0x13 function 0. =)

best regards
sebihepp
johnsa
Member
Member
Posts: 296
Joined: Mon Oct 15, 2007 3:04 pm

Re: int 13 extensions problem

Post by johnsa »

Thanks for the reply :) I actually saw the problem straight after making the post (reallllly embarassing after 20 years of asm coding) :)
I wasn't able to reply soon to my error as our work account is blocked from posting.

Thanks all the same :)
Post Reply