Index: trunk/Assembly_Library/Inc/Display.inc
===================================================================
--- trunk/Assembly_Library/Inc/Display.inc	(revision 369)
+++ trunk/Assembly_Library/Inc/Display.inc	(revision 370)
@@ -50,5 +50,7 @@
 	.SetCursorShapeFromAX							resb	2
 	.SetCursorCoordinatesFromAX						resb	2
+%ifndef EXCLUDE_FROM_XTIDECFG
 	.SetNewPageFromAL								resb	2
+%endif
 	.SynchronizeDisplayContextToHardware			resb	2
 
Index: trunk/Assembly_Library/Inc/Menu.inc
===================================================================
--- trunk/Assembly_Library/Inc/Menu.inc	(revision 369)
+++ trunk/Assembly_Library/Inc/Menu.inc	(revision 370)
@@ -80,5 +80,7 @@
 	.RefreshInformation							resb	2
 
+%ifndef EXCLUDE_FROM_XTIDECFG
 	.StartSelectionTimeoutWithTicksInAX			resb	2
+%endif
 
 %ifdef INCLUDE_MENU_DIALOGS
Index: trunk/Assembly_Library/Src/AssemblyLibrary.asm
===================================================================
--- trunk/Assembly_Library/Src/AssemblyLibrary.asm	(revision 369)
+++ trunk/Assembly_Library/Src/AssemblyLibrary.asm	(revision 370)
@@ -16,9 +16,9 @@
 	%include "DisplayCursor.asm"
 	%include "DisplayPage.asm"
-	%include "DisplayPrint.asm"					; must come before DisplayFormat/DisplayFormatCompressed			
+	%include "DisplayPrint.asm"					; must come before DisplayFormat/DisplayFormatCompressed
 %ifdef MODULE_STRINGS_COMPRESSED
 	%include "DisplayFormatCompressed.asm"
 %else
-	%include "DisplayFormat.asm"		
+	%include "DisplayFormat.asm"
 %endif
 %endif
@@ -34,5 +34,5 @@
   %ifndef KEYBOARD_JUMP_ALIGN
 	%define KEYBOARD_JUMP_ALIGN 1
-  %endif		
+  %endif
 	%include "Keyboard.asm"
 %endif
@@ -41,5 +41,5 @@
   %ifndef MENU_JUMP_ALIGN
 	%define MENU_JUMP_ALIGN 1
-  %endif				
+  %endif
 	%include "CharOutLineSplitter.asm"
 	%include "Menu.asm"
@@ -72,5 +72,5 @@
   %ifndef STRING_JUMP_ALIGN
 	%define STRING_JUMP_ALIGN 1
-  %endif				
+  %endif
 	%include "Char.asm"
 	%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
@@ -82,15 +82,17 @@
 %ifdef INCLUDE_SERIAL_LIBRARY
 	%include "Serial.inc"
-%endif		
+%endif
 %ifdef INCLUDE_SERIALSERVER_LIBRARY
 	%include "SerialServer.asm"
 	%include "SerialServerScan.asm"
 	%define INCLUDE_TIME_LIBRARY
-%endif		
+%endif
 
 %ifdef INCLUDE_TIME_LIBRARY
 	%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
 		%include "Delay.asm"
-		%include "SystemTimer.asm"
+		%ifndef EXCLUDE_FROM_XTIDECFG
+			%include "SystemTimer.asm"
+		%endif
 	%endif
 	%include "TimerTicks.asm"
@@ -100,5 +102,5 @@
   %ifndef UTIL_SIZE_JUMP_ALIGN
 	%define UTIL_SIZE_JUMP_ALIGN 1
-  %endif		
+  %endif
 	%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
 		%include "Bit.asm"
Index: trunk/Assembly_Library/Src/Display/Display.asm
===================================================================
--- trunk/Assembly_Library/Src/Display/Display.asm	(revision 369)
+++ trunk/Assembly_Library/Src/Display/Display.asm	(revision 370)
@@ -68,5 +68,7 @@
 	%define SetCursorShapeFromAX							DisplayCursor_SetShapeFromAX
 	%define SetCursorCoordinatesFromAX						DisplayCursor_SetCoordinatesFromAX
+%ifndef EXCLUDE_FROM_XTIDECFG
 	%define SetNewPageFromAL								DisplayPage_SetFromAL
+%endif
 	%define SynchronizeDisplayContextToHardware				DisplayContext_SynchronizeToHardware
 
Index: trunk/Assembly_Library/Src/Display/DisplayPage.asm
===================================================================
--- trunk/Assembly_Library/Src/Display/DisplayPage.asm	(revision 369)
+++ trunk/Assembly_Library/Src/Display/DisplayPage.asm	(revision 370)
@@ -15,5 +15,5 @@
 ;		AX, DX
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS OR EXCLUDE_FROM_XTIDECFG
 ALIGN DISPLAY_JUMP_ALIGN
 DisplayPage_SetFromAL:
Index: trunk/Assembly_Library/Src/Menu/Menu.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/Menu.asm	(revision 369)
+++ trunk/Assembly_Library/Src/Menu/Menu.asm	(revision 370)
@@ -50,5 +50,7 @@
 	%define RefreshInformation								MenuText_RefreshInformation
 
+%ifndef EXCLUDE_FROM_XTIDECFG
 	%define StartSelectionTimeoutWithTicksInAX				MenuTime_StartSelectionTimeoutWithTicksInAX
+%endif
 
 %ifdef INCLUDE_MENU_DIALOGS
Index: trunk/Assembly_Library/Src/Menu/MenuTime.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/MenuTime.asm	(revision 369)
+++ trunk/Assembly_Library/Src/Menu/MenuTime.asm	(revision 370)
@@ -15,4 +15,5 @@
 ;		AX, BX
 ;--------------------------------------------------------------------
+%ifndef EXCLUDE_FROM_XTIDECFG
 ALIGN MENU_JUMP_ALIGN
 MenuTime_StartSelectionTimeoutWithTicksInAX:
@@ -23,4 +24,5 @@
 	pop		ds
 	ret
+%endif
 
 
Index: trunk/Assembly_Library/Src/Time/TimerTicks.asm
===================================================================
--- trunk/Assembly_Library/Src/Time/TimerTicks.asm	(revision 369)
+++ trunk/Assembly_Library/Src/Time/TimerTicks.asm	(revision 370)
@@ -24,4 +24,5 @@
 ;--------------------------------------------------------------------
 %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XTIDECFG
 ALIGN JUMP_ALIGN
 TimerTicks_GetHoursToAXfromTicksInDXAX:
@@ -29,4 +30,5 @@
 	div		cx		; Divide DX:AX by CX, Hours to AX, remainder ticks to DX
 	ret
+%endif ; EXCLUDE_FROM_XTIDECFG
 
 ALIGN JUMP_ALIGN
@@ -37,5 +39,5 @@
 	div		cx		; Divide DX:AX by CX, Minutes to AX, remainder ticks to DX
 	ret
-%endif
+%endif ; EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
 
 ALIGN JUMP_ALIGN
Index: trunk/Assembly_Library/Src/Util/Registers.asm
===================================================================
--- trunk/Assembly_Library/Src/Util/Registers.asm	(revision 369)
+++ trunk/Assembly_Library/Src/Util/Registers.asm	(revision 370)
@@ -69,10 +69,10 @@
 ;	Corrupts registers:
 ;		AX, CX
-; 
-; Inline of NORMALIZE_FAR_POINTER so that we can share the last 2/3 of the 
+;
+; Inline of NORMALIZE_FAR_POINTER so that we can share the last 2/3 of the
 ; routine with Registers_NormalizeFinish.
-; 
+;
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS OR EXCLUDE_FROM_XTIDECFG
 ALIGN JUMP_ALIGN
 Registers_NormalizeESSI:
@@ -87,6 +87,6 @@
 ;;; fall-through
 
-ALIGN JUMP_ALIGN		
-Registers_NormalizeFinish:		
+ALIGN JUMP_ALIGN
+Registers_NormalizeFinish:
 	eSHR_IM		cx, 4
 	mov			ax, es
Index: trunk/XTIDE_Universal_BIOS/Inc/ATA_ID.inc
===================================================================
--- trunk/XTIDE_Universal_BIOS/Inc/ATA_ID.inc	(revision 369)
+++ trunk/XTIDE_Universal_BIOS/Inc/ATA_ID.inc	(revision 370)
@@ -21,6 +21,6 @@
 PIO_3_MIN_ADDRESS_VALID_NS	EQU		30
 PIO_4_MIN_ADDRESS_VALID_NS	EQU		25
-PIO_5_MIN_ADDRESS_VALID_NS	EQU		25		; Could not find info
-PIO_6_MIN_ADDRESS_VALID_NS	EQU		25		; Could not find info
+PIO_5_MIN_ADDRESS_VALID_NS	EQU		15
+PIO_6_MIN_ADDRESS_VALID_NS	EQU		10
 
 ; PIO Minimum Active Times (t2)
@@ -30,9 +30,9 @@
 PIO_3_MIN_ACTIVE_TIME_NS	EQU		80
 PIO_4_MIN_ACTIVE_TIME_NS	EQU		70
-PIO_5_MIN_ACTIVE_TIME_NS	EQU		70		; Could not find info
-PIO_6_MIN_ACTIVE_TIME_NS	EQU		70		; Could not find info
+PIO_5_MIN_ACTIVE_TIME_NS	EQU		65
+PIO_6_MIN_ACTIVE_TIME_NS	EQU		55
 
 ; PIO Minimum Recovery Times or Inactive Times (t2i) can be calculated
-; from Minimum Cycle Time (t0) - Minimum Active Time (t2) - Address Valid Time (t1). 
+; from Minimum Cycle Time (t0) - Minimum Active Time (t2) - Address Valid Time (t1).
 ; I'm not sure about this calculation so correct me if I'm wrong!
 ; Recovery time should be calculated at run time since Cycle Time t0 can be
@@ -54,5 +54,5 @@
 	.wBpTrck	resw 1	; 4F, Number of unformatted bytes per track
 	.wBpSect	resw 1	; 5F, Number of unformatted bytes per sector
-	.wSPT		resw 1	; 6F, Number of sectors per track 
+	.wSPT		resw 1	; 6F, Number of sectors per track
 				resw 3	; 7...9X
 	.strSerial	resb 20	; 10...19F, Serial number (20 ASCII characters, 0000h=not specified)
@@ -136,5 +136,5 @@
 				resw 1	; 4X
 				resw 1	; 5X
-	.wSPT		resw 1	; 6F, Number of logical sectors per track 
+	.wSPT		resw 1	; 6F, Number of logical sectors per track
 				resw 3	; 7...9X
 	.strSerial	resb 20	; 10...19F, Serial number (20 ASCII characters, 0000h=not specified)
@@ -166,5 +166,5 @@
 	.bBlockSel	resb 1	; 59[0-7]V, Current setting for number of sectors that
 						;           can be transferred per interrupt on R/W multiple command
-	.bBlockFlgs	resb 1	; 59[8-15]VR, bit 0 set if Multiple sector setting is valid	
+	.bBlockFlgs	resb 1	; 59[8-15]VR, bit 0 set if Multiple sector setting is valid
 	.dwLBACnt	resd 1	; 60...61F, Total number of user addressable sectors (LBA mode only)
 	.bSDMASupp	resb 1	; 62[0-7]F, Single word DMA transfer modes supported
@@ -172,5 +172,5 @@
 	.bMDMASupp	resb 1	; 63[0-7]F, Multiword DMA transfer modes supported
 	.bMDMAAct	resb 1	; 63[8-15]V, Multiword DMA transfer mode active
-	
+
 	; Words 64-70 are valid only if bit1 is set in .wFields (ATA2+)
 	.bPIOSupp	resb 1	; 64[0-7]F, Advanced PIO Transfer Modes Supported
@@ -220,5 +220,5 @@
 				resw 1	; 4X
 				resw 1	; 5X
-				resw 1	; 6X, Obsolete (Number of logical sectors per track) 
+				resw 1	; 6X, Obsolete (Number of logical sectors per track)
 				resw 2	; 7...8V, Reserved for assignment by the CompactFlash Association
 				resw 1	; 9X
Index: trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc
===================================================================
--- trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc	(revision 369)
+++ trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc	(revision 370)
@@ -91,5 +91,4 @@
 struc DPT_SERIAL
 	.dpt						resb	DPT_size
-
 	.wSerialPortAndBaud:
 	.bSerialPort				resb	1	; Serial connection I/O port address, divided by 4
@@ -126,5 +125,5 @@
 	jnz		SHORT %%LoadMaxValueToAX
 	cmp		ax, MAX_LCHS_CYLINDERS
-	jbe		SHORT %%NoNeedToModify
+	jb		SHORT %%NoNeedToModify
 %%LoadMaxValueToAX:
 	mov		ax, MAX_LCHS_CYLINDERS
Index: trunk/XTIDE_Universal_BIOS/Inc/IDE_8bit.inc
===================================================================
--- trunk/XTIDE_Universal_BIOS/Inc/IDE_8bit.inc	(revision 369)
+++ trunk/XTIDE_Universal_BIOS/Inc/IDE_8bit.inc	(revision 370)
@@ -30,5 +30,5 @@
 ; XTIDE_INSW
 ;	Parameters:
-;		BX:		Bit mask for toggling XTIDE data low/high reg
+;		BL:		Bit mask for toggling XTIDE data low/high reg
 ;		DX:		XTIDE Data Low Register address
 ;		ES:DI:	Ptr to destination buffer
@@ -41,13 +41,13 @@
 %ifdef USE_186	; INS instruction available
 	insb						; Load low byte from port DX to [ES:DI]
-	xor		dx, bx				; IDE Data Reg to XTIDE Data High Reg
+	xor		dl, bl				; IDE Data Reg to XTIDE Data High Reg
 	insb						; Load high byte from port DX to [ES:DI]
-	xor		dx, bx				; Restore to IDE Data Register
+	xor		dl, bl				; Restore to IDE Data Register
 %else	; If 8088/8086
 	in		al, dx				; Load low byte from port
-	xor		dx, bx				; IDE Data Reg to XTIDE Data High Reg
+	xor		dl, bl				; IDE Data Reg to XTIDE Data High Reg
 	stosb						; Store byte to [ES:DI]
 	in		al, dx				; Load high byte from port
-	xor		dx, bx				; Restore to IDE Data Register
+	xor		dl, bl				; Restore to IDE Data Register
 	stosb						; Store byte to [ES:DI]
 %endif
@@ -60,5 +60,5 @@
 ; XTIDE_OUTSW
 ;	Parameters:
-;		BX:		Bit mask for toggling XTIDE data low/high reg
+;		BL:		Bit mask for toggling XTIDE data low/high reg
 ;		DX:		XTIDE Data Low Register address
 ;		DS:SI:	Ptr to source buffer
@@ -71,14 +71,14 @@
 %ifdef USE_186	; OUTS instruction available
 	lodsb						; Load low byte from [DS:SI] to AL
-	xor		dx, bx				; IDE Data Reg to XTIDE Data High Reg
+	xor		dl, bl				; IDE Data Reg to XTIDE Data High Reg
 	outsb						; Output high byte from [DS:SI]
-	xor		dx, bx				; XTIDE Data High Reg to Data Low Reg
+	xor		dl, bl				; XTIDE Data High Reg to Data Low Reg
 	out		dx, al				; Output low byte from AL
 %else	; If 8088/8086
 	lodsw						; Load word from [DS:SI]
-	xor		dx, bx				; IDE Data Reg to XTIDE Data High Reg
+	xor		dl, bl				; IDE Data Reg to XTIDE Data High Reg
 	xchg	al, ah				; => AL=high byte, AH=low byte
 	out		dx, al				; Output high byte
-	xor		dx, bx				; XTIDE Data High Reg to Data Low Reg
+	xor		dl, bl				; XTIDE Data High Reg to Data Low Reg
 	mov		al, ah				; Copy low byte to AL
 	out		dx, al				; Output low byte
Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm	(revision 369)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm	(revision 370)
@@ -102,6 +102,10 @@
 	; Return number of successfully read sectors
 ReturnWithTransferErrorInAH:
+%ifdef USE_386
+	movzx	cx, [bp+PIOVARS.bSectorsDone]
+%else
 	mov		cl, [bp+PIOVARS.bSectorsDone]
 	mov		ch, 0								; Preserve CF
+%endif
 	ret
 
@@ -180,5 +184,5 @@
 	; Store sizes
 	mov		[bp+PIOVARS.bSectorsLeft], ah
-	eMOVZX	ax, BYTE [di+DPT_ATA.bBlockSize]
+	eMOVZX	ax, [di+DPT_ATA.bBlockSize]
 	mov		[bp+PIOVARS.wSectorsInBlock], ax
 	mov		[bp+PIOVARS.bSectorsDone], ah		; Zero
@@ -218,5 +222,5 @@
 ReadBlockFromXtideRev1:
 	UNROLL_SECTORS_IN_CX_TO_QWORDS
-	mov		bx, 8		; Bit mask for toggling data low/high reg
+	mov		bl, 8		; Bit mask for toggling data low/high reg
 ALIGN JUMP_ALIGN
 .InswLoop:
@@ -287,5 +291,5 @@
 	push	bx
 	UNROLL_SECTORS_IN_CX_TO_QWORDS
-	mov		bx, 8		; Bit mask for toggling data low/high reg
+	mov		bl, 8		; Bit mask for toggling data low/high reg
 	push	es			; Copy ES...
 	pop		ds			; ...to DS
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm	(revision 369)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm	(revision 370)
@@ -227,5 +227,5 @@
 ;				Set if error flag was set
 ;	Corrupts registers:
-;		BX, ES
+;		Nothing
 ;--------------------------------------------------------------------
 SetErrorFlagFromALwithErrorCodeInAH:
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm	(revision 369)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm	(revision 370)
@@ -52,5 +52,5 @@
 
 	; Initialize Master and Slave drives
-	eMOVZX	ax, BYTE [di+DPT.bIdevarsOffset]	; (AL) pointer to controller we are looking to reset
+	eMOVZX	ax, [di+DPT.bIdevarsOffset]			; (AL) pointer to controller we are looking to reset
 												; (AH) initialize error code, assume success
 
@@ -85,54 +85,29 @@
 IterateAndResetDrives:
 	cmp		al, [di+DPT.bIdevarsOffset]			; The right controller?
-	jne		.done
+	jne		.Done
+	push	cx
 	push	ax
-	push	cx
 	call	AH9h_InitializeDriveForUse			; Reset Master and Slave (Master will come first in DPT list)
 
 %ifdef MODULE_ADVANCED_ATA
 	jc		SHORT .SkipControllerInitSinceError
-	call	InitializeAdvancedIdeControllers	; Done after drive init so drives are first set to advanced PIO mode, then the controller
+	; Here we initialize the more advanced controllers (VLB and PCI) to get better performance for systems with 32-bit bus.
+	; This step is optional since the controllers use slowest possible settings by default if they are not initialized.
+
+	pop		ax
+	push	ax
+	cmp		al, [di+LARGEST_DPT_SIZE+DPT.bIdevarsOffset]	; We check if next DPT is for the same IDE controller.
+	je		SHORT .SkipInitializationUntilNextDrive			; If it is, we skip the initialization.
+	call	AdvAtaInit_InitializeControllerForDPTinDSDI		; Done after drive init so drives are first set to advanced PIO mode, then the controller
+.SkipInitializationUntilNextDrive:
 .SkipControllerInitSinceError:
-%endif
+%endif	; MODULE_ADVANCED_ATA
 
+	pop		ax
 	pop		cx
-	pop		ax
-	jnc		.done
+	jnc		.Done
 	or		ah, (RET_HD_RESETFAIL << 1) | 1		; OR in Reset Failed error code and CF, will SHR into position later
-.done:
+.Done:
 	stc											; From IterateAllDPTs perspective, the DPT is never found (continue iteration)
 	ret
 
-
-%ifdef MODULE_ADVANCED_ATA
-;--------------------------------------------------------------------
-; Here we initialize the more advanced controllers (VLB and PCI)
-; to get better performance for systems with 32-bit bus.
-;
-; This step is optional since the controllers use slowest possible
-; settings by default if they are not initialized.
-;
-; InitializeAdvancedIdeController
-;	Parameters:
-;		DS:DI:	Ptr to DPT
-;	Returns:
-;		CF:		Cleared if success or no controller to initialize
-;				Set if error
-;	Corrupts registers:
-;		AX, BX, CX, DX
-;--------------------------------------------------------------------
-InitializeAdvancedIdeControllers:
-	; We want to initialize the advanced controller only after both
-	; Master and Slave drive are initialized to correct PIO mode.
-	; We check if next DPT is for the same IDE controller. If it is,
-	; we skip the initialization.
-	mov		al, [di+DPT.bIdevarsOffset]
-	cmp		al, [di++LARGEST_DPT_SIZE+DPT.bIdevarsOffset]
-	je		SHORT .SkipInitializationUntilNextDrive	; CF cleared
-
-	jmp		AdvAtaInit_InitializeControllerForDPTinDSDI
-.SkipInitializationUntilNextDrive:
-	clc
-	ret
-
-%endif	; MODULE_ADVANCED_ATA
Index: trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvAtaInit.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvAtaInit.asm	(revision 369)
+++ trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvAtaInit.asm	(revision 370)
@@ -114,5 +114,5 @@
 ;--------------------------------------------------------------------
 AdvAtaInit_SelectSlowestCommonPioTimingsToBXandCXfromDSSIandDSDI:
-	eMOVZX	bx, BYTE [di+DPT_ADVANCED_ATA.bPioMode]
+	eMOVZX	bx, [di+DPT_ADVANCED_ATA.bPioMode]
 	mov		cx, [di+DPT_ADVANCED_ATA.wMinPioCycleTime]
 	test	si, si
Index: trunk/XTIDE_Universal_BIOS/Src/Initialization/AtaID.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Initialization/AtaID.asm	(revision 369)
+++ trunk/XTIDE_Universal_BIOS/Src/Initialization/AtaID.asm	(revision 370)
@@ -89,8 +89,7 @@
 	; Get PIO mode and cycle time for PIO 0...2
 	mov		bx, [es:si+ATA1.bPioMode]
+	mov		ax, bx					; AH = 0, AL = PIO mode 0, 1 or 2
 	shl		bx, 1					; Shift for WORD lookup
 	mov		cx, [cs:bx+.rgwPio0to2CycleTimeInNanosecs]
-	shr		bx, 1
-	xchg	ax, bx					; AH = 0, AL = PIO mode 0, 1 or 2
 
 	; Check if IORDY is supported
@@ -105,8 +104,8 @@
 	; Get Advanced PIO mode
 	; (Hard Disks supports up to 4 but CF cards can support 5 and 6)
-	mov		bx, [es:si+ATA2.bPIOSupp]
+	mov		bl, [es:si+ATA2.bPIOSupp]
 .CheckNextFlag:
 	inc		ax
-	shr		bx, 1
+	shr		bl, 1
 	jnz		SHORT .CheckNextFlag
 	MIN_U	al, 6						; Make sure not above lookup tables
Index: trunk/XTIDE_Universal_BIOS/Src/Initialization/Vision.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Initialization/Vision.asm	(revision 369)
+++ trunk/XTIDE_Universal_BIOS/Src/Initialization/Vision.asm	(revision 370)
@@ -45,11 +45,12 @@
 IsConfigRegisterWithIDinAL:
 	mov		ah, al
-	and		ah, MASK_QDCONFIG_CONTROLLER_ID
-	cmp		ah, ID_QD6500 << 4
+	and		al, MASK_QDCONFIG_CONTROLLER_ID
+	cmp		al, ID_QD6500 << 4
 	je		SHORT VisionControllerDetected
-	cmp		ah, ID_QD6580 << 4
+	cmp		al, ID_QD6580 << 4
 	je		SHORT VisionControllerDetected
-	cmp		ah, ID_QD6580_ALTERNATE << 4
+	cmp		al, ID_QD6580_ALTERNATE << 4
 VisionControllerDetected:
+	xchg	ah, al
 	ret
 
@@ -175,5 +176,5 @@
 	mov		bp, QD6500_MAX_ACTIVE_TIME_CLOCKS | (QD6500_MIN_ACTIVE_TIME_CLOCKS << 8)
 
-	; We need the PIO Cycle Time in CX to calculate Active and Recovery Times. 
+	; We need the PIO Cycle Time in CX to calculate Active and Recovery Times.
 .CalculateTimingsForQD65xx:
 	call	AdvAtaInit_SelectSlowestCommonPioTimingsToBXandCXfromDSSIandDSDI
Index: trunk/XTIDE_Universal_BIOS/makefile
===================================================================
--- trunk/XTIDE_Universal_BIOS/makefile	(revision 369)
+++ trunk/XTIDE_Universal_BIOS/makefile	(revision 370)
@@ -196,5 +196,5 @@
 
 xt_unused: xt
-	$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_xt_unused.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
-	perl ..\tools\unused.pl $(TARGET)_xt.lst $(TARGET)_xt_unused.asm
-
+	@$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_xt_unused.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
+	@perl ..\tools\unused.pl $(TARGET)_xt.lst $(TARGET)_xt_unused.asm
+
Index: trunk/XTIDE_Universal_BIOS_Configurator_v2/Inc/Help/Configuration_FullMode.txt
===================================================================
--- trunk/XTIDE_Universal_BIOS_Configurator_v2/Inc/Help/Configuration_FullMode.txt	(revision 369)
+++ trunk/XTIDE_Universal_BIOS_Configurator_v2/Inc/Help/Configuration_FullMode.txt	(revision 370)
@@ -1,5 +1,5 @@
-Full mode supports up to 5 IDE controllers (10 drives). Full mode reserves a bit of RAM from top of Conventional memory. This makes possible to use ROM BASIC and software that requires top of interrupt vectors where XTIDE Universal BIOS parameters would be stored in Lite mode.
+Full mode supports up to 4 IDE controllers (8 drives). Full mode reserves a bit of RAM from the top of Conventional memory. This makes it possible to use ROM BASIC and other software that requires the interrupt vectors where XTIDE Universal BIOS parameters would be stored in Lite mode.
 
-Lite mode supports only one IDE controller (2 drives) and stores parameters to top of interrupt vectors (30:0h) so no Conventional memory needs to be reserved. Lite mode cannot be used if some software requires top of interrupt vectors. Usually this is not a problem since only IBM ROM BASIC uses them.
+Lite mode supports only one IDE controller (2 drives) and stores parameters to the top of the interrupt vectors (30:0h) so no Conventional memory needs to be reserved. Lite mode cannot be used if some software requires the top of interrupt vectors. Usually this is not a problem since only IBM ROM BASIC uses them.
 
-Tandy 1000 models with 640 kiB or less memory need to use Lite mode since top of Conventional memory gets dynamically reserved by video hardware. This happens only with Tandy integrated video controller and not when using expansion graphics cards. It is possible to use Full mode if reserving RAM for video memory + what is required for XTIDE Universal BIOS. This would mean 129 kiB but most software should work with 65 kiB reserved.
+Tandy 1000 models with 640 kiB or less memory need to use Lite mode since the top of Conventional memory gets dynamically reserved by video hardware. This happens only with Tandy integrated video controller and not when using expansion graphics cards. It is possible to use Full mode if reserving RAM for video memory + what is required for XTIDE Universal BIOS. This would mean 129 kiB but most software should work with 65 kiB reserved.
Index: trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Flash.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Flash.asm	(revision 369)
+++ trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Flash.asm	(revision 370)
@@ -33,8 +33,10 @@
 
 	loop	.FlashNextPage
+%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
 %if FLASH_RESULT.success = 0	; Just in case this should ever change
 	mov		[bp+FLASHVARS.flashResult], cl
 %else
 	mov		BYTE [bp+FLASHVARS.flashResult], FLASH_RESULT.success
+%endif
 %endif
 	ret
Index: trunk/XTIDE_Universal_BIOS_Configurator_v2/makefile
===================================================================
--- trunk/XTIDE_Universal_BIOS_Configurator_v2/makefile	(revision 369)
+++ trunk/XTIDE_Universal_BIOS_Configurator_v2/makefile	(revision 370)
@@ -131,2 +131,7 @@
 	@upx -qq --8086 --ultra-brute $(TARGET).$(EXTENSION)
 	@echo Done! XT version is ready for release.
+
+xt_unused: xt
+	@$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_xt_unused.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
+	@perl ..\tools\unused.pl $(TARGET)_xt.lst $(TARGET)_xt_unused.asm
+
