Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HError.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HError.asm	(revision 84)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HError.asm	(revision 86)
@@ -1,7 +1,3 @@
-; File name		:	HError.asm
 ; Project name	:	IDE BIOS
-; Created date	:	30.11.2007
-; Last update	:	24.8.2010
-; Author		:	Tomi Tilli
 ; Description	:	Error checking functions for BIOS Hard disk functions.
 
@@ -34,6 +30,11 @@
 ALIGN JUMP_ALIGN
 HError_ProcessErrorsAfterPollingBSY:
+%ifndef USE_186
 	call	HError_GetStatusAndErrorRegistersToAXandStoreThemToBDA
 	jmp		SHORT GetBiosErrorCodeToAHfromStatusAndErrorRegistersInAX
+%else
+	push	GetBiosErrorCodeToAHfromStatusAndErrorRegistersInAX
+	; Fall through to HError_GetStatusAndErrorRegistersToAXandStoreThemToBDA
+%endif
 
 
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HIRQ.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HIRQ.asm	(revision 84)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HIRQ.asm	(revision 86)
@@ -1,7 +1,3 @@
-; File name		:	HIRQ.asm
 ; Project name	:	IDE BIOS
-; Created date	:	11.12.2009
-; Last update	:	24.8.2010
-; Author		:	Tomi Tilli
 ; Description	:	Interrupt handling related functions.
 
@@ -41,5 +37,5 @@
 	LOAD_BDA_SEGMENT_TO	ds, ax			; Zero AX
 	cli									; Disable interrupts
-	cmp		al, [ds:BDA.bHDTaskFlg]		; Task flag already set?
+	cmp		al, [BDA.bHDTaskFlg]		; Task flag already set?
 	jc		SHORT .ReturnFromWaitNotify	;  If so, skip OS notification
 
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HPIO.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HPIO.asm	(revision 84)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HPIO.asm	(revision 86)
@@ -1,11 +1,7 @@
-; File name		:	HPIO.asm
 ; Project name	:	IDE BIOS
-; Created date	:	14.12.2007
-; Last update	:	1.8.2010
-; Author		:	Tomi Tilli
 ; Description	:	PIO transfer functions.
 
 ; Structure containing variables for PIO transfer functions
-struc PIOVARS
+struc PIOVARS, -6
 	.fnXfer			resb	2	; Offset to transfer function
 	.wBlockSize		resb	2	; Block size in WORDs
@@ -63,5 +59,5 @@
 	; Create PIOVARS to stack
 	eENTER	PIOVARS_size, 0
-	sub		bp, BYTE PIOVARS_size			; SS:BP now points to PIOVARS
+
 	push	si
 	mov		si, g_rgfnPioRead				; Offset to read function lookup
@@ -75,8 +71,5 @@
 
 	; Destroy stack frame
-	rcl		al, 1							; CF to AL bit 0
-	add		bp, BYTE PIOVARS_size
 	eLEAVE
-	rcr		al, 1							; Restore CF
 	mov		di, bx							; Restore DI
 	pop		es
@@ -158,5 +151,5 @@
 .BlockLoop:
 	call	HStatus_WaitIrqOrDrq		; Wait until ready to transfer
-	jc		SHORT .RetError				; Return if error (code in AH)
+	jc		SHORT HPIO_WriteToDrive.RetError	; Return if error (code in AH)
 	mov		cx, [bp+PIOVARS.wBlockSize]	; Load block size
 	sub		[bp+PIOVARS.wWordsLeft], cx	; Transferring last (possibly partial) block?
@@ -169,6 +162,4 @@
 	call	[bp+PIOVARS.fnXfer]			; Transfer possibly partial block
 	jmp		HStatus_WaitBsyDefTime		; Check for errors
-.RetError:
-	ret
 
 
@@ -195,5 +186,5 @@
 	; Create PIOVARS to stack
 	eENTER	PIOVARS_size, 0
-	sub		bp, BYTE PIOVARS_size			; SS:BP now points to PIOVARS
+
 	mov		si, g_rgfnPioWrite				; Offset to write function lookup
 	call	HPIO_InitializePIOVARS			; Store word count and block size
@@ -205,11 +196,10 @@
 
 	; Destroy stack frame
-	rcl		al, 1							; CF to AL bit 0
-	add		bp, BYTE PIOVARS_size
 	eLEAVE
-	rcr		al, 1							; Restore CF
+
 	pop		si
 	pop		es
 	ret
+
 
 ;--------------------------------------------------------------------
@@ -243,5 +233,5 @@
 	jnc		SHORT .BlockLoop				; If no error, loop while blocks left
 .RetError:
-	ret
+	ret										; This ret is shared with HPIO_ReadFromDrive
 ALIGN JUMP_ALIGN
 .XferLastBlock:
