BIOS INT 13H extension 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
User avatar
lemonyii
Member
Member
Posts: 153
Joined: Thu Mar 25, 2010 11:28 pm
Location: China

BIOS INT 13H extension read

Post by lemonyii »

i've make sure ext int 13h is supported. and i use a usb TF card with FAT32 file system as boot disk.
surely the bootsect is loaded and started up. but then i found it can't read following sectors correctly.
and these are all on real machine(very new).

Code: Select all

DAP:
	PacketSize:		db	0
	Reserved:		db	0
	BlockCount:		dw	0
	BufferAddr:		dd	0	; (segment:offset) 
	BlockNum:		dd	0	
					dd	0

readsectors:	;read cx sectors start at eax to edi
	mov		byte [PacketSize],16
	mov		[BlockCount],cx
	mov		[BufferAddr],di
	shr		edi,4
	and		di,0xf000
	mov		[BufferAddr+16],di
	mov		[BlockNum],eax
	.read:
	mov		ah,0x42
	mov		dl,[BS_DrvNum]
	mov		di,DAP      ;maybe    mov si,DAP?
	int		0x13
	jc		fail
	ret
	fail:
	mov		si,MSGDSKERR
	call	printf
	jmp $
first, it doesn't print message MSGDSKERR,so maybe no fault in int call.
second, i thought it should be mov si,DAP(a document metioned mostly DI,but one key place is SI)., but strange on and off on screen when i use it
third, does the SEG:OFF mean the lower 16 bits is offset and the higher segment?(i think and did so)
least possibility, BlockNum = 0 means the bootsect, and the bonduary is 64k not 32k,right?
thanks,
lemonyii
Enjoy my life!------A fish with a tattooed retina
User avatar
Firestryke31
Member
Member
Posts: 550
Joined: Sat Nov 29, 2008 1:07 pm
Location: Throw a dart at central Texas
Contact:

Re: BIOS INT 13H extension read

Post by Firestryke31 »

I found you need to make sure the packet is 4-byte aligned or some implementations won't work (i.e. Bochs, and probably some real computers as well). Also, for the SEG:OFF I am pretty sure it needs to be dw Off, dw Seg (or as you're doing it, 0xSSSSOOOO as a dword).
Owner of Fawkes Software.
Wierd Al wrote: You think your Commodore 64 is really neato,
What kind of chip you got in there, a Dorito?
User avatar
lemonyii
Member
Member
Posts: 153
Joined: Thu Mar 25, 2010 11:28 pm
Location: China

Re: BIOS INT 13H extension read

Post by lemonyii »

4-byte aligned? i'll try.
and i've make sure the machine support ext13h through ah=0x41.
thx
Enjoy my life!------A fish with a tattooed retina
geppyfx
Member
Member
Posts: 87
Joined: Tue Apr 28, 2009 4:58 pm

Re: BIOS INT 13H extension read

Post by geppyfx »

Yes, I do see some clear errors along with undefined registers.
http://www.ctyme.com/intr/rb-0708.htm
geppyfx
Member
Member
Posts: 87
Joined: Tue Apr 28, 2009 4:58 pm

Re: BIOS INT 13H extension read

Post by geppyfx »

lemonyii wrote:i thought it should be mov si,DAP
You thought correctly.
BlockNum = 0 means the bootsect
yes, master bootsector (MBR)is at LBA0. But LBA block size maybe larger than 512bait - rare(very) but happens (USB ZIP).
and the boundary is 64k not 32k,right
boundary is limited by destination segment which is 64KB. Some modern bioses can go over 64KB boundary some can't.
True boundary for many BIOSes is limited by single LBA block size. You can't read more than one LBA block per single int13 call.
M2004
Member
Member
Posts: 65
Joined: Sun Mar 07, 2010 2:12 am

Re: BIOS INT 13H extension read

Post by M2004 »

Have you checked that your bios actually supports int13h extended read command?
Some bios int13h extensions implementations may be stub?

regards
Mac2004
User avatar
lemonyii
Member
Member
Posts: 153
Joined: Thu Mar 25, 2010 11:28 pm
Location: China

Re: BIOS INT 13H extension read

Post by lemonyii »

I found you need to make sure the packet is 4-byte aligned
that's the point.
thank you and sorry for replying so late.
Enjoy my life!------A fish with a tattooed retina
Post Reply