Index: trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc
===================================================================
--- trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc	(revision 360)
+++ trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc	(revision 361)
@@ -100,7 +100,7 @@
 ; Device types for IDEVARS.bDevice
 ;
-DEVICE_8BIT_DUAL_PORT_XTIDE				EQU	(0<<1)
-DEVICE_XTIDE_WITH_REVERSED_A3_AND_A0	EQU	(1<<1)
-DEVICE_8BIT_SINGLE_PORT					EQU	(2<<1)
+DEVICE_XTIDE_REV1						EQU	(0<<1)
+DEVICE_XTIDE_REV2						EQU	(1<<1)	; Or rev 1 with swapped A0 and A3 (chuck mod)
+DEVICE_FAST_XTIDE						EQU	(2<<1)	; (CPLD v2 project)
 DEVICE_16BIT_ATA						EQU	(3<<1)
 DEVICE_32BIT_ATA						EQU	(4<<1)
Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm	(revision 360)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm	(revision 361)
@@ -47,6 +47,9 @@
 ;--------------------------------------------------------------------
 IdeDPT_StoreReversedAddressLinesFlagIfNecessary:
-	cmp		BYTE [cs:bp+IDEVARS.bDevice], DEVICE_XTIDE_WITH_REVERSED_A3_AND_A0
+	cmp		BYTE [cs:bp+IDEVARS.bDevice], DEVICE_XTIDE_REV2
+	je		SHORT .SetFlagForSwappedA0andA3
+	cmp		BYTE [cs:bp+IDEVARS.bDevice], DEVICE_FAST_XTIDE
 	jne		SHORT .EndDPT
+.SetFlagForSwappedA0andA3:
 	or		BYTE [di+DPT.bFlagsHigh], FLGH_DPT_REVERSED_A0_AND_A3
 
Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm	(revision 360)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm	(revision 361)
@@ -203,9 +203,8 @@
 
 ;--------------------------------------------------------------------
-; DualByteReadForXtide		Dual port 8-bit XTIDE PIO read transfer
-; SingleByteRead			Single port 8-bit PIO read transfer
-; WordReadForXTIDEmod		8088/8086 compatible 16-bit IDE PIO read transfer
-; WordReadForXTplusAndAT	Normal 16-bit IDE PIO read transfer
-; DWordRead					VLB/PCI 32-bit IDE PIO read transfer
+; ReadBlockFromXtideRev1		XTIDE rev 1
+; ReadBlockFromXtideRev2		XTIDE rev 2 or rev 1 with swapped A0 and A3 (chuck-mod)
+; ReadBlockFrom16bitDataPort	Normal 16-bit IDE
+; ReadBlockFrom32bitDataPort	VLB/PCI 32-bit IDE
 ;	Parameters:
 ;		CX:		Block size in WORDs
@@ -218,5 +217,5 @@
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
-DualByteReadForXtide:
+ReadBlockFromXtideRev1:
 	eSHR_IM	cx, 2		; Loop unrolling
 	mov		bx, 8		; Bit mask for toggling data low/high reg
@@ -230,32 +229,8 @@
 	ret
 
-;----
-ALIGN JUMP_ALIGN
-SingleByteRead:
-%ifdef USE_186	; INS instruction available
-	shl		cx, 1		; WORD count to BYTE count
-	dec		cx			; Fix for CX overflowing on a 128 sector transfer
-	insb
-	rep insb
-%else			; If 8088/8086
-	shr		cx, 1		; WORD count to DWORD count
-ALIGN JUMP_ALIGN
-.InsdLoop:
-	in		al, dx
-	stosb				; Store to [ES:DI]
-	in		al, dx
-	stosb
-	in		al, dx
-	stosb
-	in		al, dx
-	stosb
-	loop	.InsdLoop
-%endif
-	ret
-
-;----
-%ifndef USE_186
-ALIGN JUMP_ALIGN
-WordReadForXTIDEmod:
+;--------------------------------------------------------------------
+%ifndef USE_186			; 8086/8088 compatible WORD read
+ALIGN JUMP_ALIGN
+ReadBlockFromXtideRev2:
 	times 2 shr	cx, 1	; WORD count to QWORD count
 ALIGN JUMP_ALIGN
@@ -273,14 +248,14 @@
 %endif
 
-;----
-ALIGN JUMP_ALIGN
-WordReadForXTplusAndAT:
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+ReadBlockFrom16bitDataPort:
 	rep
 	db		6Dh			; INSW (we want this in XT build)
 	ret
 
-;----
-ALIGN JUMP_ALIGN
-DWordRead:
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+ReadBlockFrom32bitDataPort:
 	shr		cx, 1		; WORD count to DWORD count
 	rep
@@ -291,9 +266,9 @@
 
 ;--------------------------------------------------------------------
-; DualByteWriteForXtide		Dual port 8-bit XTIDE PIO write transfer
-; SingleByteWrite			Single port 8-bit PIO write transfer
-; WordWriteForXTIDEmod		8088/8086 compatible 16-bit IDE PIO read transfer
-; WordWrite					Normal 16-bit IDE PIO write transfer
-; DWordWrite				VLB/PCI 32-bit IDE PIO write transfer
+; WriteBlockToXtideRev1			XTIDE rev 1
+; WriteBlockToXtideRev2			XTIDE rev 2 or rev 1 with swapped A0 and A3 (chuck-mod)
+; WriteBlockToFastXtide			Fast XTIDE (CPLD v2 project)
+; WriteBlockTo16bitDataPort		Normal 16-bit IDE
+; WriteBlockTo32bitDataPort		VLB/PCI 32-bit IDE
 ;	Parameters:
 ;		CX:		Block size in WORDs
@@ -306,5 +281,5 @@
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
-DualByteWriteForXtide:
+WriteBlockToXtideRev1:
 	push	ds
 	push	bx
@@ -324,35 +299,7 @@
 	ret
 
-;----
-ALIGN JUMP_ALIGN
-SingleByteWrite:
-%ifdef USE_186	; OUTS instruction available
-	shl		cx, 1		; WORD count to BYTE count
-	dec		cx			; Fix for CX overflowing on a 128 sector transfer
-	es outsb			; Source is ES segment
-	rep es outsb
-%else			; If 8088/8086
-	shr		cx, 1		; WORD count to DWORD count
-	push	ds			; Store DS
-	push	es			; Copy ES...
-	pop		ds			; ...to DS
-ALIGN JUMP_ALIGN
-.OutsdLoop:
-	lodsb				; Load from [DS:SI] to AL
-	out		dx, al
-	lodsb
-	out		dx, al
-	lodsb
-	out		dx, al
-	lodsb
-	out		dx, al
-	loop	.OutsdLoop
-	pop		ds			; Restore DS
-%endif
-	ret
-
-;---
-ALIGN JUMP_ALIGN
-WordWriteForXTIDEmod:
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+WriteBlockToXtideRev2:
 	push	ds
 	eSHR_IM	cx, 2		; Loop unrolling
@@ -369,7 +316,30 @@
 	ret
 
-;----
-ALIGN JUMP_ALIGN
-WordWrite:
+;--------------------------------------------------------------------
+%ifndef USE_186			; 8086/8088 compatible WORD write
+ALIGN JUMP_ALIGN
+WriteBlockToFastXtide:
+	times 2 shr	cx, 1	; WORD count to QWORD count
+	push	ds
+	push	es
+	pop		ds
+ALIGN JUMP_ALIGN
+.ReadNextQword:
+	lodsw				; Load 1st WORD from [DS:SI]
+	out		dx, ax		; Write 1st WORD
+	lodsw
+	out		dx, ax		; 2nd
+	lodsw
+	out		dx, ax		; 3rd
+	lodsw
+	out		dx, ax		; 4th
+	loop	.ReadNextQword
+	pop		ds
+	ret
+%endif
+
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+WriteBlockTo16bitDataPort:
 	es					; Source is ES segment
 	rep
@@ -377,6 +347,7 @@
 	ret
 
-ALIGN JUMP_ALIGN
-DWordWrite:
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+WriteBlockTo32bitDataPort:
 	shr		cx, 1		; WORD count to DWORD count
 	es					; Source is ES segment
@@ -387,21 +358,27 @@
 
 
+
 ; Lookup tables to get transfer function based on bus type
 ALIGN WORD_ALIGN
 g_rgfnPioRead:
-	dw		DualByteReadForXtide	; DEVICE_8BIT_DUAL_PORT_XTIDE
+	dw		ReadBlockFromXtideRev1		; DEVICE_XTIDE_REV1
 %ifdef USE_186
-	dw		WordReadForXTplusAndAT	; DEVICE_XTIDE_WITH_REVERSED_A3_AND_A0
+	dw		ReadBlockFrom16bitDataPort	; DEVICE_XTIDE_REV2
+	dw		ReadBlockFrom16bitDataPort	; DEVICE_FAST_XTIDE
 %else
-	dw		WordReadForXTIDEmod
-%endif
-	dw		SingleByteRead			; DEVICE_8BIT_SINGLE_PORT
-	dw		WordReadForXTplusAndAT	; DEVICE_16BIT_ATA
-	dw		DWordRead				; DEVICE_32BIT_ATA
+	dw		ReadBlockFromXtideRev2		; DEVICE_XTIDE_REV2
+	dw		ReadBlockFromXtideRev2		; DEVICE_FAST_XTIDE
+%endif
+	dw		ReadBlockFrom16bitDataPort	; DEVICE_16BIT_ATA
+	dw		ReadBlockFrom32bitDataPort	; DEVICE_32BIT_ATA
 
 g_rgfnPioWrite:
-	dw		DualByteWriteForXtide	; DEVICE_8BIT_DUAL_PORT_XTIDE
-	dw		WordWriteForXTIDEmod	; DEVICE_XTIDE_WITH_REVERSED_A3_AND_A0
-	dw		SingleByteWrite			; DEVICE_8BIT_SINGLE_PORT
-	dw		WordWrite				; DEVICE_16BIT_ATA
-	dw		DWordWrite				; DEVICE_32BIT_ATA
+	dw		WriteBlockToXtideRev1		; DEVICE_XTIDE_REV1
+	dw		WriteBlockToXtideRev2		; DEVICE_XTIDE_REV2
+%ifdef USE_186
+	dw		WriteBlockTo16bitDataPort	; DEVICE_FAST_XTIDE
+%else
+	dw		WriteBlockToFastXtide		; DEVICE_FAST_XTIDE
+%endif
+	dw		WriteBlockTo16bitDataPort	; DEVICE_16BIT_ATA
+	dw		WriteBlockTo32bitDataPort	; DEVICE_32BIT_ATA
Index: trunk/XTIDE_Universal_BIOS/Src/Main.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Main.asm	(revision 360)
+++ trunk/XTIDE_Universal_BIOS/Src/Main.asm	(revision 361)
@@ -98,5 +98,5 @@
 	at	ROMVARS.ideVars2+IDEVARS.wPort,			dw	DEVICE_XTIDE_DEFAULT_PORT			; Controller Command Block base port
 	at	ROMVARS.ideVars2+IDEVARS.wPortCtrl,		dw	DEVICE_XTIDE_DEFAULT_PORTCTRL		; Controller Control Block base port
-	at	ROMVARS.ideVars2+IDEVARS.bDevice,		db	DEVICE_8BIT_DUAL_PORT_XTIDE
+	at	ROMVARS.ideVars2+IDEVARS.bDevice,		db	DEVICE_XTIDE_REV1
 	at	ROMVARS.ideVars2+IDEVARS.bIRQ,			db	0
 	at	ROMVARS.ideVars2+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,	db	DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE
@@ -130,5 +130,5 @@
 	at	ROMVARS.ideVars0+IDEVARS.bDevice,		db	DEVICE_JRIDE_ISA
 %else
-	at	ROMVARS.ideVars0+IDEVARS.bDevice,		db	DEVICE_8BIT_DUAL_PORT_XTIDE
+	at	ROMVARS.ideVars0+IDEVARS.bDevice,		db	DEVICE_XTIDE_REV1
 %endif
 	at	ROMVARS.ideVars0+IDEVARS.bIRQ,			db	0				; IRQ
