Index: trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm	(revision 616)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm	(revision 617)
@@ -164,4 +164,38 @@
 
 ;--------------------------------------------------------------------
+; Device_ReadLBAlowRegisterToAL
+; Returns LBA low register / Sector number register contents.
+; Note that this returns valid value only after transfer command (read/write/verify)
+; has stopped to an error. Do not call this otherwise.
+;	Parameters:
+;		DS:DI:	Ptr to DPT (in RAMVARS segment)
+;	Returns:
+;		AL:		Byte read from the device register
+;	Corrupts registers:
+;		BX, DX
+;--------------------------------------------------------------------
+;%ifdef MODULE_SERIAL	; IDE + Serial
+;ALIGN JUMP_ALIGN
+;Device_ReadLBAlowRegisterToAL:
+;	test	BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
+;%ifdef USE_386
+;	jz		IdeCommand_ReadLBAlowRegisterToAL
+;	jmp		SerialCommand_ReadLBAlowRegisterToAL
+;%else
+;	jnz		SHORT .ReadFromSerialPort
+;	jmp		IdeCommand_ReadLBAlowRegisterToAL
+
+;ALIGN JUMP_ALIGN
+;.ReadFromSerialPort:
+;	jmp		SerialCommand_ReadLBAlowRegisterToAL
+;%endif
+
+;%else					; IDE only
+	Device_ReadLBAlowRegisterToAL		EQU		IdeCommand_ReadLBAlowRegisterToAL
+;%endif
+; TODO: For now we simply assume serial device do not produce verify errors
+
+
+;--------------------------------------------------------------------
 ; Device_SelectDrive
 ;	Parameters:
Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm	(revision 616)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm	(revision 617)
@@ -288,2 +288,22 @@
 	OUTPUT_AL_TO_IDE_REGISTER	LBA_HIGH_REGISTER
 	ret
+
+
+;--------------------------------------------------------------------
+; IdeCommand_ReadLBAlowRegisterToAL
+; Returns LBA low register / Sector number register contents.
+; Note that this returns valid value only after transfer command (read/write/verify)
+; has stopped to an error. Do not call this otherwise.
+;	Parameters:
+;		DS:DI:	Ptr to DPT (in RAMVARS segment)
+;	Returns:
+;		AL:		Byte read from the register
+;	Corrupts registers:
+;		BX, DX
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+IdeCommand_ReadLBAlowRegisterToAL:
+	; HOB bit (defined in 48-bit address feature set) should be zero by default
+	; so we get the correct value for CHS, LBA28 and LBA48 drives and commands
+	INPUT_TO_AL_FROM_IDE_REGISTER	LBA_LOW_REGISTER
+	ret
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH4h_HVerify.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH4h_HVerify.asm	(revision 616)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH4h_HVerify.asm	(revision 617)
@@ -29,5 +29,5 @@
 ;		DL:		Translated Drive number
 ;		DS:DI:	Ptr to DPT (in RAMVARS segment)
-;		SS:BP:	Ptr to INTPACK
+;		SS:BP:	Ptr to IDEPACK
 ;	Parameters on INTPACK in SS:BP:
 ;		AL:		Number of sectors to verify (1...128)
@@ -46,9 +46,38 @@
 	call	Prepare_ByValidatingSectorsInALforOldInt13h	; Preserves AX
 	mov		bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRDY)
-%ifdef USE_186
-	push	Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAHandTransferredSectorsFromCL
-	jmp		Idepack_TranslateOldInt13hAddressAndIssueCommandFromAH
-%else
+	push	ax			; Store number of sectors to verify
 	call	Idepack_TranslateOldInt13hAddressAndIssueCommandFromAH
+	pop		cx			; Number of sectors verified if successful
+	jnc		SHORT .NoErrors
+
+; TODO: For now we assume serial device do not produce verify errors
+	call	AH4h_CalculateNumberOfSuccessfullyVerifiedSectors
+.NoErrors:
 	jmp		Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAHandTransferredSectorsFromCL
-%endif
+
+
+;--------------------------------------------------------------------
+; Calculates number of succesfully verified sectors. This function works only
+; if verify command stopped to an device error (such as bad sector) since IDE
+; register contents are not valid unless error.
+;
+; AH4h_CalculateNumberOfSuccessfullyVerifiedSectors
+;	Parameters:
+;		AH:		INT 13h error code
+;		CX:		Number of sectors that was meant to we verified
+;		DS:DI:	Ptr to DPT (in RAMVARS segment)
+;		SS:BP:	Ptr to IDEPACK
+;	Returns with INTPACK in SS:BP:
+;		CX:		Number of sectors succesfully verified
+;		CF:		1
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+AH4h_CalculateNumberOfSuccessfullyVerifiedSectors:
+	xchg	cx, ax			; Store error code to CL
+	call	Device_ReadLBAlowRegisterToAL
+	mov		ah, [bp+IDEPACK.bLbaLow]
+	sub		al, ah			; AL = sector address with verify failure - starting sector address
+	xor		ah, ah
+	xchg	cx, ax			; Number of successfully verified sectors in CX, error code in AH
+	stc
+	ret
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH44h_ExtendedVerifySectors.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH44h_ExtendedVerifySectors.asm	(revision 616)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH44h_ExtendedVerifySectors.asm	(revision 617)
@@ -41,6 +41,20 @@
 AH44h_HandlerForExtendedVerifySectors:
 	call	Prepare_ByLoadingDapToESSIandVerifyingForTransfer
+	push	WORD [es:si+DAP.wSectorCount]				; Store for successfull number of sectors transferred
 	mov		ah, [cs:bx+g_rgbVerifyCommandLookup]
 	mov		bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRDY)
 	call	Idepack_ConvertDapToIdepackAndIssueCommandFromAH
+
+	; Now we need number of succesfully verifed sectors to CX. Since we did not transfer anything,
+	; we did not have any sector counter like in read and write functions.
+	; In case of error, drive LBA registers are set to address where the error occurred. We must
+	; calculate number of succesfully transferred sectors from it.
+	pop		cx
+	jnc		SHORT .AllSectorsVerifiedSuccessfully
+
+; TODO: For now we assume serial device do not produce verify errors
+	call	AH4h_CalculateNumberOfSuccessfullyVerifiedSectors
+
+ALIGN JUMP_ALIGN
+.AllSectorsVerifiedSuccessfully:
 	jmp		SHORT AH42h_ReturnFromInt13hAfterStoringErrorCodeFromAHandTransferredSectorsFromCX
