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
