Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1h_HStatus.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1h_HStatus.asm	(revision 96)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1h_HStatus.asm	(revision 116)
@@ -1,7 +1,3 @@
-; File name		:	AH1h_HStatus.asm
-; Project name	:	IDE BIOS
-; Created date	:	27.9.2007
-; Last update	:	24.8.2010
-; Author		:	Tomi Tilli
+; Project name	:	XTIDE Universal BIOS
 ; Description	:	Int 13h function AH=1h, Read Disk Status.
 
@@ -30,7 +26,7 @@
 
 	LOAD_BDA_SEGMENT_TO	ds, di
-	xor		ah, ah					; Zero AH
-	cmp		ah, [BDA.bHDLastSt]		; Set CF if error code is non-zero
 	mov		ah, [BDA.bHDLastSt]		; Last error to AH
+	cmp		ah, 1					; Set CF if error code is zero
+	cmc								; Invert CF
 
 	pop		ds
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH25h_HDrvID.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH25h_HDrvID.asm	(revision 96)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH25h_HDrvID.asm	(revision 116)
@@ -108,5 +108,5 @@
 ;--------------------------------------------------------------------
 ; Returns timeout value for drive detection.
-; Long timeout is required for detecing first drive to make sure it is
+; Long timeout is required for detecting first drive to make sure it is
 ; ready after power-on (ATA specification says up to 31 seconds).
 ; Short timeout is used for additional drives to prevent long boot time
@@ -123,10 +123,9 @@
 ALIGN JUMP_ALIGN
 AH25h_GetDriveDetectionTimeoutValue:
+	mov		cl, B_TIMEOUT_RESET			; Load long timeout (assume first drive)
 	cmp		BYTE [RAMVARS.bDrvCnt], 0	; Detecting first drive?
-	je		SHORT .GetLongDelayForInitialDetection
+	je		SHORT .Return
 	mov		cl, B_TIMEOUT_DRVINFO		; Load short timeout
+ALIGN JUMP_ALIGN, ret	; This speed optimization may be unnecessary
+.Return:
 	ret
-ALIGN JUMP_ALIGN
-.GetLongDelayForInitialDetection:
-	mov		cl, B_TIMEOUT_RESET			; Load long timeout
-	ret
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHCh_HSeek.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHCh_HSeek.asm	(revision 96)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHCh_HSeek.asm	(revision 116)
@@ -1,8 +1,3 @@
-; File name		:	AHCh_HSeek.asm
-; Project name	:	IDE BIOS
-; Created date	:	13.12.2007
-; Last update	:	14.1.2011
-; Author		:	Tomi Tilli,
-;				:	Krister Nordvall (optimizations)
+; Project name	:	XTIDE Universal BIOS
 ; Description	:	Int 13h function AH=Ch, Seek.
 
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm	(revision 96)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm	(revision 116)
@@ -100,6 +100,5 @@
 	; HSR2: Check_status
 	mov		cl, B_TIMEOUT_RESET			; Reset timeout delay
-	mov		dx, [RAMVARS.wIdeBase]		; Load base port address
-	jmp		HStatus_WaitBsyBase
+	jmp		HStatus_WaitBsy
 
 
@@ -125,5 +124,4 @@
 	call	AH9h_InitializeDriveForUse
 	mov		cl, ah						; Copy error code to CL
-ALIGN JUMP_ALIGN
 .InitializeSlave:
 	pop		dx							; Restore base port address
@@ -132,11 +130,9 @@
 	call	AH9h_InitializeDriveForUse
 	mov		ch, ah						; Copy error code to CH
-ALIGN JUMP_ALIGN
 .CombineErrors:
 	or		cl, ch						; OR error codes, clear CF
-	jnz		SHORT .ReturnError
-	ret
-.ReturnError:
+	jz		SHORT .Return
 	mov		ah, RET_HD_RESETFAIL		; Load Reset Failed error code
 	stc
+.Return:
 	ret
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HIRQ.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HIRQ.asm	(revision 96)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HIRQ.asm	(revision 116)
@@ -1,3 +1,3 @@
-; Project name	:	IDE BIOS
+; Project name	:	XTIDE Universal BIOS
 ; Description	:	Interrupt handling related functions.
 
@@ -35,5 +35,5 @@
 	push	ds
 
-	LOAD_BDA_SEGMENT_TO	ds, ax			; Zero AX
+	LOAD_BDA_SEGMENT_TO	ds, ax, !		; Zero AX
 	cli									; Disable interrupts
 	cmp		al, [BDA.bHDTaskFlg]		; Task flag already set?
@@ -68,5 +68,5 @@
 HIRQ_ClearTaskFlag:
 	push	ds
-	LOAD_BDA_SEGMENT_TO	ds, ax		; Also zero AX
+	LOAD_BDA_SEGMENT_TO	ds, ax, !		; Also zero AX
 	mov		[BDA.bHDTaskFlg], al
 	pop		ds
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HPIO.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HPIO.asm	(revision 96)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HPIO.asm	(revision 116)
@@ -1,3 +1,3 @@
-; Project name	:	IDE BIOS
+; Project name	:	XTIDE Universal BIOS
 ; Description	:	PIO transfer functions.
 
@@ -15,28 +15,4 @@
 
 ;--------------------------------------------------------------------
-; Normalizes far pointer to that offset overflows won't happen
-; when transferring data using PIO.
-;
-; HPIO_NORMALIZE_PTR
-;	Parameters:
-;		%1:%2:		Far pointer to normalize
-;		%3:			Scratch register
-;		%4:			Scratch register
-;	Returns:
-;		%1:%2:		Normalized far pointer
-;	Corrupts registers:
-;		%3, %4
-;--------------------------------------------------------------------
-%macro HPIO_NORMALIZE_PTR 4
-	mov		%4, %2				; Copy offset to scratch reg
-	and		%2, BYTE 0Fh		; Clear offset bits 15...4
-	eSHR_IM	%4, 4				; Divide offset by 16
-	mov		%3, %1				; Copy segment to scratch reg
-	add		%3, %4				; Add shifted offset to segment
-	mov		%1, %3				; Set normalized segment
-%endmacro
-
-
-;--------------------------------------------------------------------
 ; Reads sectors from hard disk using PIO transfer mode.
 ;
@@ -110,10 +86,11 @@
 	mov		[bp+PIOVARS.fnXfer], bx				; Store offset to transfer function
 	xchg	bx, ax
-	; Fall to HPIO_NormalizePtr
-
-;--------------------------------------------------------------------
-; Initializes PIOVARS members.
-;
-; HPIO_InitializePIOVARS
+	; Fall to HPIO_NormalizeDataPointer
+
+;--------------------------------------------------------------------
+; Normalizes far pointers so that offset overflows won't happen
+; when transferring data using PIO.
+;
+; HPIO_NormalizeDataPointer
 ;	Parameters:
 ;		ES:BX:	Ptr to source or destination data buffer
@@ -125,5 +102,5 @@
 ;ALIGN JUMP_ALIGN
 HPIO_NormalizeDataPointer:
-	HPIO_NORMALIZE_PTR	es, bx, ax, cx
+	NORMALIZE_FAR_POINTER es, bx, ax, cx
 	ret
 
