Index: /trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm	(revision 119)
+++ /trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm	(revision 120)
@@ -48,5 +48,5 @@
 ;		Nothing
 ;	Corrupts registers:
-;		AX, DX, SI
+;		AX, DX, SI, DI
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
@@ -282,16 +282,14 @@
 ;	Parameters:
 ;		CS:SI:	Ptr to string to format
-;		SS:BP:	Ptr to format parameters
+;		BP:		SP before pushing parameters
 ;	Returns:
 ;		BP:		Popped from stack
 ;	Corrupts registers:
-;		AX
+;		AX, DI
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
 BootMenuPrint_FormatCSSIfromParamsInSSBP:
-	push	di
 	CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
 	stc				; Successfull return from menu event
-	pop		di
 	pop		bp
 	ret
@@ -394,5 +392,5 @@
 ;		Nothing
 ;	Corrupts registers:
-;		AX, CX, DX, SI
+;		AX, CX, DX, SI, DI
 ;--------------------------------------------------------------------
 .PrintHotkeyString:
@@ -431,5 +429,5 @@
 ;		Nothing
 ;	Corrupts registers:
-;		AX, SI
+;		AX, SI, DI
 ;--------------------------------------------------------------------
 .PrintRomBootHotkey:
@@ -449,5 +447,5 @@
 ;		Nothing
 ;	Corrupts registers:
-;		AX, SI
+;		AX, SI, DI
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
Index: /trunk/XTIDE_Universal_BIOS/Src/Boot/BootPrint.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Boot/BootPrint.asm	(revision 119)
+++ /trunk/XTIDE_Universal_BIOS/Src/Boot/BootPrint.asm	(revision 120)
@@ -13,5 +13,5 @@
 ;		Nothing
 ;	Corrupts registers:
-;		AX, SI
+;		AX, SI, DI
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
@@ -41,5 +41,5 @@
 ;		Nothing
 ;	Corrupts registers:
-;		AX, SI
+;		AX, SI, DI
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
@@ -60,5 +60,5 @@
 ;		Nothing
 ;	Corrupts registers:
-;		AX, BX, SI
+;		AX, BX, SI, DI
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
Index: /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH25h_HDrvID.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH25h_HDrvID.asm	(revision 119)
+++ /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH25h_HDrvID.asm	(revision 120)
@@ -80,5 +80,10 @@
 	out		dx, al						; Select Master or Slave drive
 	sub		dx, BYTE REG_IDE_DRVHD		; Back to IDE Base port
-	call	AH25h_GetDriveDetectionTimeoutValue
+
+	; Wait until ready to accept commands
+	xor		bh, bh						; BX now contains bus type
+	mov		cl, B_TIMEOUT_DRVINFO		; Load short timeout
+	cmp		[RAMVARS.bDrvCnt], bh		; Detecting first drive?
+	eCMOVE	cl, B_TIMEOUT_RESET			;  If so, load long timeout
 	call	HStatus_WaitRdy				; Wait until ready to accept commands
 	jc		SHORT .Return				; Return if error
@@ -92,5 +97,4 @@
 	; Transfer data
 	sub		dx, BYTE REGR_IDE_ST		; DX to IDE Data Reg
-	xor		bh, bh						; BX now contains bus type
 	mov		cx, 256						; Transfer 256 words (single sector)
 	cld									; INSW to increment DI
@@ -98,5 +102,4 @@
 	call	HStatus_WaitRdyDefTime		; Wait until drive ready
 
-	; Return
 .Return:
 	pop		bx
@@ -104,28 +107,2 @@
 	pop		di
 	ret
-
-
-;--------------------------------------------------------------------
-; Returns timeout value for drive detection.
-; Long timeout is required for detecting first drive to make sure it is
-; ready after power-on (ATA specification says up to 31 seconds).
-; Short timeout is used for additional drives to prevent long boot time
-; when drive has failed or it is not present.
-;
-; AH25h_GetDriveDetectionTimeoutValue
-;	Parameters:
-;		DS:		Segment to RAMVARS
-;	Returns:
-;		CL:		Timeout value
-;	Corrupts registers:
-;		Nothing
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-AH25h_GetDriveDetectionTimeoutValue:
-	mov		cl, B_TIMEOUT_RESET			; Load long timeout (assume first drive)
-	cmp		BYTE [RAMVARS.bDrvCnt], 0	; Detecting first drive?
-	je		SHORT .Return
-	mov		cl, B_TIMEOUT_DRVINFO		; Load short timeout
-ALIGN JUMP_ALIGN, ret	; This speed optimization may be unnecessary
-.Return:
-	ret
Index: /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HStatus.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HStatus.asm	(revision 119)
+++ /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HStatus.asm	(revision 120)
@@ -249,5 +249,6 @@
 ;		DS:		Segment to RAMVARS
 ;	Returns:
-;		Nothing
+;		CF:		Set if timeout
+;				Cleared if time left
 ;	Corrupts registers:
 ;		CX
Index: /trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm	(revision 119)
+++ /trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm	(revision 120)
@@ -68,13 +68,8 @@
 StartDetectionWithDriveSelectByteInBHandStringInAX:
 	call	DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP
-	call	ReadAtaInfoFromDrive	; Assume hard disk
-	jnc		SHORT CreateBiosTablesForHardDisk
-	;call	ReadAtapiInfoFromDrive	; Assume CD-ROM (not yet implemented)
-	;jnc	SHORT _CreateBiosTablesForCDROM
-	jmp		DetectPrint_DriveNotFound
-
+	; Fall to .ReadAtaInfoFromHardDisk
 
 ;--------------------------------------------------------------------
-; ReadAtaInfoFromDrive
+; .ReadAtaInfoFromHardDisk
 ;	Parameters:
 ;		BH:		Drive Select byte for Drive and Head Register
@@ -89,11 +84,16 @@
 ;		AX, BL, CX, DX, DI
 ;--------------------------------------------------------------------
-ReadAtaInfoFromDrive:
+.ReadAtaInfoFromHardDisk:
 	mov		bl, [cs:bp+IDEVARS.bBusType]; Load BUS type
 	mov		dx, [cs:bp+IDEVARS.wPort]	; Load IDE Base Port address
 	mov		di, BOOTVARS.rgbAtaInfo		; ES:DI now points to ATA info location
 	call	AH25h_GetDriveInfo
-	mov		si, di						; ES:SI now points to ATA information
-	ret
+	jnc		SHORT CreateBiosTablesForHardDisk
+	; Fall to .ReadAtapiInfoFromDrive
+
+.ReadAtapiInfoFromDrive:				; Not yet implemented
+	;call	ReadAtapiInfoFromDrive		; Assume CD-ROM
+	;jnc	SHORT _CreateBiosTablesForCDROM
+	jmp		DetectPrint_DriveNotFound
 
 
@@ -103,5 +103,5 @@
 ;		BH:		Drive Select byte for Drive and Head Register
 ;		CS:BP:	Ptr to IDEVARS for the drive
-;		ES:SI	Ptr to ATA information for the drive
+;		ES:DI	Ptr to ATA information for the drive
 ;		DS:		RAMVARS segment
 ;		ES:		BDA/Bootnfo segment
@@ -112,4 +112,5 @@
 ;--------------------------------------------------------------------
 CreateBiosTablesForHardDisk:
+	mov		si, di					; ES:SI now points to ATA information
 	call	CreateDPT_FromAtaInformation
 	jc		SHORT .InvalidAtaInfo
Index: /trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm	(revision 119)
+++ /trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm	(revision 120)
@@ -14,5 +14,5 @@
 ;		Nothing
 ;	Corrupts registers:
-;		AX, SI
+;		AX, SI, DI
 ;--------------------------------------------------------------------
 DetectPrint_RomFoundAtSegment:
@@ -33,5 +33,5 @@
 ;		Nothing
 ;	Corrupts registers:
-;		AX, SI
+;		AX, SI, DI
 ;--------------------------------------------------------------------
 DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP:
Index: /trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm	(revision 119)
+++ /trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm	(revision 120)
@@ -70,4 +70,5 @@
 ;--------------------------------------------------------------------
 Initialize_AndDetectDrives:
+	CALL_DISPLAY_LIBRARY InitializeDisplayContext
 	call	DetectPrint_RomFoundAtSegment
 	call	RamVars_Initialize
Index: /trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm	(revision 119)
+++ /trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm	(revision 120)
@@ -142,5 +142,6 @@
 ;--------------------------------------------------------------------
 Interrupts_InstallHandlerToVectorInBXFromCSSI:
-	eSHL_IM	bx, 2					; Shift for DWORD offset
+	shl		bx, 1
+	shl		bx, 1					; Shift for DWORD offset
 	mov		[es:bx], si				; Store offset
 	mov		[es:bx+2], cs			; Store segment
