ISO 9660 read error

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
CWood
Member
Member
Posts: 127
Joined: Sun Jun 20, 2010 1:21 pm

ISO 9660 read error

Post by CWood »

For some reason, whenever I try to parse a directory entry for ISO 9660, I get 0 for LBA address, and length. I load in the PVD with this code:

Code: Select all

LoadPVD:
	push	cx						; store registers
	push	bx
	push	es

	mov	cx, 4						; We want one sector
	mov	eax, 0x10					; At block 10 - 0-F are reserved

	mov	bx, PVD_SEG					; Reading to segment 50
	mov	es, bx

	xor	bx, bx						; Offset 0

	.loop:
		inc	eax
		call    ReadSectors
		jc	.done

		mov	bx, 0x50
		mov	es, bx
		xor	bx, bx

		cmp	byte [es:bx], 1
		jne	.loop

	.done:
		pop	es
		pop	bx						; restore registers and return
		pop	cx
		ret
and read with this:

Code: Select all

ReadSectors:
	.MAIN:
		push	edx

		mov	di, 5

	.SECTORLOOP:
		push	ds
		push	dword 0	;Block number
		push	eax
		push	bx	; Read to es:bx
		push	es
		push	word cx	; Read in 1 block
		push	word 10h	; Size: 10h

		mov	ah, 42h
		mov	dl, [bsDriveNumber]

		push	ss
		pop	ds

		mov	si, sp
		push	cx

		int	13h	; IBM/MS INT 13 Extensions - EXTENDED READ

		pop	cx

		pop	edx
		pop	bx
		pop	dx
		pop	edx
		pop	edx
		pop	ds

		jc	.CONTINUE						; test for read error

		cmp	ax, 0
		je	.SUCCESS

	.CONTINUE:
		dec	di							; decrement error counter
		jnz	.SECTORLOOP						; attempt to read again

	.SUCCESS:
		pop	edx
		ret
All I get is carry set. I'm at a complete loss and I have literally tried everything. It used to work as far as the PVD is concerned, but recently I noticed that cx was used as a loop counter in ReadSectors, and upon fixing that the PVD was not loading.
Nugget
Posts: 16
Joined: Sun May 02, 2010 2:54 am

Re: ISO 9660 read error

Post by Nugget »

Hi death2all,

Are you sure that you've got your segment:offset for your destination buffer in the correct order? Have a look at: http://en.wikipedia.org/wiki/INT_13
CWood
Member
Member
Posts: 127
Joined: Sun Jun 20, 2010 1:21 pm

Re: ISO 9660 read error

Post by CWood »

Here is my modified ReadSectors:

Code: Select all

ReadSectors:
	.MAIN:
		push	edx
		mov	di, 5

		push	ax
		mov	ah, 45h
		mov	al, 0x00	; Lock drive to prevent tray opening

		mov	dl, [bsDriveNumber]

		int	0x13

		mov	al, ah
		mov	ah, 0x0E
		int	0x10

		cmp	al, 0
		jne	.End
		pop	ax

	mov	edx, 0xFFFFFFFF
	.WaitLoop:
		dec	edx
		jnz	.WaitLoop

	.SECTORLOOP:
		push	eax
		push	ds
		push	es
		push	bx
		push	cx
		push	di

		push	dword 0	;Block number
		push	dword eax
		push	word es	; Read to es:bx
		push	word bx
		push	word cx
		push	word 10h	; Size: 10h

		mov	ah, 0x42

		push	ss
		pop	ds

		mov	si, sp
		int	13h	; IBM/MS INT 13 Extensions - EXTENDED READ

		mov	al, ah
		mov	ah, 0x0E
		int	0x10

		add	esp, 0x10

		jc	.CONTINUE

	.CONTINUE:
		pop	di
		pop	cx
		pop	bx
		pop	es
		pop	ds

		cmp	al, 0
		pop	eax
		je	.SUCCESS

	.LOOP:
		dec	di
		jnz	.SECTORLOOP

	.SUCCESS:
		mov	ah, 45h
		mov	al, 0x01	; Unlock drive

		int	0x13

		mov	al, ah
		mov	ah, 0x0E
		int	0x10

	.End:
		pop	edx
		ret
I am now getting error 0x02: address mark not found. What does this mean, and what can I do about it, because the internet says it usually means I need to read sectors, but I am only reading 1 anyway?
CWood
Member
Member
Posts: 127
Joined: Sun Jun 20, 2010 1:21 pm

Re: ISO 9660 read error

Post by CWood »

Doesn't matter. Fixed it. DL was getting corrupted :S
Post Reply