Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm	(revision 443)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm	(revision 444)
@@ -203,18 +203,13 @@
 ALIGN JUMP_ALIGN
 IdeCommand_SelectDrive:
-%if 0
-	; Wait until neither Master or Slave Drive is busy
-	mov		bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY)
-	cmp		BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE
-	eCMOVE	bh, TIMEOUT_IDENTIFY_DEVICE
-	call	IdeWait_PollStatusFlagInBLwithTimeoutInBH
-%endif
+	; We use different timeout value when detecting drives.
+	; This prevents unnecessary long delays when drive is not present.
+	mov		bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY)
+	cmp		WORD [RAMVARS.wDrvDetectSignature], RAMVARS_DRV_DETECT_SIGNATURE
+	eCMOVE	bh, TIMEOUT_SELECT_DRIVE_DURING_DRIVE_DETECTION
 
 	; Select Master or Slave Drive
 	mov		al, [bp+IDEPACK.bDrvAndHead]
 	OUTPUT_AL_TO_IDE_REGISTER	DRIVE_AND_HEAD_SELECT_REGISTER
-	mov		bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY)
-	cmp		BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE
-	eCMOVE	bh, TIMEOUT_IDENTIFY_DEVICE
 	call	IdeWait_PollStatusFlagInBLwithTimeoutInBH
 
Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm	(revision 443)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm	(revision 444)
@@ -228,4 +228,5 @@
 ; ReadBlockFromXtideRev1		XTIDE rev 1
 ; ReadBlockFromXtideRev2		XTIDE rev 2 or rev 1 with swapped A0 and A3 (chuck-mod)
+; ReadBlockFrom8bitDataPort		CF-XT when using 8-bit PIO
 ; ReadBlockFrom16bitDataPort	Normal 16-bit IDE
 ; ReadBlockFrom32bitDataPort	VLB/PCI 32-bit IDE
@@ -241,77 +242,82 @@
 %ifdef MODULE_8BIT_IDE
 
-ALIGN JUMP_ALIGN
-ReadBlockFromXtideRev1:
-	UNROLL_SECTORS_IN_CX_TO_QWORDS
-	mov		bl, 8		; Bit mask for toggling data low/high reg
-ALIGN JUMP_ALIGN
-.InswLoop:
-	XTIDE_INSW
-	XTIDE_INSW
-	XTIDE_INSW
-	XTIDE_INSW
-	loop	.InswLoop
-	ret
-
-;--------------------------------------------------------------------
-%ifndef USE_186			; 8086/8088 compatible WORD read
-ALIGN JUMP_ALIGN
-ReadBlockFromXtideRev2:
-	UNROLL_SECTORS_IN_CX_TO_QWORDS
-ALIGN JUMP_ALIGN
-.ReadNextQword:
-	in		ax, dx		; Read 1st WORD
-	stosw				; Store 1st WORD to [ES:DI]
-	in		ax, dx
-	stosw				; 2nd
-	in		ax, dx
-	stosw				; 3rd
-	in		ax, dx
-	stosw				; 4th
-	loop	.ReadNextQword
-	ret
-%endif
-
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-ReadBlockFromXTCF:
-	UNROLL_SECTORS_IN_CX_TO_DWORDS
-ALIGN JUMP_ALIGN
-.ReadNextDword:
-	in		al, dx		; Read 1st BYTE
-	stosb				; Store 1st BYTE to [ES:DI]
-	in		al, dx
-	stosb
-
-	in		al, dx
-	stosb
-	in		al, dx
-	stosb
-	loop	.ReadNextDword
-	ret
-
+	ALIGN JUMP_ALIGN
+	ReadBlockFromXtideRev1:
+		UNROLL_SECTORS_IN_CX_TO_QWORDS
+		mov		bl, 8		; Bit mask for toggling data low/high reg
+	ALIGN JUMP_ALIGN
+	.InswLoop:
+		XTIDE_INSW
+		XTIDE_INSW
+		XTIDE_INSW
+		XTIDE_INSW
+		loop	.InswLoop
+		ret
+
+	;--------------------------------------------------------------------
+	%ifndef USE_186			; 8086/8088 compatible WORD read
+		ALIGN JUMP_ALIGN
+		ReadBlockFromXtideRev2:
+			UNROLL_SECTORS_IN_CX_TO_QWORDS
+		ALIGN JUMP_ALIGN
+		.ReadNextQword:
+			in		ax, dx		; Read 1st WORD
+			stosw				; Store 1st WORD to [ES:DI]
+			in		ax, dx
+			stosw				; 2nd
+			in		ax, dx
+			stosw				; 3rd
+			in		ax, dx
+			stosw				; 4th
+			loop	.ReadNextQword
+			ret
+	%endif
+
+	;--------------------------------------------------------------------
+	%ifdef USE_186
+		ALIGN JUMP_ALIGN
+		ReadBlockFrom8bitDataPort:
+			shl		cx, 9		; Sectors to BYTEs
+			rep insb
+			ret
+
+	%else ; If 8088/8086
+			ALIGN JUMP_ALIGN
+		ReadBlockFrom8bitDataPort:
+			UNROLL_SECTORS_IN_CX_TO_DWORDS
+		ALIGN JUMP_ALIGN
+		.ReadNextDword:
+			in		al, dx		; Read 1st BYTE
+			stosb				; Store 1st BYTE to [ES:DI]
+			in		al, dx
+			stosb
+
+			in		al, dx
+			stosb
+			in		al, dx
+			stosb
+			loop	.ReadNextDword
+			ret
+	%endif
 %endif	; MODULE_8BIT_IDE
 
 ;--------------------------------------------------------------------
 %ifdef USE_186
-ALIGN JUMP_ALIGN
-ReadBlockFrom16bitDataPort:
-	xchg	cl, ch		; Sectors to WORDs
-	rep
-	db		6Dh			; INSW (we want this in XT build)
-	ret
+	ALIGN JUMP_ALIGN
+	ReadBlockFrom16bitDataPort:
+		xchg	cl, ch		; Sectors to WORDs
+		rep insw
+		ret
 %endif
 
 ;--------------------------------------------------------------------
 %ifdef USE_AT
-ALIGN JUMP_ALIGN
-ReadBlockFrom32bitDataPort:
-	db		0C1h		; SHL
-	db		0E1h		; CX
-	db		7			; 7	(Sectors to DWORDs)
-	rep
-	db		66h			; Override operand size to 32-bit
-	db		6Dh			; INSW/INSD
-	ret
+	ALIGN JUMP_ALIGN
+	ReadBlockFrom32bitDataPort:
+		shl		cx, 7		; Sectors to DWORDs
+		rep
+		db		66h			; Override operand size to 32-bit
+		db		6Dh			; INSW/INSD
+		ret
 %endif
 
@@ -320,5 +326,5 @@
 ; WriteBlockToXtideRev1			XTIDE rev 1
 ; WriteBlockToXtideRev2			XTIDE rev 2 or rev 1 with swapped A0 and A3 (chuck-mod)
-; WriteBlockToFastXtide			Fast XTIDE (CPLD v2 project)
+; WriteBlockTo8bitDataPort		XT-CF when using 8-bit PIO
 ; WriteBlockTo16bitDataPort		Normal 16-bit IDE
 ; WriteBlockTo32bitDataPort		VLB/PCI 32-bit IDE
@@ -334,61 +340,70 @@
 %ifdef MODULE_8BIT_IDE
 
-ALIGN JUMP_ALIGN
-WriteBlockToXtideRev1:
-	push	ds
-	UNROLL_SECTORS_IN_CX_TO_QWORDS
-	mov		bl, 8		; Bit mask for toggling data low/high reg
-	push	es			; Copy ES...
-	pop		ds			; ...to DS
-ALIGN JUMP_ALIGN
-.OutswLoop:
-	XTIDE_OUTSW
-	XTIDE_OUTSW
-	XTIDE_OUTSW
-	XTIDE_OUTSW
-	loop	.OutswLoop
-	pop		ds
-	ret
-
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-WriteBlockToXtideRev2:
-	UNROLL_SECTORS_IN_CX_TO_QWORDS
-	push	ds
-	push	es			; Copy ES...
-	pop		ds			; ...to DS
-ALIGN JUMP_ALIGN
-.WriteNextQword:
-	XTIDE_MOD_OUTSW
-	XTIDE_MOD_OUTSW
-	XTIDE_MOD_OUTSW
-	XTIDE_MOD_OUTSW
-	loop	.WriteNextQword
-	pop		ds
-	ret
-
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-WriteBlockToXTCF:
-	UNROLL_SECTORS_IN_CX_TO_DWORDS
-	push	ds
-	push	es
-	pop		ds
-ALIGN JUMP_ALIGN
-.WriteNextDword:
-	lodsb				; Load 1st BYTE from [DS:SI]
-	out		dx, al		; Write 1st BYTE
-	lodsb
-	out		dx, al
-
-	lodsb
-	out		dx, al
-	lodsb
-	out		dx, al
-	loop	.WriteNextDword
-	pop		ds
-	ret
+	ALIGN JUMP_ALIGN
+	WriteBlockToXtideRev1:
+		push	ds
+		UNROLL_SECTORS_IN_CX_TO_QWORDS
+		mov		bl, 8		; Bit mask for toggling data low/high reg
+		push	es			; Copy ES...
+		pop		ds			; ...to DS
+	ALIGN JUMP_ALIGN
+	.OutswLoop:
+		XTIDE_OUTSW
+		XTIDE_OUTSW
+		XTIDE_OUTSW
+		XTIDE_OUTSW
+		loop	.OutswLoop
+		pop		ds
+		ret
+
+	;--------------------------------------------------------------------
+	ALIGN JUMP_ALIGN
+	WriteBlockToXtideRev2:
+		UNROLL_SECTORS_IN_CX_TO_QWORDS
+		push	ds
+		push	es			; Copy ES...
+		pop		ds			; ...to DS
+	ALIGN JUMP_ALIGN
+	.WriteNextQword:
+		XTIDE_MOD_OUTSW
+		XTIDE_MOD_OUTSW
+		XTIDE_MOD_OUTSW
+		XTIDE_MOD_OUTSW
+		loop	.WriteNextQword
+		pop		ds
+		ret
+
+	;--------------------------------------------------------------------
+	%ifdef USE_186
+		ALIGN JUMP_ALIGN
+		WriteBlockTo8bitDataPort:
+			shl		cx, 9		; Sectors to BYTEs
+			es					; Source is ES segment
+			rep outsb
+			ret
+
+	%else ; If 8088/8086
+		ALIGN JUMP_ALIGN
+		WriteBlockTo8bitDataPort:
+			UNROLL_SECTORS_IN_CX_TO_DWORDS
+			push	ds
+			push	es
+			pop		ds
+		ALIGN JUMP_ALIGN
+		.WriteNextDword:
+			lodsb				; Load 1st BYTE from [DS:SI]
+			out		dx, al		; Write 1st BYTE
+			lodsb
+			out		dx, al
+
+			lodsb
+			out		dx, al
+			lodsb
+			out		dx, al
+			loop	.WriteNextDword
+			pop		ds
+			ret
+	%endif
 %endif	; MODULE_8BIT_IDE
-
 
 ;--------------------------------------------------------------------
@@ -398,6 +413,5 @@
 	xchg	cl, ch		; Sectors to WORDs
 	es					; Source is ES segment
-	rep
-	db		6Fh			; OUTSW (we want this in XT build)
+	rep outsw
 	ret
 
@@ -405,7 +419,5 @@
 ALIGN JUMP_ALIGN
 WriteBlockTo32bitDataPort:
-	db		0C1h		; SHL
-	db		0E1h		; CX
-	db		7			; 7	(Sectors to DWORDs)
+	shl		cx, 7		; Sectors to DWORDs
 	es					; Source is ES segment
 	rep
@@ -422,5 +434,5 @@
 %ifdef MODULE_8BIT_IDE
 		dw		0							; 0, DEVICE_8BIT_JRIDE_ISA
-		dw		ReadBlockFromXTCF			; 1, DEVICE_8BIT_XTCF
+		dw		ReadBlockFrom8bitDataPort	; 1, DEVICE_8BIT_XTCF
 	%ifdef USE_186
 		dw		ReadBlockFrom16bitDataPort	; 2, DEVICE_8BIT_XTIDE_REV2
@@ -442,5 +454,5 @@
 %ifdef MODULE_8BIT_IDE
 		dw		0							; 0, DEVICE_8BIT_JRIDE_ISA
-		dw		WriteBlockToXTCF			; 1, DEVICE_8BIT_XTCF
+		dw		WriteBlockTo8bitDataPort	; 1, DEVICE_8BIT_XTCF
 		dw		WriteBlockToXtideRev2		; 2, DEVICE_XTIDE_REV2
 		dw		WriteBlockToXtideRev1		; 3, DEVICE_XTIDE_REV1
Index: trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm	(revision 443)
+++ trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm	(revision 444)
@@ -75,5 +75,6 @@
 	xor		di, di
 	call	Memory_ZeroESDIwithSizeInCX
-	mov		WORD [RAMVARS.wSignature], RAMVARS_SIGNATURE
+	mov		WORD [RAMVARS.wDrvDetectSignature], RAMVARS_DRV_DETECT_SIGNATURE
+	mov		WORD [RAMVARS.wSignature], RAMVARS_RAM_SIGNATURE
 	; Fall to .InitializeInt13hStackChangeVariables
 
@@ -151,5 +152,5 @@
 	mov		ds, di					; EBDA segment to DS
 	add		di, BYTE 64				; DI to next stolen kB
-	cmp		WORD [RAMVARS.wSignature], RAMVARS_SIGNATURE
+	cmp		WORD [RAMVARS.wSignature], RAMVARS_RAM_SIGNATURE
 	jne		SHORT .LoopStolenKBs	; Loop until sign found (always found eventually)
 	ret
