Index: trunk/XTIDE_Universal_BIOS/Inc/BootVars.inc
===================================================================
--- trunk/XTIDE_Universal_BIOS/Inc/BootVars.inc	(revision 523)
+++ trunk/XTIDE_Universal_BIOS/Inc/BootVars.inc	(revision 524)
@@ -44,12 +44,7 @@
 	.wNextXTCFportToScan	resb	2	; Needed for XT-CF port autodetection
 %endif
-
-	
 %ifdef MODULE_HOTKEYS
 	.hotkeyVars				resb	HOTKEYVARS_size
-%else
-	.clearToZeroFromThisPoint:
 %endif
-
 	.rgDrvDetectInfo:					; Array containing DRVDETECTINFO structs
 endstruc
@@ -59,6 +54,5 @@
 
 struc HOTKEYVARS
-	.wTimeToClose		resb	2		; Earliest system time when Hotkey Bar can be closed
-.clearToZeroFromThisPoint:
+	.wTimeWhenDisplayed	resb	2		; System time (ticks) when Hotkey bar was first displayed
 	.wFddAndHddLetters:
 	.bFddLetter			resb	1		; Floppy Drive letter hotkey (upper case)
@@ -74,6 +68,6 @@
 %endif
 
-; Bit defines for KEYBOARDVARS.bFlags
-FLG_HOTKEY_HD_FIRST		EQU		(1<<0)	; First try to boot from HDD, then FDD
+; Bit defines for HOTKEYVARS.bFlags
+FLG_HOTKEY_HD_FIRST			EQU		(1<<0)	; First try to boot from HDD, then FDD
 
 %endif ; MODULE_HOTKEYS
Index: trunk/XTIDE_Universal_BIOS/Inc/ModuleDependency.inc
===================================================================
--- trunk/XTIDE_Universal_BIOS/Inc/ModuleDependency.inc	(revision 523)
+++ trunk/XTIDE_Universal_BIOS/Inc/ModuleDependency.inc	(revision 524)
@@ -20,5 +20,8 @@
 ; Allow RELOCATE_INT13H_STACK only for AT builds
 %ifndef USE_AT
-	%undef RELOCATE_INT13H_STACK
+	%ifdef RELOCATE_INT13H_STACK
+		%undef RELOCATE_INT13H_STACK
+		%warning "RELOCATE_INT13H_STACK is not supported for XT builds!"
+	%endif
 %endif
 
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm	(revision 523)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm	(revision 524)
@@ -80,6 +80,5 @@
 %ifdef MODULE_HOTKEYS
 	call	TimerTicks_ReadFromBdaToAX
-	add		ax, BYTE MIN_TIME_TO_DISPLAY_HOTKEY_BAR
-	mov		[es:BOOTVARS.hotkeyVars+HOTKEYVARS.wTimeToClose], ax
+	mov		[es:BOOTVARS.hotkeyVars+HOTKEYVARS.wTimeWhenDisplayed], ax
 %endif
 
@@ -89,5 +88,6 @@
 .WaitUntilTimeToCloseHotkeyBar:
 	call	TimerTicks_ReadFromBdaToAX
-	cmp		ax, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wTimeToClose]
+	sub		ax, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wTimeWhenDisplayed]
+	cmp		ax, MIN_TIME_TO_DISPLAY_HOTKEY_BAR
 	jb		SHORT .WaitUntilTimeToCloseHotkeyBar
 %endif
Index: trunk/XTIDE_Universal_BIOS/Src/Initialization/FloppyDrive.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Initialization/FloppyDrive.asm	(revision 523)
+++ trunk/XTIDE_Universal_BIOS/Src/Initialization/FloppyDrive.asm	(revision 524)
@@ -22,4 +22,5 @@
 SECTION .text
 
+%ifdef COPY_13H_HANDLER_TO_40H
 ;--------------------------------------------------------------------
 ; Checks is floppy drive handler installed to interrupt vector 40h.
@@ -103,4 +104,6 @@
 %endif
 
+%endif ; COPY_13H_HANDLER_TO_40H
+
 
 ;--------------------------------------------------------------------
Index: trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm	(revision 523)
+++ trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm	(revision 524)
@@ -64,9 +64,5 @@
 	mov		[RAMVARS.fpOldI13h], ax				; Store old INT 13h offset
 
-	; NOTE! Installing INT 40h handler is currently uncommented to test
-	; if it is really needed. I suspect that it is not. Many bytes can be
-	; saved if INT 40h related code can be removed.
-%if 0
-
+%ifdef COPY_13H_HANDLER_TO_40H
 	; Only store INT 13h handler to 40h if 40h is not already installed.
 	; At least AMI BIOS for 286 stores 40h handler by itself and calls
@@ -77,5 +73,5 @@
 	mov		[es:BIOS_DISKETTE_INTERRUPT_40h*4+2], dx	; Store old INT 13h segment
 .Int40hAlreadyInstalled:
-%endif ; 0
+%endif ; COPY_13H_HANDLER_TO_40H
 
 	mov		al, BIOS_DISK_INTERRUPT_13h			; INT 13h interrupt vector offset
Index: trunk/XTIDE_Universal_BIOS/Src/Main.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Main.asm	(revision 523)
+++ trunk/XTIDE_Universal_BIOS/Src/Main.asm	(revision 524)
@@ -91,5 +91,5 @@
 	at	ROMVARS.ideVars0+IDEVARS.wControlBlockPort,	dw	DEVICE_ATA_PRIMARY_PORTCTRL 	; Controller Control Block base port
 	at	ROMVARS.ideVars0+IDEVARS.bDevice,			db	DEVICE_16BIT_ATA
-	at	ROMVARS.ideVars0+IDEVARS.bIRQ,				db	0
+	at	ROMVARS.ideVars0+IDEVARS.bIRQ,				db	14
 	at	ROMVARS.ideVars0+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,	dw	DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
 	at	ROMVARS.ideVars0+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,	dw	DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
@@ -98,5 +98,5 @@
 	at	ROMVARS.ideVars1+IDEVARS.wControlBlockPort,	dw	DEVICE_ATA_SECONDARY_PORTCTRL
 	at	ROMVARS.ideVars1+IDEVARS.bDevice,			db	DEVICE_16BIT_ATA
-	at	ROMVARS.ideVars1+IDEVARS.bIRQ,				db	0
+	at	ROMVARS.ideVars1+IDEVARS.bIRQ,				db	15
 	at	ROMVARS.ideVars1+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,	dw	DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
 	at	ROMVARS.ideVars1+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,	dw	DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
Index: trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/BootVars.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/BootVars.asm	(revision 523)
+++ trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/BootVars.asm	(revision 524)
@@ -36,14 +36,8 @@
 %endif
 
-	; Clear to zero
+	; Clear all DRVDETECTINFO structs to zero
 	mov		al, DRVDETECTINFO_size
 	mul		BYTE [cs:ROMVARS.bIdeCnt]
-%ifdef MODULE_HOTKEYS ; We must not initialize anything before this!
-	mov		di, BOOTVARS.hotkeyVars + HOTKEYVARS.clearToZeroFromThisPoint	
-%else
-	mov		di, BOOTVARS.clearToZeroFromThisPoint
-%endif
-	add		ax, BOOTVARS_size
-	sub		ax, di
+	mov		di, BOOTVARS.rgDrvDetectInfo	; We must not initialize anything before this!
 	xchg	cx, ax
 
@@ -51,22 +45,7 @@
 	call	Memory_ZeroESDIwithSizeInCX
 
-	; Store default drives to boot from
+	; Initialize HOTKEYVARS by storing default drives to boot from
+	mov		WORD [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wFddAndHddLetters], DEFAULT_FLOPPY_DRIVE_LETTER | (DEFAULT_HARD_DRIVE_LETTER<<8)
 	mov		dl, [cs:ROMVARS.bBootDrv]
-
-	; fall through to BootVars_StoreHotkeyForDriveNumberInDL
-
-;--------------------------------------------------------------------
-; BootVars_StoreHotkeyForDriveNumberInDL
-;	Parameters:
-;		DL:		Floppy or Hard Drive number
-;		DS:		RAMVARS Segment
-;		ES:		BDA Segment
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		AX, CX, DI
-;--------------------------------------------------------------------
-BootVars_StoreHotkeyForDriveNumberInDL:
-	mov		WORD [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wFddAndHddLetters], DEFAULT_FLOPPY_DRIVE_LETTER | (DEFAULT_HARD_DRIVE_LETTER<<8)
 	call	DriveXlate_ConvertDriveNumberFromDLtoDriveLetter
 	jmp		HotkeyBar_StoreHotkeyToBootvarsForDriveLetterInDL
@@ -74,4 +53,3 @@
 %else
 	jmp		Memory_ZeroESDIwithSizeInCX
-
 %endif ; MODULE_HOTKEYS
Index: trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm	(revision 523)
+++ trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm	(revision 524)
@@ -176,4 +176,5 @@
 ; IterateFindFirstDPTforIdevars
 ;       DL:		Offset to IDEVARS to search from DPTs
+;		SI:		Offset to this callback function
 ;		DS:DI:	Ptr to DPT to examine
 ;	Returns:
@@ -183,10 +184,9 @@
 IterateFindSecondDPTforIdevars:
 	call	IterateFindFirstDPTforIdevars
-	jc		SHORT IterateFindFirstDPTforIdevars.done	; Wrong controller
-
-	; We have found DPT for Master Drive,
-	; next DPT is for slave drive or master for another controller
-	add		di, BYTE LARGEST_DPT_SIZE
-	; Fall to IterateFindFirstDPTforIdevars
+	jc		SHORT .WrongController
+	mov		si, IterateFindFirstDPTforIdevars
+.WrongController:
+	stc
+	ret
 
 IterateFindFirstDPTforIdevars:
Index: trunk/XTIDE_Universal_BIOS/makefile
===================================================================
--- trunk/XTIDE_Universal_BIOS/makefile	(revision 523)
+++ trunk/XTIDE_Universal_BIOS/makefile	(revision 524)
@@ -29,4 +29,5 @@
 #                                                                                                  #
 # Not modules but these affect the assembly:                                                       #
+# COPY_13H_HANDLER_TO_40H     Copies existing INT 13h handler to 40h if necessary                  #
 # ELIMINATE_CGA_SNOW          Prevents CGA snowing at the cost of a few bytes                      #
 # RELOCATE_INT13H_STACK **    Relocates INT 13h stack to beginning of stolen conventional memory   #
@@ -101,7 +102,7 @@
 DEFINES_COMMON_LARGE = MODULE_BOOT_MENU MODULE_8BIT_IDE_ADVANCED
 
-DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_8BIT_IDE_ADVANCED
+DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_8BIT_IDE_ADVANCED COPY_13H_HANDLER_TO_40H
 DEFINES_XTPLUS = $(DEFINES_COMMON) $(DEFINES_XT) USE_186
-DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 RELOCATE_INT13H_STACK MODULE_IRQ MODULE_ADVANCED_ATA
+DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 MODULE_IRQ MODULE_ADVANCED_ATA
 
 DEFINES_XT_LARGE = $(DEFINES_XT) $(DEFINES_COMMON_LARGE)
@@ -113,4 +114,5 @@
 
 DEFINES_ALL_FEATURES = MODULE_8BIT_IDE MODULE_8BIT_IDE_ADVANCED MODULE_ADVANCED_ATA MODULE_EBIOS MODULE_BOOT_MENU MODULE_HOTKEYS MODULE_IRQ MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_STRINGS_COMPRESSED MODULE_FEATURE_SETS
+DEFINES_ALL_FEATURES += COPY_13H_HANDLER_TO_40H ELIMINATE_CGA_SNOW RELOCATE_INT13H_STACK RESERVE_DIAGNOSTIC_CYLINDER
 
 
