Index: trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm	(revision 248)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm	(revision 249)
@@ -141,7 +141,8 @@
 ;	Returns:
 ;		AH:		INT 13h Error Code
-;		CF:		Cleared if success, Set if error
-;	Corrupts registers:
-;		AL, BX, CX, DX, (ES:SI for data transfer commands)
+;		CX:		Number of successfully transferred sectors (for transfer commands)
+;		CF:		Cleared if success, Set if error
+;	Corrupts registers:
+;		AL, BX, (CX), DX, (ES:SI for data transfer commands)
 ;--------------------------------------------------------------------
 %ifdef MODULE_JRIDE
Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm	(revision 248)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm	(revision 249)
@@ -93,7 +93,8 @@
 ;	Returns:
 ;		AH:		INT 13h Error Code
-;		CF:		Cleared if success, Set if error
-;	Corrupts registers:
-;		AL, BX, CX, DX, (ES:SI for data transfer commands)
+;		CX:		Number of successfully transferred sectors (for transfer commands)
+;		CF:		Cleared if success, Set if error
+;	Corrupts registers:
+;		AL, BX, (CX), DX, (ES:SI for data transfer commands)
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
Index: trunk/XTIDE_Universal_BIOS/Src/Device/Idepack.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/Idepack.asm	(revision 248)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/Idepack.asm	(revision 249)
@@ -32,7 +32,8 @@
 ;	Returns:
 ;		AH:		INT 13h Error Code
+;		CX:		Number of successfully transferred sectors (for transfer commands)
 ;		CF:		Cleared if success, Set if error
 ;	Corrupts registers:
-;		AL, BX, CX, DX, SI, ES
+;		AL, BX, (CX), DX, SI, ES
 ;--------------------------------------------------------------------
 %ifdef MODULE_EBIOS
@@ -85,7 +86,8 @@
 ;	Returns:
 ;		AH:		INT 13h Error Code
+;		CX:		Number of successfully transferred sectors (for transfer commands)
 ;		CF:		Cleared if success, Set if error
 ;	Corrupts registers:
-;		AL, BX, CX, DX
+;		AL, BX, (CX), DX
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm	(revision 248)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm	(revision 249)
@@ -105,7 +105,26 @@
 ALIGN JUMP_ALIGN
 .ExchangeInt13hHandlers:
-	call	ExchangeCurrentInt13hHandlerWithOldInt13hHandler
+%ifdef USE_186
+	push	Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
+	jmp		SHORT ExchangeCurrentInt13hHandlerWithOldInt13hHandler
+%else
+	call	ExchangeCurrentInt13hHandlerWithOldInt13hHandler
+	jmp		SHORT Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
+%endif
+
+
+;--------------------------------------------------------------------
+; Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAHandTransferredSectorsFromCL
+;	Parameters:
+;		AH:		BIOS Error code
+;		CL:		Number of sectors actually transferred
+;		SS:BP:	Ptr to IDEPACK
+;	Returns:
+;		All registers are loaded from INTPACK
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAHandTransferredSectorsFromCL:
+	mov		[bp+IDEPACK.intpack+INTPACK.al], cl
 	; Fall to Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
-
 
 ;--------------------------------------------------------------------
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH2h_HRead.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH2h_HRead.asm	(revision 248)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH2h_HRead.asm	(revision 249)
@@ -23,5 +23,6 @@
 ;	Returns with INTPACK:
 ;		AH:		Int 13h/40h floppy return status
-;		AL:		Burst error length if AH returns 11h, undefined otherwise
+;		AL:		Burst error length if AH returns 11h (we never return error code 11h)
+;				Number of sectors actually read (only valid if CF set for someBIOSes)
 ;		CF:		0 if successfull, 1 if error
 ;--------------------------------------------------------------------
@@ -33,8 +34,8 @@
 	mov		bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRQ)
 %ifdef USE_186
-	push	Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
+	push	Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAHandTransferredSectorsFromCL
 	jmp		Idepack_TranslateOldInt13hAddressAndIssueCommandFromAH
 %else
 	call	Idepack_TranslateOldInt13hAddressAndIssueCommandFromAH
-	jmp		Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
+	jmp		Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAHandTransferredSectorsFromCL
 %endif
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH3h_HWrite.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH3h_HWrite.asm	(revision 248)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH3h_HWrite.asm	(revision 249)
@@ -23,4 +23,5 @@
 ;	Returns with INTPACK:
 ;		AH:		Int 13h/40h floppy return status
+;		AL:		Number of sectors actually written (only valid if CF set for someBIOSes)
 ;		CF:		0 if successfull, 1 if error
 ;--------------------------------------------------------------------
@@ -32,8 +33,8 @@
 	mov		bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRQ)
 %ifdef USE_186
-	push	Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
+	push	Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAHandTransferredSectorsFromCL
 	jmp		Idepack_TranslateOldInt13hAddressAndIssueCommandFromAH
 %else
 	call	Idepack_TranslateOldInt13hAddressAndIssueCommandFromAH
-	jmp		Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
+	jmp		Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAHandTransferredSectorsFromCL
 %endif
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH4h_HVerify.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH4h_HVerify.asm	(revision 248)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH4h_HVerify.asm	(revision 249)
@@ -22,4 +22,5 @@
 ;	Returns with INTPACK in SS:BP:
 ;		AH:		Int 13h/40h floppy return status
+;		AL:		Number of sectors actually verified (only valid if CF set for someBIOSes)
 ;		CF:		0 if successfull, 1 if error
 ;--------------------------------------------------------------------
@@ -30,8 +31,8 @@
 	mov		bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRDY)
 %ifdef USE_186
-	push	Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
+	push	Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAHandTransferredSectorsFromCL
 	jmp		Idepack_TranslateOldInt13hAddressAndIssueCommandFromAH
 %else
 	call	Idepack_TranslateOldInt13hAddressAndIssueCommandFromAH
-	jmp		Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
+	jmp		Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAHandTransferredSectorsFromCL
 %endif
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH42h_ExtendedReadSectors.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH42h_ExtendedReadSectors.asm	(revision 248)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH42h_ExtendedReadSectors.asm	(revision 249)
@@ -20,5 +20,5 @@
 ;		CF:		0 if succesfull, 1 if error
 ;	Return with Disk Address Packet in INTPACK:
-;		.bSectorCount	Number of sectors read successfully
+;		.wSectorCount	Number of sectors read successfully
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
@@ -27,9 +27,22 @@
 	mov		ah, [cs:bx+g_rgbReadCommandLookup]
 	mov		bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRQ)
-%ifdef USE_186
-	push	Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
-	jmp		Idepack_ConvertDapToIdepackAndIssueCommandFromAH
-%else
 	call	Idepack_ConvertDapToIdepackAndIssueCommandFromAH
+	; Fall to AH42h_ReturnFromInt13hAfterStoringErrorCodeFromAHandTransferredSectorsFromCX
+
+
+;--------------------------------------------------------------------
+; AH42h_ReturnFromInt13hAfterStoringErrorCodeFromAHandTransferredSectorsFromCX
+;	Parameters:
+;		AH:		INT 13h Error Code
+;		CX:		Number of successfully transferred sectors
+;		SS:BP:	Ptr to IDEPACK
+;	Returns:
+;		Nothing, jumps to Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
+;	Corrupts registers:
+;		SI, DS
+;--------------------------------------------------------------------
+AH42h_ReturnFromInt13hAfterStoringErrorCodeFromAHandTransferredSectorsFromCX:
+	mov		ds, [bp+IDEPACK.intpack+INTPACK.ds]
+	mov		si, [bp+IDEPACK.intpack+INTPACK.si]
+	mov		[si+DAP.wSectorCount], cx
 	jmp		Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
-%endif
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH43h_ExtendedWriteSectors.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH43h_ExtendedWriteSectors.asm	(revision 248)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH43h_ExtendedWriteSectors.asm	(revision 249)
@@ -22,5 +22,5 @@
 ;		CF:		0 if succesfull, 1 if error
 ;	Return with Disk Address Packet in INTPACK:
-;		.bSectorCount	Number of sectors written successfully
+;		.wSectorCount	Number of sectors written successfully
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
@@ -33,8 +33,8 @@
 	mov		bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRQ)
 %ifdef USE_186
-	push	Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
+	push	AH42h_ReturnFromInt13hAfterStoringErrorCodeFromAHandTransferredSectorsFromCX
 	jmp		Idepack_ConvertDapToIdepackAndIssueCommandFromAH
 %else
 	call	Idepack_ConvertDapToIdepackAndIssueCommandFromAH
-	jmp		Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
+	jmp		SHORT AH42h_ReturnFromInt13hAfterStoringErrorCodeFromAHandTransferredSectorsFromCX
 %endif
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH44h_ExtendedVerifySectors.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH44h_ExtendedVerifySectors.asm	(revision 248)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH44h_ExtendedVerifySectors.asm	(revision 249)
@@ -20,5 +20,5 @@
 ;		CF:		0 if succesfull, 1 if error
 ;	Return with Disk Address Packet in INTPACK:
-;		.bSectorCount	Number of sectors verified successfully
+;		.wSectorCount	Number of sectors verified successfully
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
@@ -28,8 +28,8 @@
 	mov		bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRDY)
 %ifdef USE_186
-	push	Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
+	push	AH42h_ReturnFromInt13hAfterStoringErrorCodeFromAHandTransferredSectorsFromCX
 	jmp		Idepack_ConvertDapToIdepackAndIssueCommandFromAH
 %else
 	call	Idepack_ConvertDapToIdepackAndIssueCommandFromAH
-	jmp		Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
+	jmp		SHORT AH42h_ReturnFromInt13hAfterStoringErrorCodeFromAHandTransferredSectorsFromCX
 %endif
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH47h_ExtendedSeek.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH47h_ExtendedSeek.asm	(revision 248)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH47h_ExtendedSeek.asm	(revision 249)
@@ -36,5 +36,2 @@
 	jmp		Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
 %endif
-
-.WriteWithVerifyNotSupported:
-	jmp		Prepare_ReturnFromInt13hWithInvalidFunctionError
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm	(revision 248)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm	(revision 249)
@@ -4,4 +4,19 @@
 ; Section containing code
 SECTION .text
+
+;--------------------------------------------------------------------
+; INT 19h handler that properly reboots the computer when
+; INT 19h is called.
+;
+; Int19h_ResetHandler
+;	Parameters:
+;		Nothing
+;	Returns:
+;		Never returns (reboots computer)
+;--------------------------------------------------------------------
+Int19h_ResetHandler:
+	mov		ax, BOOT_FLAG_WARM				; Skip memory tests
+	jmp		Reboot_ComputerWithBootFlagInAX
+
 
 ;--------------------------------------------------------------------
@@ -125,4 +140,7 @@
 	push	cx			; sgment address for MBR
 	push	bx			; offset address for MBR
+	mov		bx, BIOS_BOOT_LOADER_INTERRUPT_19h	; INT 19h interrupt vector offset
+	mov		si, Int19h_ResetHandler				; INT 19h handler to reboot the system
+	call	Interrupts_InstallHandlerToVectorInBXFromCSSI
 	retf				; NOTE:	DL is set to the drive number
 
