Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm	(revision 566)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm	(revision 567)
@@ -34,5 +34,5 @@
 IdeDPT_Finalize:
 
-%ifdef MODULE_FEATURE_SETS
+%ifdef MODULE_POWER_MANAGEMENT
 ;--------------------------------------------------------------------
 ; .DetectPowerManagementSupport
@@ -43,12 +43,11 @@
 ;		Nothing
 ;	Corrupts registers:
-;		Nothing
+;		AL
 ;--------------------------------------------------------------------
 .DetectPowerManagementSupport:
-	test	BYTE [es:si+ATA6.wSetSup82], A6_wSetSup82_POWERMAN
-	jz		SHORT .NoPowerManagementSupport
-	or		BYTE [di+DPT.bFlagsHigh], FLGH_DPT_POWER_MANAGEMENT_SUPPORTED
-.NoPowerManagementSupport:
-%endif ; MODULE_FEATURE_SETS
+	mov		al, [es:si+ATA6.wSetSup82]
+	and		al, A6_wSetSup82_POWERMAN	; A6_wSetSup82_POWERMAN (bit 3) is the same
+	or		[di+DPT.bFlagsHigh], al		; bit as FLGH_DPT_POWER_MANAGEMENT_SUPPORTED
+%endif ; MODULE_POWER_MANAGEMENT
 
 
Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDmaBlock.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDmaBlock.asm	(revision 566)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDmaBlock.asm	(revision 567)
@@ -2,6 +2,4 @@
 ; Description	:	IDE Read/Write functions for transferring block using DMA.
 ;					These functions should only be called from IdeTransfer.asm.
-
-; Modified JJP 05-Jun-13
 
 ;
@@ -91,5 +89,5 @@
 	; Calculate bytes for first page
 	mov		ax, di
-	neg		ax			; 2s compliment
+	neg		ax			; 2s complement
 
 	; If DI was zero carry flag will be cleared (and set otherwise)
@@ -187,7 +185,17 @@
 	jz		SHORT .TransferNextBlock	; All bytes transferred?
 %else	; Fast DMA code - perform computed number of transfers, then check DMA status register to be sure
-	add		cx, BYTE 15					; We'll divide transfers in 16-byte atomic transfers,
-	eSHR_IM	cx, 4						; so include any partial block, which will be terminated
-ALIGN JUMP_ALIGN						; by the DMA controller raising T/C
+	; We'll divide transfers in 16-byte atomic transfers, so include any partial block, which will be terminated by the DMA controller raising T/C
+	add		cx, BYTE 15
+
+%ifdef USE_186
+	shr		cx, 4
+%else
+	xchg	cx, ax
+	mov		cl, 4
+	shr		ax, cl
+	xchg	cx, ax
+%endif
+
+ALIGN JUMP_ALIGN
 .TransferNextDmaBlock:
 	out		dx, al						; Transfer up to 16 bytes to/from XT-CF card
Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeError.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeError.asm	(revision 566)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeError.asm	(revision 567)
@@ -20,4 +20,10 @@
 ; Section containing code
 SECTION .text
+
+%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
+	%if $ <> PollBsyOnly.End
+		%error "IdeError.asm must come immediately after IdeWait.asm (PollBsyOnly falls into IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL)!"
+	%endif
+%endif
 
 ;--------------------------------------------------------------------
Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdePioBlock.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdePioBlock.asm	(revision 566)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdePioBlock.asm	(revision 567)
@@ -18,6 +18,4 @@
 ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 ;
-
-; Modified by JJP for XT-CFv3 support, Mar-13
 
 ; Section containing code
Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm	(revision 566)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm	(revision 567)
@@ -228,10 +228,9 @@
 
 	; Get transfer function based on bus type
-	xchg	ax, bx								; Lookup table offset to AX
-	mov		bl, [di+DPT_ATA.bDevice]
+	mov		al, [di+DPT_ATA.bDevice]
+	add		bx, ax
 %ifdef MODULE_8BIT_IDE_ADVANCED
-	mov		dl, bl
-%endif
-	add		bx, ax
+	cmp		al, DEVICE_8BIT_XTCF_DMA
+%endif
 	mov		ax, [cs:bx]							; Load offset to transfer function
 	mov		[bp+PIOVARS.fnXfer], ax
@@ -239,9 +238,9 @@
 	; Normalize pointer for PIO-transfers and convert to physical address for DMA transfers
 %ifdef MODULE_8BIT_IDE_ADVANCED
-	cmp		dl, DEVICE_8BIT_XTCF_DMA
 	jb		SHORT IdeTransfer_NormalizePointerInESSI
 
 	; Convert ES:SI to physical address
-%ifdef USE_186			; Bytes	EU Cycles(286)
+%ifdef USE_186
+						; Bytes	EU Cycles(286)
 	mov		ax, es		; 2		2
 	rol		ax, 4		; 3		9
@@ -255,6 +254,4 @@
 						; 18	24
 %else ; 808x
-
-%if 0
 						; Bytes	EU Cycles(808x)
 	mov		al, 4		; 2		4
@@ -279,5 +276,5 @@
 ; In other words, we could use a real world test here.
 ;
-%endif ; 0
+%if 0
 						; Bytes	EU Cycles(808x/286)
 	xor		dx, dx		; 2		3/2
@@ -291,7 +288,9 @@
 	mov		es, dx		; 2		2/2
 	;------------------------------------
-%endif					; 26	29/26
-	clc
-	ret
+						; 26	29/26
+%endif ; 0
+%endif
+
+	ret		; With CF cleared (taken care of by the physical address conversion)
 %endif ; MODULE_8BIT_IDE_ADVANCED
 	; Fall to IdeTransfer_NormalizePointerInESSI if no MODULE_8BIT_IDE_ADVANCED
Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeWait.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeWait.asm	(revision 566)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeWait.asm	(revision 567)
@@ -130,3 +130,5 @@
 	call	Timer_SetCFifTimeout				; Update timeout counter
 	jnc		SHORT .PollLoop						; Loop if time left (sets CF on timeout)
-	jmp		SHORT IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL
+.End:											; Label used for sanity check during assembly
+	; Fall to IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL
+
