Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm	(revision 34)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm	(revision 35)
@@ -2,5 +2,5 @@
 ; Project name	:	IDE BIOS
 ; Created date	:	27.9.2007
-; Last update	:	3.8.2010
+; Last update	:	24.8.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Int 13h function AH=0h, Disk Controller Reset.
@@ -44,5 +44,5 @@
 	xor		al, al						; Zero AL...
 	cmp		al, bh						; ...and set CF if error
-	jmp		Int13h_StoreErrorCodeToBDAandPopXRegsAndReturn
+	jmp		Int13h_PopXRegsAndReturn
 
 
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH14h_HDiag.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH14h_HDiag.asm	(revision 34)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH14h_HDiag.asm	(revision 35)
@@ -2,5 +2,5 @@
 ; Project name	:	IDE BIOS
 ; Created date	:	28.9.2007
-; Last update	:	1.8.2010
+; Last update	:	24.8.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Int 13h function AH=14h, Controller Internal Diagnostic.
@@ -33,7 +33,7 @@
 	jnz		SHORT .ReturnError
 	xor		ah, ah						; Zero AH and CF since success
-	jmp		Int13h_StoreErrorCodeToBDAandPopDSDIandReturn
+	jmp		Int13h_PopDiDsAndReturn
 .ReturnError:
 	mov		ah, RET_HD_RESETFAIL
 	stc
-	jmp		Int13h_StoreErrorCodeToBDAandPopDSDIandReturn
+	jmp		Int13h_PopDiDsAndReturn
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH15h_HSize.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH15h_HSize.asm	(revision 34)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH15h_HSize.asm	(revision 35)
@@ -2,5 +2,5 @@
 ; Project name	:	IDE BIOS
 ; Created date	:	28.9.2007
-; Last update	:	12.4.2010
+; Last update	:	24.8.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Int 13h function AH=15h, Read Disk Drive Size.
@@ -44,3 +44,3 @@
 	mov		ah, 3								; Type code = Hard disk
 	clc
-	jmp		Int13h_ReturnWithoutSwappingDrives
+	jmp		Int13h_ReturnWithValueInDL
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1h_HStatus.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1h_HStatus.asm	(revision 34)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1h_HStatus.asm	(revision 35)
@@ -2,5 +2,5 @@
 ; Project name	:	IDE BIOS
 ; Created date	:	27.9.2007
-; Last update	:	29.7.2010
+; Last update	:	24.8.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Int 13h function AH=1h, Read Disk Status.
@@ -32,5 +32,5 @@
 	xor		ah, ah					; Zero AH
 	cmp		ah, [BDA.bHDLastSt]		; Set CF if error code is non-zero
-	xchg	ah, [BDA.bHDLastSt]		; Last error to AH, zero to BDA
+	mov		ah, [BDA.bHDLastSt]		; Last error to AH
 
 	pop		ds
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH2h_HRead.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH2h_HRead.asm	(revision 34)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH2h_HRead.asm	(revision 35)
@@ -2,5 +2,5 @@
 ; Project name	:	IDE BIOS
 ; Created date	:	27.9.2007
-; Last update	:	1.8.2010
+; Last update	:	24.8.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Int 13h function AH=2h, Read Disk Sectors.
@@ -63,3 +63,3 @@
 	mov		ah, RET_HD_INVALID			; Invalid value passed
 	stc									; Set CF since error
-	jmp		Int13h_StoreErrorCodeToBDAandPopDSDIandReturn
+	jmp		Int13h_PopDiDsAndReturn
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH8h_HParams.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH8h_HParams.asm	(revision 34)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH8h_HParams.asm	(revision 35)
@@ -2,5 +2,5 @@
 ; Project name	:	IDE BIOS
 ; Created date	:	27.9.2007
-; Last update	:	3.8.2010
+; Last update	:	24.8.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Int 13h function AH=8h, Read Disk Drive Parameters.
@@ -38,5 +38,5 @@
 	call	AH8h_GetDriveParameters
 	pop		bx
-	jmp		Int13h_ReturnWithoutSwappingDrives
+	jmp		Int13h_ReturnWithValueInDL
 
 ALIGN JUMP_ALIGN
@@ -44,5 +44,5 @@
 	call	Int13h_CallPreviousInt13hHandler
 	call	RamVars_GetCountOfKnownDrivesToDL
-	jmp		Int13h_ReturnWithoutSwappingDrives
+	jmp		Int13h_ReturnWithValueInDL
 
 
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm	(revision 34)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm	(revision 35)
@@ -82,7 +82,4 @@
 	and		BYTE [di+DPT.bReset], ~FLG_RESET_nSETBLOCK
 
-	; Force PIO mode 0
-	;call	AH9h_ForcePioMode0
-
 .ReturnNotSuccessfull:
 	pop		cx
@@ -152,27 +149,2 @@
 .Return:
 	ret
-
-
-;--------------------------------------------------------------------
-; AH9h_ForcePioMode0
-;	Parameters:
-;		DL:		Drive number
-;		DS:DI:	Ptr to DPT
-;	Returns:
-;		AH:		BIOS Error code
-;		CF:		Cleared if succesfull
-;				Set if any error
-;	Corrupts registers:
-;		AX, BX
-;--------------------------------------------------------------------
-;ALIGN JUMP_ALIGN
-;AH9h_ForcePioMode0:
-;	mov		bh, 08h		; Parameter to Sector Count Register (PIO Flow Control Transfer Mode 0)
-;	mov		ax, 2303h	; Feature: Set transfer mode based on value in Sector Count register
-;	int		13h
-;	jc		SHORT .FailedToForcePIO0
-;	; Debug output here
-;	ret
-;.FailedToForcePIO0:
-;	; Debug output here
-;	ret
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm	(revision 34)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm	(revision 35)
@@ -2,5 +2,5 @@
 ; Project name	:	IDE BIOS
 ; Created date	:	9.12.2007
-; Last update	:	23.8.2010
+; Last update	:	24.8.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Int 13h function AH=Dh, Reset Hard Disk (Alternate reset).
@@ -26,5 +26,5 @@
 AHDh_HandlerForResetHardDisk:
 	call	AHDh_ResetDrive
-	jmp		Int13h_StoreErrorCodeToBDAandPopDSDIandReturn
+	jmp		Int13h_PopDiDsAndReturn
 
 
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HError.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HError.asm	(revision 34)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HError.asm	(revision 35)
@@ -2,5 +2,5 @@
 ; Project name	:	IDE BIOS
 ; Created date	:	30.11.2007
-; Last update	:	23.8.2010
+; Last update	:	24.8.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Error checking functions for BIOS Hard disk functions.
@@ -23,28 +23,17 @@
 ALIGN JUMP_ALIGN
 HError_ProcessTimeoutAfterPollingBSYandSomeOtherStatusBit:
-	push	ds
-	push	dx
-
 	call	HError_GetStatusAndErrorRegistersToAXandStoreThemToBDA
 	call	GetBiosErrorCodeToAHfromStatusAndErrorRegistersInAX
-	jc		SHORT StoreErrorCodeFromAHtoBDA
+	jc		SHORT .ReturnErrorCodeInAH
 	mov		ah, RET_HD_TIMEOUT			; Force timeout since no actual error...
 	stc									; ...but wanted bit was never set
-	jmp		SHORT StoreErrorCodeFromAHtoBDA
+.ReturnErrorCodeInAH:
+	ret
 
 
 ALIGN JUMP_ALIGN
 HError_ProcessErrorsAfterPollingBSY:
-	push	ds
-	push	dx
-
 	call	HError_GetStatusAndErrorRegistersToAXandStoreThemToBDA
-	call	GetBiosErrorCodeToAHfromStatusAndErrorRegistersInAX
-StoreErrorCodeFromAHtoBDA:
-	mov		[BDA.bHDLastSt], ah			; Store BIOS error code to BDA
-
-	pop		dx
-	pop		ds
-	ret
+	jmp		SHORT GetBiosErrorCodeToAHfromStatusAndErrorRegistersInAX
 
 
@@ -56,10 +45,12 @@
 ;		AL:		IDE Status Register contents
 ;		AH:		IDE Error Register contents
-;		DS:		BDA segment
 ;	Corrupts registers:
-;		DX
+;		Nothing
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
 HError_GetStatusAndErrorRegistersToAXandStoreThemToBDA:
+	push	ds
+	push	dx
+
 	mov		dx, [RAMVARS.wIdeBase]		; Load IDE base port address
 	inc		dx							; Increment to Error Register
@@ -68,19 +59,10 @@
 	add		dx, BYTE REGR_IDE_ST - REGR_IDE_ERROR
 	in		al, dx						; Read Status Register to AL
-	; Fall to .StoreStatusAndErrorRegistersFromAXtoBDA
 
-;--------------------------------------------------------------------
-; .StoreStatusAndErrorRegistersFromAXtoBDA
-;	Parameters:
-;		AL:		IDE Status Register contents
-;		AH:		IDE Error Register contents
-;	Returns:
-;		DS:		BDA segment (zero)
-;	Corrupts registers:
-;		DX
-;--------------------------------------------------------------------
-.StoreStatusAndErrorRegistersFromAXtoBDA:
 	LOAD_BDA_SEGMENT_TO	ds, dx
 	mov		[HDBDA.wHDStAndErr], ax
+
+	pop		dx
+	pop		ds
 	ret
 
@@ -148,21 +130,2 @@
 	db	RET_HD_BADSECTOR	; Bit7=BBK, Bad Block Detected
 	db	RET_HD_STATUSERR	; When Error Register is zero
-
-
-;--------------------------------------------------------------------
-; HError_StoreBiosErrorCodeFromAHtoBDA
-;	Parameters:
-;		AH:		BIOS error code
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		DI
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-HError_StoreBiosErrorCodeFromAHtoBDA:
-	push	ds
-	mov		di, 0					; Zero DI and preserve FLAGS
-	mov		ds, di					; Copy BDA segment to DS
-	mov		[BDA.bHDLastSt], ah
-	pop		ds
-	ret
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HIRQ.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HIRQ.asm	(revision 34)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HIRQ.asm	(revision 35)
@@ -2,5 +2,5 @@
 ; Project name	:	IDE BIOS
 ; Created date	:	11.12.2009
-; Last update	:	23.8.2010
+; Last update	:	24.8.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Interrupt handling related functions.
@@ -98,4 +98,5 @@
 	jmp		SHORT AcknowledgeMasterInterruptController
 
+
 ALIGN JUMP_ALIGN
 HIRQ_InterruptServiceRoutineForIrqs8to15:
@@ -132,12 +133,13 @@
 	push	ds
 	push	di
-	push	dx
 
 	; Reading Status Register acknowledges IDE interrupt
 	call	RamVars_GetSegmentToDS
 	call	HError_GetStatusAndErrorRegistersToAXandStoreThemToBDA
+
+	; Set Task Flag
+	LOAD_BDA_SEGMENT_TO	ds, ax
 	mov		BYTE [BDA.bHDTaskFlg], 0FFh		; Set task flag
 
-	pop		dx
 	pop		di
 	pop		ds
