Index: trunk/Assembly_Library/Inc/BiosFunctions.inc
===================================================================
--- trunk/Assembly_Library/Inc/BiosFunctions.inc	(revision 590)
+++ trunk/Assembly_Library/Inc/BiosFunctions.inc	(revision 592)
@@ -6,4 +6,5 @@
 ; BIOS interrupts
 BIOS_VIDEO_INTERRUPT_10h		EQU		10h
+BIOS_EQUIPMENT_INTERRUPT_11h	EQU		11h
 BIOS_DISK_INTERRUPT_13h			EQU		13h
 BIOS_SYSTEM_INTERRUPT_15h		EQU		15h
Index: trunk/Assembly_Library/Inc/Debug.inc
===================================================================
--- trunk/Assembly_Library/Inc/Debug.inc	(revision 590)
+++ trunk/Assembly_Library/Inc/Debug.inc	(revision 592)
@@ -24,5 +24,5 @@
 	mov		bl, %2
 	CALL_DISPLAY_LIBRARY PrintWordFromAXWithBaseInBL
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 	call	Keyboard_RemoveAllKeystrokesFromBuffer
 %endif
@@ -52,5 +52,5 @@
 	mov		al, %1
 	CALL_DISPLAY_LIBRARY PrintCharacterFromAL
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 	call	Keyboard_RemoveAllKeystrokesFromBuffer
 %endif
@@ -95,5 +95,5 @@
 %macro WAIT_ANY_KEY_TO_CONTINUE 0
 	push	ax
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 	call	Keyboard_RemoveAllKeystrokesFromBuffer
 %endif
Index: trunk/Assembly_Library/Inc/Display.inc
===================================================================
--- trunk/Assembly_Library/Inc/Display.inc	(revision 590)
+++ trunk/Assembly_Library/Inc/Display.inc	(revision 592)
@@ -61,5 +61,5 @@
 	.InitializeDisplayContext						resb	2
 
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 	.SetCharacterPointerFromBXAX					resb	2
 %endif
@@ -74,5 +74,5 @@
 	.SynchronizeDisplayContextToHardware			resb	2
 
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 	.GetCharacterPointerToBXAX						resb	2
 %endif
@@ -81,9 +81,9 @@
 
 	.FormatNullTerminatedStringFromCSSI				resb	2
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 	.PrintSignedWordFromAXWithBaseInBL				resb	2
 %endif
 	.PrintWordFromAXWithBaseInBL					resb	2
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS OR EXCLUDE_FROM_XTIDECFG
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_XTIDECFG
 	.PrintQWordFromSSBPwithBaseInBX					resb	2
 %endif
@@ -94,5 +94,5 @@
 	.PrintCharacterFromAL							resb	2
 	.PrintNewlineCharacters							resb	2
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 	.ClearAreaWithHeightInAHandWidthInAL			resb	2
 %endif
Index: trunk/Assembly_Library/Inc/DosFunctions.inc
===================================================================
--- trunk/Assembly_Library/Inc/DosFunctions.inc	(revision 590)
+++ trunk/Assembly_Library/Inc/DosFunctions.inc	(revision 592)
@@ -6,4 +6,5 @@
 ; DOS interrupts
 DOS_INTERRUPT_21h									EQU		21h
+DOS_CTRL_C_CTRL_BREAK_HANDLER_23h					EQU		23h
 DOS_CRITICAL_ERROR_HANDLER_24h						EQU		24h
 DOS_TSR_MULTIPLEX_INTERRUPT_2Fh						EQU		2Fh
@@ -31,4 +32,5 @@
 FIND_FIRST_MATCHING_FILE							EQU		4Eh		; DOS 2+
 FIND_NEXT_MATCHING_FILE								EQU		4Fh		; DOS 2+
+GET_EXTENDED_ERROR_INFORMATION						EQU		59h		; DOS 3.0+
 
 ; DOS errors
Index: trunk/Assembly_Library/Inc/Emulate.inc
===================================================================
--- trunk/Assembly_Library/Inc/Emulate.inc	(revision 590)
+++ trunk/Assembly_Library/Inc/Emulate.inc	(revision 592)
@@ -60,4 +60,34 @@
 
 ;--------------------------------------------------------------------
+; Find String In String
+;
+; FSIS
+;	Parameters:
+;		%1:		String to search for (case-insensitive)
+;		%2:		String to search in
+;	Returns:
+;	strpos:		Position of %1 in %2 if found, 0 if not found
+;--------------------------------------------------------------------
+%macro FSIS 2.nolist
+%defstr	s1 %1
+%defstr	s2 %2
+%strlen sl1 s1
+%strlen sl2 s2
+%assign strpos 0
+	%if sl1 <= sl2
+		%assign strpos sl2 - sl1 + 1
+		%rep strpos
+			%substr %%ss s2 strpos, sl1
+			%ifidni %%ss, s1
+				%exitrep
+			%else
+				%assign strpos strpos - 1
+			%endif
+		%endrep
+	%endif
+%endmacro
+
+
+;--------------------------------------------------------------------
 ; The undocumented instruction SALC (Set AL According to CF).
 ; Available on all Intel processors and truly compatible clones.
@@ -108,7 +138,4 @@
 ;--------------------------------------------------------------------
 ; The AAM instruction (ASCII Adjust after Multiplication).
-; Available on all Intel processors and truly compatible clones.
-; Does not work on the NEC V20/V30 or Sony CXQ70108 processors
-; unless %1 is 10 (0Ah).
 ;
 ; eAAM
@@ -152,9 +179,9 @@
 %macro eBSF 2
 %ifndef USE_386
-	push	cx
 	cmp		WORD %2, BYTE 0		; Source operand is zero?
 	je		SHORT %%Return		;  If so, return with ZF set
 
 	; Set destination to zero and load mask for bit 0
+	push	cx
 	xor		%1, %1
 	mov		cx, 1
@@ -163,10 +190,11 @@
 %%BitLoop:
 	test	%2, cx				; Bit set?
-	jnz		SHORT %%Return		;  If so, return with ZF cleared
+	jnz		SHORT %%PopAndReturn;  If so, return with ZF cleared
 	shl		cx, 1				; Prepare to test next bit
 	inc		%1					; Increment bit index
 	jmp		SHORT %%BitLoop		; Loop until bit found
-%%Return:
+%%PopAndReturn:
 	pop		cx
+%%Return:
 ;-----------------------------------
 %else
@@ -193,9 +221,9 @@
 %macro eBSR 2
 %ifndef USE_386
-	push	cx
 	cmp		WORD %2, BYTE 0		; Source operand is zero?
 	je		SHORT %%Return		;  If so, return with ZF set
 
 	; Load mask for highest order bit
+	push	cx
 	mov		cx, 1<<15
 	mov		%1, 15
@@ -204,10 +232,11 @@
 %%BitLoop:
 	test	%2, cx				; Bit set?
-	jnz		SHORT %%Return		;  If so, return with ZF cleared
+	jnz		SHORT %%PopAndReturn;  If so, return with ZF cleared
 	shr		cx, 1				; Prepare to test next bit
 	dec		%1					; Decrement bit index
 	jmp		SHORT %%BitLoop		; Loop until bit found
-%%Return:
+%%PopAndReturn:
 	pop		cx
+%%Return:
 ;-----------------------------------
 %else
@@ -260,15 +289,13 @@
 
 %macro eCMOVE 2
-	eCMOVZ %1, %2
+	eCMOVZ	%1, %2
 %endmacro
 
 %macro eCMOVNE 2
-	eCMOVNZ %1, %2
+	eCMOVNZ	%1, %2
 %endmacro
 
 %macro eCMOVB 2
-	jnb		SHORT %%Return
-	mov		%1, %2
-%%Return:
+	eCMOVC	%1, %2
 %endmacro
 
@@ -289,5 +316,5 @@
 ; Conditional Set.
 ;
-; eCSETcc
+; eSETcc
 ;	Parameters:
 ;		%1:		Destination data
@@ -297,5 +324,5 @@
 ;		Flags
 ;--------------------------------------------------------------------
-%macro eCSETZ 1
+%macro eSETZ 1
 	mov		%1, 0			; Clear while preserving flags
 	jnz		SHORT %%Return	; Nothing to set
@@ -304,5 +331,5 @@
 %endmacro
 
-%macro eCSETNZ 1
+%macro eSETNZ 1
 	mov		%1, 0			; Clear while preserving flags
 	jz		SHORT %%Return	; Nothing to set
@@ -339,9 +366,17 @@
 		xor		dh, dh
 	%else	; SI, DI, BP (all may be used in effective address)
-		push	ax
-		mov		al, %2
-		xor		ah, ah
-		xchg	ax, %1
-		pop		ax
+		FSIS	%1, %2
+		%if strpos
+			push	ax
+			mov		al, %2
+			xor		ah, ah
+			xchg	%1, ax
+			pop		ax
+		%else
+			xchg	%1, ax
+			mov		al, %2
+			xor		ah, ah
+			xchg	%1, ax
+		%endif
 	%endif
 ;-----------------------------------
@@ -484,5 +519,5 @@
 ; eSEG_STR
 ;	Parameters:
-;		%1:		REP/REPNE or REPE prefix
+;		%1:		REP/REPE/REPZ or REPNE/REPNZ prefix
 ;		%2:		Source segment override (destination is always ES)
 ;		%3:		String instruction
@@ -491,5 +526,5 @@
 ;		FLAGS for cmps and scas only
 ;	Corrupts registers:
-;		Nothing
+;		FLAGS
 ;--------------------------------------------------------------------
 %macro eSEG_STR 3
@@ -499,7 +534,16 @@
 		%2						; SEG is the prefix that won't be lost
 		%3						; String instruction
+FSIS	cmps, %3
+%ifn strpos
+	FSIS	scas, %3
+%endif
+%if strpos						; Must preserve FLAGS
 		jcxz	%%End			; Jump to end if no repeats left (preserves FLAGS)
 		jmp		SHORT %%Loop	; Loop while repeats left
 	%%End:
+%else							; No need to preserve FLAGS
+		inc		cx
+		loop	%%Loop
+%endif
 %else	; No bug on V20/V30 and later, don't know about 188/186
 	%2
@@ -556,5 +600,10 @@
 %ifdef USE_386
 	%if %2 = 1
-		add		%1, %1	; Same size but faster on 386 and 486. Fails if %1 is a memory operand.
+		FSIS	], %1
+		%if strpos
+			eSHIFT_IM	%1, %2, shl
+		%else
+			add		%1, %1	; Same size but faster on 386 and 486.
+		%endif
 	%else
 		eSHIFT_IM	%1, %2, shl
@@ -582,5 +631,10 @@
 %ifdef USE_386
 	%if %2 = 1
-		adc		%1, %1	; Same size but faster on 386 and 486. Fails if %1 is a memory operand.
+		FSIS	], %1
+		%if strpos
+			eSHIFT_IM	%1, %2, rcl
+		%else
+			adc		%1, %1	; Same size but faster on 386 and 486.
+		%endif
 	%else
 		eSHIFT_IM	%1, %2, rcl
Index: trunk/Assembly_Library/Inc/Macros.inc
===================================================================
--- trunk/Assembly_Library/Inc/Macros.inc	(revision 590)
+++ trunk/Assembly_Library/Inc/Macros.inc	(revision 592)
@@ -18,5 +18,5 @@
 ;		%1
 ;--------------------------------------------------------------------
-%macro SKIP2B 1
+%macro SKIP2B 1.nolist
 	%ifidni		%1, f
 		db	03Dh					; Opcode byte for CMP AX, <immed>
Index: trunk/Assembly_Library/Inc/Math.inc
===================================================================
--- trunk/Assembly_Library/Inc/Math.inc	(revision 590)
+++ trunk/Assembly_Library/Inc/Math.inc	(revision 592)
@@ -23,5 +23,4 @@
 	jb		%%Return			;  If so, return
 	mov		%1, %2				; Copy %2 to %1
-ALIGN JUMP_ALIGN
 %%Return:
 %endmacro
@@ -31,5 +30,4 @@
 	jl		%%Return			;  If so, return
 	mov		%1, %2				; Copy %2 to %1
-ALIGN JUMP_ALIGN
 %%Return:
 %endmacro
@@ -51,5 +49,4 @@
 	ja		%%Return			;  If so, return
 	mov		%1, %2				; Copy %2 to %1
-ALIGN JUMP_ALIGN
 %%Return:
 %endmacro
@@ -59,5 +56,4 @@
 	jg		%%Return			;  If so, return
 	mov		%1, %2				; Copy %2 to %1
-ALIGN JUMP_ALIGN
 %%Return:
 %endmacro
@@ -67,5 +63,5 @@
 ; SHL_DXAX
 ;	Parameters:
-;		%1:		Number of bits to shift
+;		%1:		Number of bits to shift. Can be (in preferred order) CX, CL or an immediate value.
 ;	Returns:
 ;		DX:AX	Shifted value
@@ -74,5 +70,20 @@
 ;--------------------------------------------------------------------
 %macro SHL_DXAX 1
+%ifdef USE_386
 	%ifnidni %1, cx
+		; %1 is CL or an immediate
+		shld	dx, ax, %1
+		shl		ax, %1
+	%else
+		; %1 is CX
+		shld	dx, ax, cl
+		shl		ax, cl
+	%endif
+%else
+	%ifidni %1, cl
+		; %1 is CL
+		xor		ch, ch
+	%elifnidni %1, cx
+		; %1 is an immediate
 		mov		cx, %1
 	%endif
@@ -82,4 +93,5 @@
 	eRCL_IM	dx, 1
 	loop	.ShiftNextBit
+%endif
 %endmacro
 
@@ -88,5 +100,5 @@
 ; SHR_DXAX
 ;	Parameters:
-;		%1:		Number of bits to shift
+;		%1:		Number of bits to shift. Can be (in preferred order) CX, CL or an immediate value.
 ;	Returns:
 ;		DX:AX	Shifted value
@@ -95,5 +107,20 @@
 ;--------------------------------------------------------------------
 %macro SHR_DXAX 1
+%ifdef USE_386
 	%ifnidni %1, cx
+		; %1 is CL or an immediate
+		shrd	ax, dx, %1
+		shr		dx, %1
+	%else
+		; %1 is CX
+		shrd	ax, dx, cl
+		shr		dx, cl
+	%endif
+%else
+	%ifidni %1, cl
+		; %1 is CL
+		xor		ch, ch
+	%elifnidni %1, cx
+		; %1 is an immediate
 		mov		cx, %1
 	%endif
@@ -103,4 +130,5 @@
 	rcr		ax, 1
 	loop	.ShiftNextBit
+%endif
 %endmacro
 
Index: trunk/Assembly_Library/Inc/Menu.inc
===================================================================
--- trunk/Assembly_Library/Inc/Menu.inc	(revision 590)
+++ trunk/Assembly_Library/Inc/Menu.inc	(revision 592)
@@ -159,5 +159,5 @@
 SCROLL_THUMB_CHARACTER				EQU		BLOCK_FULL_FOREGROUND
 
-NO_ITEM_SELECTED					EQU		-1
+;NO_ITEM_SELECTED					EQU		-1
 NO_ITEM_HIGHLIGHTED					EQU		-1
 NO_TIMEOUT_USED						EQU		0
Index: trunk/Assembly_Library/Src/AssemblyLibrary.asm
===================================================================
--- trunk/Assembly_Library/Src/AssemblyLibrary.asm	(revision 590)
+++ trunk/Assembly_Library/Src/AssemblyLibrary.asm	(revision 592)
@@ -90,5 +90,5 @@
   %endif
 	%include "Char.asm"
-	%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+	%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_BIOSDRVS
 		%include "String.asm"
 		%include "StringProcess.asm"
@@ -106,5 +106,5 @@
 
 %ifdef INCLUDE_TIME_LIBRARY
-	%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+	%ifndef EXCLUDE_FROM_XUB
 		%include "Delay.asm"
 		%ifndef EXCLUDE_FROM_XTIDECFG
@@ -119,13 +119,17 @@
 	%define UTIL_SIZE_JUMP_ALIGN 1
   %endif
-	%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
-		%include "Bit.asm"
+	%ifndef EXCLUDE_FROM_XUB
+		%ifndef EXCLUDE_FROM_BIOSDRVS
+			%include "Bit.asm"
+		%endif
+		%include "Math.asm"
 	%endif
-	%include "Math.asm"
-	%include "Registers.asm"
-	%include "Reboot.asm"
-	%include "Memory.asm"
+	%ifndef EXCLUDE_FROM_BIOSDRVS
+		%include "Registers.asm"
+		%include "Reboot.asm"
+		%include "Memory.asm"
+	%endif
 	%include "Size.asm"
-	%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+	%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_BIOSDRVS
 		%include "Sort.asm"
 	%endif
Index: trunk/Assembly_Library/Src/Display/CgaSnow.asm
===================================================================
--- trunk/Assembly_Library/Src/Display/CgaSnow.asm	(revision 590)
+++ trunk/Assembly_Library/Src/Display/CgaSnow.asm	(revision 592)
@@ -106,5 +106,5 @@
 ;		AX, CX, DX
 ;--------------------------------------------------------------------
-%ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifdef EXCLUDE_FROM_XUB
 	%ifdef MODULE_STRINGS_COMPRESSED
 		%define EXCLUDE
Index: trunk/Assembly_Library/Src/Display/Display.asm
===================================================================
--- trunk/Assembly_Library/Src/Display/Display.asm	(revision 590)
+++ trunk/Assembly_Library/Src/Display/Display.asm	(revision 592)
@@ -38,5 +38,7 @@
 	push	dx
 
+%ifdef CLD_NEEDED
 	cld
+%endif
 	LOAD_BDA_SEGMENT_TO	ds, dx
 	mov		dx, di
@@ -76,5 +78,5 @@
 	%define InitializeDisplayContext						DisplayContext_Initialize
 
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 	%define SetCharacterPointerFromBXAX						DisplayContext_SetCharacterPointerFromBXAX
 %endif
@@ -89,5 +91,5 @@
 	%define SynchronizeDisplayContextToHardware				DisplayContext_SynchronizeToHardware
 
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 	%define GetCharacterPointerToBXAX						DisplayContext_GetCharacterPointerToBXAX
 %endif
@@ -96,9 +98,9 @@
 
 	%define FormatNullTerminatedStringFromCSSI				Display_FormatNullTerminatedStringFromCSSI
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 	%define PrintSignedWordFromAXWithBaseInBL				DisplayPrint_SignedWordFromAXWithBaseInBL
 %endif
 	%define PrintWordFromAXWithBaseInBL						DisplayPrint_WordFromAXWithBaseInBL
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS OR EXCLUDE_FROM_XTIDECFG
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_XTIDECFG
 	%define PrintQWordFromSSBPwithBaseInBX					DisplayPrint_QWordFromSSBPwithBaseInBX
 %endif
@@ -109,5 +111,5 @@
 	%define PrintCharacterFromAL							DisplayPrint_CharacterFromAL
 	%define PrintNewlineCharacters							DisplayPrint_Newline
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 	%define ClearAreaWithHeightInAHandWidthInAL				DisplayPrint_ClearAreaWithHeightInAHandWidthInAL
 %endif
Index: trunk/Assembly_Library/Src/Display/DisplayContext.asm
===================================================================
--- trunk/Assembly_Library/Src/Display/DisplayContext.asm	(revision 590)
+++ trunk/Assembly_Library/Src/Display/DisplayContext.asm	(revision 592)
@@ -110,5 +110,5 @@
 ;		AX, DI
 ;--------------------------------------------------------------------
-%ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifdef EXCLUDE_FROM_XUB
 	%ifndef MODULE_BOOT_MENU
 		%define EXCLUDE
@@ -116,5 +116,5 @@
 %endif
 
-%ifndef EXCLUDE
+%ifndef EXCLUDE OR EXCLUDE_FROM_BIOSDRVS
 ALIGN DISPLAY_JUMP_ALIGN
 DisplayContext_Push:
@@ -170,5 +170,5 @@
 	mov		ds, di					; Restore DS
 	ret
-%endif ; EXCLUDE
+%endif ; EXCLUDE OR EXCLUDE_FROM_BIOSDRVS
 %undef EXCLUDE
 
@@ -184,5 +184,5 @@
 ;		AX, DI
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_BIOSDRVS
 ALIGN DISPLAY_JUMP_ALIGN
 DisplayContext_PrepareOffScreenBufferInESBXwithLengthInCX:
@@ -202,5 +202,5 @@
 	pop		ds
 	ret
-%endif ; EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%endif ; EXCLUDE_FROM_XUB OR EXCLUDE_FROM_BIOSDRVS
 
 
@@ -215,5 +215,5 @@
 ;		AX
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_BIOSDRVS
 ALIGN DISPLAY_JUMP_ALIGN
 DisplayContext_SetCharacterPointerFromBXAX:
@@ -235,5 +235,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_BIOSDRVS
 ALIGN DISPLAY_JUMP_ALIGN
 DisplayContext_GetCharacterPointerToBXAX:
@@ -244,5 +244,5 @@
 
 
-%ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifdef EXCLUDE_FROM_XUB
 	%ifndef MODULE_BOOT_MENU
 		%define EXCLUDE
@@ -282,4 +282,5 @@
 ;--------------------------------------------------------------------
 %ifndef EXCLUDE	; 2 of 3
+%ifndef EXCLUDE_FROM_BIOSDRVS
 ALIGN DISPLAY_JUMP_ALIGN
 DisplayContext_SetCharacterAttributeFromAL:
@@ -287,4 +288,5 @@
 	ret
 %endif
+%endif
 
 
@@ -300,4 +302,5 @@
 ;--------------------------------------------------------------------
 %ifndef EXCLUDE	; 3 of 3
+%ifndef EXCLUDE_FROM_BIOSDRVS
 ALIGN DISPLAY_JUMP_ALIGN
 DisplayContext_SetCharacterOutputParameterFromAX:
@@ -305,4 +308,5 @@
 	ret
 %endif
+%endif
 
 %undef EXCLUDE
@@ -318,5 +322,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS OR EXCLUDE_FROM_XTIDECFG
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_XTIDECFG OR EXCLUDE_FROM_BIOSDRVS
 ALIGN DISPLAY_JUMP_ALIGN
 DisplayContext_GetCharacterOutputParameterToDX:
Index: trunk/Assembly_Library/Src/Display/DisplayCursor.asm
===================================================================
--- trunk/Assembly_Library/Src/Display/DisplayCursor.asm	(revision 590)
+++ trunk/Assembly_Library/Src/Display/DisplayCursor.asm	(revision 592)
@@ -48,5 +48,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-%ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifdef EXCLUDE_FROM_XUB
 	%ifndef MODULE_BOOT_MENU
 		%define EXCLUDE
@@ -54,5 +54,5 @@
 %endif
 
-%ifndef EXCLUDE
+%ifndef EXCLUDE OR EXCLUDE_FROM_BIOSDRVS
 ALIGN DISPLAY_JUMP_ALIGN
 DisplayCursor_SetShapeFromAX:
Index: trunk/Assembly_Library/Src/Display/DisplayFormat.asm
===================================================================
--- trunk/Assembly_Library/Src/Display/DisplayFormat.asm	(revision 590)
+++ trunk/Assembly_Library/Src/Display/DisplayFormat.asm	(revision 592)
@@ -142,5 +142,5 @@
 
 .rgcFormatCharToLookupIndex:
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 	db		"aIAduxsSctz-+%"
 %else
@@ -150,10 +150,10 @@
 ALIGN WORD_ALIGN
 .rgfnFormatSpecifierParser:
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 	dw		a_FormatAttributeForNextCharacter
 %endif
 	dw		I_FormatDashForZero
 	dw		A_FormatAttributeForRemainingString
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 	dw		d_FormatSignedDecimalWord
 %endif
@@ -161,14 +161,14 @@
 	dw		x_FormatHexadecimalWord
 	dw		s_FormatStringFromSegmentCS
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 	dw		S_FormatStringFromFarPointer
 %endif
 	dw		c_FormatCharacter
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 	dw		t_FormatRepeatCharacter
 %endif
 	dw		z_FormatStringFromSegmentZero
 	dw		PrepareToPrependParameterWithSpaces
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 	dw		PrepareToAppendSpacesAfterParameter
 	dw		percent_FormatPercent
@@ -308,5 +308,5 @@
 ;		AX, BX, DX
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 ALIGN DISPLAY_JUMP_ALIGN
 a_FormatAttributeForNextCharacter:
@@ -330,5 +330,5 @@
 	ret
 
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 ALIGN DISPLAY_JUMP_ALIGN
 d_FormatSignedDecimalWord:
@@ -391,5 +391,5 @@
 	ret
 
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 ALIGN DISPLAY_JUMP_ALIGN
 S_FormatStringFromFarPointer:
@@ -408,5 +408,5 @@
 	jmp		DisplayPrint_CharacterFromAL
 
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 ALIGN DISPLAY_JUMP_ALIGN
 t_FormatRepeatCharacter:
Index: trunk/Assembly_Library/Src/Display/DisplayPage.asm
===================================================================
--- trunk/Assembly_Library/Src/Display/DisplayPage.asm	(revision 590)
+++ trunk/Assembly_Library/Src/Display/DisplayPage.asm	(revision 592)
@@ -31,5 +31,5 @@
 ;		AX, DX
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS OR EXCLUDE_FROM_XTIDECFG
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_XTIDECFG OR EXCLUDE_FROM_BIOSDRVS
 ALIGN DISPLAY_JUMP_ALIGN
 DisplayPage_SetFromAL:
@@ -41,5 +41,5 @@
 
 
-%ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifdef EXCLUDE_FROM_XUB
 	%define EXCLUDE
 	%ifdef MODULE_HOTKEYS OR MODULE_BOOT_MENU
@@ -48,5 +48,5 @@
 %endif
 
-%ifndef EXCLUDE
+%ifndef EXCLUDE OR EXCLUDE_FROM_BIOSDRVS
 ;--------------------------------------------------------------------
 ; DisplayPage_GetColumnsToALandRowsToAH
Index: trunk/Assembly_Library/Src/Display/DisplayPrint.asm
===================================================================
--- trunk/Assembly_Library/Src/Display/DisplayPrint.asm	(revision 590)
+++ trunk/Assembly_Library/Src/Display/DisplayPrint.asm	(revision 592)
@@ -94,5 +94,5 @@
 ;		AX, BH, DX
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 ALIGN DISPLAY_JUMP_ALIGN
 DisplayPrint_SignedWordFromAXWithBaseInBL:
@@ -163,5 +163,5 @@
 ;		AX, DX, [SS:BP]
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS OR EXCLUDE_FROM_XTIDECFG
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_XTIDECFG
 ALIGN DISPLAY_JUMP_ALIGN
 DisplayPrint_QWordFromSSBPwithBaseInBX:
@@ -194,5 +194,5 @@
 ;		AX, DX
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_BIOSDRVS
 ALIGN DISPLAY_JUMP_ALIGN
 DisplayPrint_CharacterBufferFromBXSIwithLengthInCX:
@@ -261,5 +261,5 @@
 ;		AX, DX
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_BIOSDRVS
 ALIGN DISPLAY_JUMP_ALIGN
 DisplayPrint_ClearAreaWithHeightInAHandWidthInAL:
@@ -292,5 +292,5 @@
 %endif
 
-%ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifdef EXCLUDE_FROM_XUB
 	%define EXCLUDE
 	%ifndef MODULE_STRINGS_COMPRESSED
Index: trunk/Assembly_Library/Src/File/Directory.asm
===================================================================
--- trunk/Assembly_Library/Src/File/Directory.asm	(revision 590)
+++ trunk/Assembly_Library/Src/File/Directory.asm	(revision 592)
@@ -99,4 +99,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
+%ifndef EXCLUDE_FROM_XTIDECFG
 ALIGN JUMP_ALIGN
 Directory_GetMatchCountToAXforSearchStringInDSSIwithAttributesInCX:
@@ -115,4 +116,5 @@
 	pop		dx
 	ret
+%endif
 
 
Index: trunk/Assembly_Library/Src/File/DosCritical.asm
===================================================================
--- trunk/Assembly_Library/Src/File/DosCritical.asm	(revision 590)
+++ trunk/Assembly_Library/Src/File/DosCritical.asm	(revision 592)
@@ -1,7 +1,3 @@
-; File name		:	DosCritical.asm
 ; Project name	:	Assembly Library
-; Created date	:	1.9.2010
-; Last update	:	2.9.2010
-; Author		:	Tomi Tilli
 ; Description	:	DOS Critical Error Handler (24h) replacements.
 
@@ -22,4 +18,5 @@
 ;
 
+; Note! Only DOS functions 01h - 0Ch, 30h and 59h can be called from a Critical Error Handler.
 
 ; DOS Critical Error Handler return values
@@ -28,5 +25,5 @@
 	.retryOperation								resb	1
 	.terminateProgramAsThoughInt21hAH4ChCalled	resb	1
-	.failSystemCallInProgress					resb	1
+	.failSystemCallInProgress					resb	1	; Needs DOS 3.1+
 endstruc
 
@@ -83,4 +80,36 @@
 
 ;--------------------------------------------------------------------
+; DosCritical_CustomHandler
+;	Parameters:
+;		Nothing
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		Nothing
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+DosCritical_CustomHandler:
+	add		sp, 6	; Remove the INT 24h return address and flags from stack
+
+	mov		ah, GET_EXTENDED_ERROR_INFORMATION	; Requires DOS 3.0+
+	xor		bx, bx
+	int		DOS_INTERRUPT_21h
+	mov		[cs:bLastCriticalError], al
+
+	pop		ax
+	pop		bx
+	pop		cx
+	pop		dx
+	pop		si
+	pop		di
+	pop		bp
+	pop		ds
+	pop		es
+	iret			; Return from the INT 21h call
+
+bLastCriticalError:		db	0
+
+
+;--------------------------------------------------------------------
 ; DosCritical_HandlerToIgnoreAllErrors
 ;	Parameters:
@@ -95,2 +124,3 @@
 	mov		al, CRITICAL_ERROR_ACTION.ignoreErrorAndContinueProcessingRequest
 	iret
+
Index: trunk/Assembly_Library/Src/File/Drive.asm
===================================================================
--- trunk/Assembly_Library/Src/File/Drive.asm	(revision 590)
+++ trunk/Assembly_Library/Src/File/Drive.asm	(revision 592)
@@ -30,4 +30,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
+%ifndef EXCLUDE_FROM_XTIDECFG
 ALIGN JUMP_ALIGN
 Drive_GetNumberOfAvailableDrivesToAX:
@@ -42,4 +43,5 @@
 	pop		dx
 	ret
+%endif
 
 
Index: trunk/Assembly_Library/Src/File/FileIO.asm
===================================================================
--- trunk/Assembly_Library/Src/File/FileIO.asm	(revision 590)
+++ trunk/Assembly_Library/Src/File/FileIO.asm	(revision 592)
@@ -35,4 +35,5 @@
 ;		AX, BX
 ;--------------------------------------------------------------------
+%ifndef EXCLUDE_FROM_XTIDECFG
 ALIGN JUMP_ALIGN
 FileIO_CreateWithPathInDSSIandAttributesInCX:
@@ -40,4 +41,5 @@
 	SKIP2B	bx
 	; Fall to FileIO_OpenWithPathInDSSIandFileAccessInAL
+%endif
 
 ;--------------------------------------------------------------------
Index: trunk/Assembly_Library/Src/Keyboard/Keyboard.asm
===================================================================
--- trunk/Assembly_Library/Src/Keyboard/Keyboard.asm	(revision 590)
+++ trunk/Assembly_Library/Src/Keyboard/Keyboard.asm	(revision 592)
@@ -37,5 +37,5 @@
 ;		DX
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_BIOSDRVS
 ALIGN KEYBOARD_JUMP_ALIGN
 Keyboard_ReadUserInputtedWordWhilePrinting:
@@ -87,5 +87,5 @@
 ;		AX
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_BIOSDRVS
 ALIGN KEYBOARD_JUMP_ALIGN
 Keyboard_ReadUserInputtedStringToESDIWhilePrinting:
@@ -98,5 +98,7 @@
 	xor		bx, bx								; Zero character counter
 	dec		cx									; Decrement buffer size for NULL
+%ifdef CLD_NEEDED
 	cld
+%endif
 ALIGN KEYBOARD_JUMP_ALIGN
 .GetCharacterFromUser:
@@ -197,5 +199,5 @@
 	xor		al, al								; Set ZF and clear CF
 	ret
-%endif ; EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%endif ; EXCLUDE_FROM_XUB OR EXCLUDE_FROM_BIOSDRVS
 
 
@@ -209,5 +211,5 @@
 ;		AX
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_BIOSDRVS
 ALIGN KEYBOARD_JUMP_ALIGN
 Keyboard_PrintBackspace:
@@ -230,5 +232,5 @@
 ;		AX
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_BIOSDRVS
 ALIGN KEYBOARD_JUMP_ALIGN
 Keyboard_PlayBellForUnwantedKeystroke:
@@ -246,5 +248,5 @@
 ;		AX
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_BIOSDRVS
 ALIGN KEYBOARD_JUMP_ALIGN
 Keyboard_PrintInputtedCharacter:
@@ -266,5 +268,5 @@
 ;		AX
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS	; Only used when debugging
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_BIOSDRVS				; Only used when debugging
 ALIGN KEYBOARD_JUMP_ALIGN
 Keyboard_RemoveAllKeystrokesFromBuffer:
@@ -289,5 +291,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-%ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifdef EXCLUDE_FROM_XUB
 	%define EXCLUDE
 	%ifdef MODULE_HOTKEYS OR MODULE_BOOT_MENU
Index: trunk/Assembly_Library/Src/LibSizeCheck.asm
===================================================================
--- trunk/Assembly_Library/Src/LibSizeCheck.asm	(revision 590)
+++ trunk/Assembly_Library/Src/LibSizeCheck.asm	(revision 592)
@@ -20,5 +20,5 @@
 
 ; Include .inc files
-%define EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%define EXCLUDE_FROM_XUB
 ;%define INCLUDE_DISPLAY_LIBRARY
 ;%define INCLUDE_FILE_LIBRARY
Index: trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm	(revision 590)
+++ trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm	(revision 592)
@@ -249,6 +249,11 @@
 ALIGN JUMP_ALIGN
 AppendFileFromDTAinDSSItoOffScreenBuffer:
-	call	.FilterCurrentDirectory			; We never want "."
-	call	.FilterUpDirectoryWhenInRoot	; No ".." when in root directory
+	cmp		WORD [si+DTA.szFile], CURRENTDIR_CHARACTERS
+	je		SHORT .Return					; We never want "."
+	test	dl, dl
+	jnz		SHORT .NotInRootDirectory
+	cmp		WORD [si+DTA.szFile], UPDIR_CHARACTERS
+	je		SHORT .Return					; No ".." when in root directory
+.NotInRootDirectory:
 	inc		cx								; Nothing filtered so increment files/directories
 
@@ -262,34 +267,5 @@
 	pop		si
 	pop		bp
-	ret
-
-;--------------------------------------------------------------------
-; .FilterCurrentDirectory
-; .FilterUpDirectoryWhenInRoot
-;	Parameters:
-;		DL:		Zero if root directory selected
-;		DS:SI:	Ptr to DTA containing file information
-;	Returns:
-;		Nothing
-;		Returns from AppendFileToBufferInESDIfromDtaInDSSI when filtering
-;	Corrupts registers:
-;		AX
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-.FilterCurrentDirectory:
-	cmp		WORD [si+DTA.szFile], CURRENTDIR_CHARACTERS
-	je		SHORT .DoFilter
-	ret
-
-ALIGN JUMP_ALIGN
-.FilterUpDirectoryWhenInRoot:
-	test	dl, dl			; Set ZF if root directory selected
-	jnz		SHORT .ReturnWithoutFiltering
-	cmp		WORD [si+DTA.szFile], UPDIR_CHARACTERS
-	jne		SHORT .ReturnWithoutFiltering
-.DoFilter:
-	add		sp, BYTE 2		; Remove return address from stack
-ALIGN JUMP_ALIGN, ret
-.ReturnWithoutFiltering:
+.Return:
 	ret
 
@@ -473,7 +449,7 @@
 ALIGN JUMP_ALIGN
 GetInfoLinesToCXandDialogFlagsToAX:
-	xor		ax, ax
-	call	GetDialogFlagsToAL
-	jmp		Bit_GetSetCountToCXfromAX
+	ePUSH_T	ax, Bit_GetSetCountToCXfromAX
+	xor		ah, ah
+	; Fall to GetDialogFlagsToAL
 
 ;--------------------------------------------------------------------
@@ -696,4 +672,5 @@
 	call	.ChangeDriveToUserSelectionFromIoInDSSI
 	add		sp, BYTE DRIVE_DIALOG_IO_size
+.UserCancelledDriveChange:
 	ret
 
@@ -729,9 +706,48 @@
 	jne		SHORT .UserCancelledDriveChange
 
+	; Install our Custom Critical Error Handler to catch "Drive Not Ready" errors. This handler only works on DOS 3.0+ systems
+	; but that should be OK because only DOS 3.1+ will trigger it. Under older DOS versions drives are enumerated using
+	; GET_DOS_DRIVE_PARAMETER_BLOCK_FOR_SPECIFIC_DRIVE which will access the drive so we know it is available at this point.
+	mov		dx, DosCritical_CustomHandler
+	call	DosCritical_InstallNewHandlerFromCSDX
+
+	; Save the current drive on stack in case the selected drive is not ready and the user decides to cancel the change.
+	call	Drive_GetDefaultToAL
+	xchg	dx, ax
+
+.RetryDrive:
+	push	dx									; Save the previous current drive to stack
+
 	mov		dl, [si+DRIVE_DIALOG_IO.bReturnDriveNumber]
 	call	Drive_SetDefaultFromDL
+
+	; Now we must try to force a media access to catch "Drive Not Ready".
+	push	ds
+	push	ss
+	pop		ds
+	ePUSH_T	ax, CURRENTDIR_CHARACTERS
+	mov		cx, FLG_FILEATTR_DIRECTORY
+	mov		dx, sp
+	mov		ax, FIND_FIRST_MATCHING_FILE<<8
+	int		DOS_INTERRUPT_21h
+	pop		ax
+	pop		ds
+
+	pop		dx									; Restore the previous current drive from stack
+
+	xchg	ah, [cs:bLastCriticalError]			; Zero bLastCriticalError and fetch error code to AH
+	cmp		ah, ERR_DOS_DRIVE_NOT_READY
+	jne		SHORT .DriveIsReady
+
+	mov		bx, g_szDlgDriveNotReady
+	call	Dialogs_DisplayYesNoResponseDialogWithTitleStringInBX
+	jz		SHORT .RetryDrive
+	; The user cancelled the drive change. Restore current drive to what it was previously.
+	call	Drive_SetDefaultFromDL
+	jmp		DosCritical_RestoreDosHandler
+
+.DriveIsReady:
+	call	DosCritical_RestoreDosHandler
 	jmp		RefreshFilesToDisplay
-.UserCancelledDriveChange:
-	ret
 
 
Index: trunk/Assembly_Library/Src/Menu/MenuAttributes.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/MenuAttributes.asm	(revision 590)
+++ trunk/Assembly_Library/Src/Menu/MenuAttributes.asm	(revision 592)
@@ -91,4 +91,5 @@
 
 .rgcColorAttributes:
+; Classic (default theme)
 istruc ATTRIBUTE_CHARS
 	at	ATTRIBUTE_CHARS.cBordersAndBackground,	db	COLOR_ATTRIBUTE(COLOR_YELLOW, COLOR_BLUE)
@@ -100,4 +101,5 @@
 	at	ATTRIBUTE_CHARS.cNormalTimeout,			db	COLOR_ATTRIBUTE(COLOR_GREEN, COLOR_BLUE)
 iend
+ColorTheme	equ		MenuAttribute_GetToAXfromTypeInSI.rgcColorAttributes
 
 .rgcBlackAndWhiteAttributes:	; Only COLOR_WHITE, COLOR_BRIGHT_WHITE and COLOR_BLACK should be used
Index: trunk/Assembly_Library/Src/Menu/MenuBorders.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/MenuBorders.asm	(revision 590)
+++ trunk/Assembly_Library/Src/Menu/MenuBorders.asm	(revision 592)
@@ -87,5 +87,5 @@
 ;		AX, BX, CX, DX, SI, DI
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_XTIDECFG
 ALIGN MENU_JUMP_ALIGN
 MenuBorders_RefreshItemBorders:
Index: trunk/Assembly_Library/Src/Menu/MenuInit.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/MenuInit.asm	(revision 590)
+++ trunk/Assembly_Library/Src/Menu/MenuInit.asm	(revision 592)
@@ -114,5 +114,5 @@
 ;		AX, BX, DX
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 ALIGN MENU_JUMP_ALIGN
 MenuInit_CloseMenuIfExitEventAllows:
@@ -138,5 +138,5 @@
 
 
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 ;--------------------------------------------------------------------
 ; MenuInit_HighlightItemFromAX
@@ -168,5 +168,5 @@
 	mov		ax, [bp+MENUINIT.wHighlightedItem]
 	ret
-%endif ; EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%endif ; EXCLUDE_FROM_XUB
 
 
@@ -183,5 +183,6 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
+%ifndef EXCLUDE_FROM_XTIDECFG
 ALIGN MENU_JUMP_ALIGN
 MenuInit_SetTitleHeightFromAL:
@@ -193,4 +194,5 @@
 	mov		[bp+MENUINIT.bInfoLines], al
 	ret
+%endif ; EXCLUDE_FROM_XTIDECFG
 
 ALIGN MENU_JUMP_ALIGN
@@ -198,5 +200,5 @@
 	mov		[bp+MENUINIT.wItems], ax
 	ret
-%endif
+%endif ; EXCLUDE_FROM_XUB
 
 
@@ -212,5 +214,6 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
+%ifndef EXCLUDE_FROM_XTIDECFG
 ALIGN MENU_JUMP_ALIGN
 MenuInit_SetUserDataFromDSSI:
@@ -218,4 +221,5 @@
 	mov		[bp+MENU.dwUserData+2], ds
 	ret
+%endif ; EXCLUDE_FROM_XTIDECFG
 
 ALIGN MENU_JUMP_ALIGN
@@ -223,3 +227,3 @@
 	lds		si, [bp+MENU.dwUserData]
 	ret
-%endif
+%endif ; EXCLUDE_FROM_XUB
Index: trunk/Assembly_Library/Src/Menu/MenuLocation.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/MenuLocation.asm	(revision 590)
+++ trunk/Assembly_Library/Src/Menu/MenuLocation.asm	(revision 592)
@@ -55,5 +55,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 MenuLocation_GetItemBordersTopLeftCoordinatesToAX:
 %endif
Index: trunk/Assembly_Library/Src/Menu/MenuText.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/MenuText.asm	(revision 590)
+++ trunk/Assembly_Library/Src/Menu/MenuText.asm	(revision 592)
@@ -32,5 +32,5 @@
 ;		AX, BX, CX, DX, SI, DI
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_XTIDECFG
 ALIGN MENU_JUMP_ALIGN
 MenuText_ClearTitleArea:
Index: trunk/Assembly_Library/Src/Serial/SerialServer.asm
===================================================================
--- trunk/Assembly_Library/Src/Serial/SerialServer.asm	(revision 590)
+++ trunk/Assembly_Library/Src/Serial/SerialServer.asm	(revision 592)
@@ -61,6 +61,8 @@
 		push	ax				; working copy on the top of the stack
 
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS	; DF already cleared in Int13h.asm
+%ifndef EXCLUDE_FROM_XUB		; DF already cleared in Int13h.asm
+%ifdef CLD_NEEDED
 		cld
+%endif
 %endif
 
Index: trunk/Assembly_Library/Src/String/Char.asm
===================================================================
--- trunk/Assembly_Library/Src/String/Char.asm	(revision 590)
+++ trunk/Assembly_Library/Src/String/Char.asm	(revision 592)
@@ -51,5 +51,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-%ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifdef EXCLUDE_FROM_XUB
 	%ifndef MODULE_HOTKEYS
 		%define EXCLUDE
@@ -57,5 +57,5 @@
 %endif
 
-%ifndef EXCLUDE
+%ifndef EXCLUDE OR EXCLUDE_FROM_BIOSDRVS
 ALIGN STRING_JUMP_ALIGN
 Char_IsLowerCaseLetterInAL:
@@ -76,5 +76,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_BIOSDRVS
 ALIGN STRING_JUMP_ALIGN
 Char_IsUpperCaseLetterInAL:
@@ -95,5 +95,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_BIOSDRVS
 ALIGN STRING_JUMP_ALIGN
 Char_IsHexadecimalDigitInAL:
@@ -136,5 +136,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_BIOSDRVS
 ALIGN STRING_JUMP_ALIGN
 Char_ConvertIntegerToALfromDigitInALwithBaseInBX:
@@ -166,5 +166,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_BIOSDRVS
 ALIGN STRING_JUMP_ALIGN
 Char_CharIsValid:
@@ -174,5 +174,5 @@
 
 
-%ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifdef EXCLUDE_FROM_XUB
 	%ifndef MODULE_HOTKEYS
 		%define EXCLUDE
@@ -201,5 +201,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_BIOSDRVS
 ALIGN STRING_JUMP_ALIGN
 Char_ALtoLowerCaseLetter:
@@ -218,5 +218,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_BIOSDRVS
 ALIGN STRING_JUMP_ALIGN
 Char_ALtoUpperCaseLetter:
@@ -237,5 +237,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_BIOSDRVS
 Char_ChangeCaseInAL:
 	xor		al, 32
@@ -254,5 +254,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_BIOSDRVS
 ALIGN STRING_JUMP_ALIGN
 Char_GetFilterFunctionToDXforNumericBaseInBX:
Index: trunk/Assembly_Library/Src/Time/TimerTicks.asm
===================================================================
--- trunk/Assembly_Library/Src/Time/TimerTicks.asm	(revision 590)
+++ trunk/Assembly_Library/Src/Time/TimerTicks.asm	(revision 592)
@@ -48,5 +48,5 @@
 ;		CX
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 %ifndef EXCLUDE_FROM_XTIDECFG
 ALIGN JUMP_ALIGN
@@ -64,7 +64,7 @@
 	div		cx		; Divide DX:AX by CX, Minutes to AX, remainder ticks to DX
 	ret
-%endif ; EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
-
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS OR EXCLUDE_FROM_XTIDECFG
+%endif ; EXCLUDE_FROM_XUB
+
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_XTIDECFG
 ALIGN JUMP_ALIGN
 TimerTicks_GetSecondsToAXandRemainderTicksToDXfromTicksInDX:
@@ -80,5 +80,5 @@
 
 
-%ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifdef EXCLUDE_FROM_XUB
 	%ifndef MODULE_BOOT_MENU
 		%define EXCLUDE
@@ -164,5 +164,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_XTIDECFG
 ALIGN JUMP_ALIGN
 TimerTicks_GetElapsedToAXandResetDSBX:
@@ -184,5 +184,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_XTIDECFG
 ALIGN JUMP_ALIGN
 TimerTicks_GetElapsedToAXfromDSBX:
@@ -202,5 +202,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-%ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifdef EXCLUDE_FROM_XUB
 	%ifndef MODULE_BOOT_MENU OR MODULE_HOTKEYS
 		%define EXCLUDE
Index: trunk/Assembly_Library/Src/Util/Bit.asm
===================================================================
--- trunk/Assembly_Library/Src/Util/Bit.asm	(revision 590)
+++ trunk/Assembly_Library/Src/Util/Bit.asm	(revision 592)
@@ -24,5 +24,5 @@
 ; Bit_GetSetCountToCXfromDXAX
 ;	Parameters
-;		DX:AX:		Source DWORD
+;		DX:AX:	Source DWORD
 ;	Returns:
 ;		CX:		Number of bits set in DX:AX
@@ -58,14 +58,12 @@
 	push	ax
 
-	xor		cx, cx
+	mov		cx, -1
 ALIGN JUMP_ALIGN
-.BitScanLoop:
+.IncrementCX:
+	inc		cx
+.ShiftLoop:
 	shr		ax, 1
-	jz		SHORT .LastBitInCF
-	adc		cl, ch
-	jmp		SHORT .BitScanLoop
-ALIGN JUMP_ALIGN
-.LastBitInCF:
-	adc		cl, ch
+	jc		SHORT .IncrementCX
+	jnz		SHORT .ShiftLoop
 
 	pop		ax
@@ -95,4 +93,5 @@
 	ret
 
+
 ;--------------------------------------------------------------------
 ; Bit_SetToAXfromIndexInCL
@@ -115,2 +114,3 @@
 	pop		dx
 	ret
+
Index: trunk/Assembly_Library/Src/Util/Math.asm
===================================================================
--- trunk/Assembly_Library/Src/Util/Math.asm	(revision 590)
+++ trunk/Assembly_Library/Src/Util/Math.asm	(revision 592)
@@ -33,27 +33,7 @@
 ;		AX
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS OR EXCLUDE_FROM_XTIDECFG
+%ifndef EXCLUDE_FROM_XTIDECFG
 ALIGN JUMP_ALIGN
 Math_DivQWatSSBPbyCX:
-%if 1
-	xor		dx, dx
-	mov		ax, [bp+6]		; Load highest divident WORD to DX:AX
-	div		cx
-	mov		[bp+6], ax		; Store quotient
-
-	mov		ax, [bp+4]
-	div		cx
-	mov		[bp+4], ax
-
-	mov		ax, [bp+2]
-	div		cx
-	mov		[bp+2], ax
-
-	mov		ax, [bp]
-	div		cx
-	mov		[bp], ax
-	ret
-%else ; ~1
-; This is about half the size compared to the above code but it's not tested which is why it's commented away.
 	push	di
 	mov		di, 6
@@ -65,8 +45,7 @@
 	dec		di
 	dec		di
-	jns		.Next
+	jns		SHORT .Next
 	pop		di
 	ret
-%endif ; 1
 %endif
 
@@ -83,5 +62,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDECFG
+%ifndef EXCLUDE_FROM_XTIDECFG OR EXCLUDE_FROM_BIOSDRVS
 ALIGN JUMP_ALIGN
 Math_DivDXAXbyCX:
Index: trunk/Assembly_Library/Src/Util/Memory.asm
===================================================================
--- trunk/Assembly_Library/Src/Util/Memory.asm	(revision 590)
+++ trunk/Assembly_Library/Src/Util/Memory.asm	(revision 592)
@@ -24,27 +24,20 @@
 ; OPTIMIZE_STRING_OPERATION
 ;	Parameters
-;		%1:		Repeat instruction
-;		%2:		String instruction without size (for example MOVS and not MOVSB or MOVSW)
+;		%1:		String instruction without size (only MOVS and STOS is supported)
 ;		CX:		Number of BYTEs to operate
-;		DS:SI:	Ptr to source data
+;		DS:SI:	Ptr to source data (for MOVS)
 ;		ES:DI:	Ptr to destination
 ;	Returns:
+;		CF:		Cleared
+;		CX:		Zero
 ;		SI, DI:	Updated by number of bytes operated
 ;	Corrupts registers:
 ;		Nothing
 ;--------------------------------------------------------------------
-%macro OPTIMIZE_STRING_OPERATION 2
-	push	cx
-
-	shr		cx, 1			; Operate with WORDs for performance
-	jz	%%HandleRemainingByte
-	%1		%2w
-%%HandleRemainingByte:
-	jnc		SHORT %%OperationCompleted
-	%2b
-
-ALIGN JUMP_ALIGN
-%%OperationCompleted:
-	pop		cx
+%macro OPTIMIZE_STRING_OPERATION 1
+	shr		cx, 1
+	rep		%1w
+	eRCL_IM	cx, 1
+	rep		%1b
 %endmacro
 
@@ -57,12 +50,15 @@
 ;		ES:DI:	Ptr to destination buffer
 ;	Returns:
+;		CF:		Cleared
 ;		SI, DI:	Updated by number of bytes copied
 ;	Corrupts registers:
 ;		Nothing
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 ALIGN JUMP_ALIGN
 Memory_CopyCXbytesFromDSSItoESDI:
-	OPTIMIZE_STRING_OPERATION rep, movs
+	push	cx
+	OPTIMIZE_STRING_OPERATION movs
+	pop		cx
 	ret
 %endif
@@ -77,5 +73,5 @@
 ;		Nothing
 ;	Corrupts registers:
-;		Nothing
+;		CX
 ;--------------------------------------------------------------------
 %ifdef INCLUDE_MENU_LIBRARY
@@ -102,5 +98,5 @@
 ;		DI:		Updated by number of BYTEs stored
 ;	Corrupts registers:
-;		AX
+;		AX, CX
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
@@ -118,9 +114,8 @@
 ;		DI:		Updated by number of BYTEs stored
 ;	Corrupts registers:
-;		Nothing
+;		CX
 ;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
 Memory_StoreCXbytesFromAccumToESDI:
-	OPTIMIZE_STRING_OPERATION rep, stos
+	OPTIMIZE_STRING_OPERATION stos
 	ret
 
@@ -135,5 +130,5 @@
 ;		AX
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 ALIGN JUMP_ALIGN
 Memory_ReserveCXbytesFromStackToDSSI:
Index: trunk/Assembly_Library/Src/Util/Reboot.asm
===================================================================
--- trunk/Assembly_Library/Src/Util/Reboot.asm	(revision 590)
+++ trunk/Assembly_Library/Src/Util/Reboot.asm	(revision 592)
@@ -44,5 +44,5 @@
 	mov		al, 0FEh				; System reset (AT+ keyboard controller)
 	out		64h, al					; Reset computer (AT+)
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 	%ifdef INCLUDE_TIME_LIBRARY
 		mov		ax, 10
Index: trunk/Assembly_Library/Src/Util/Registers.asm
===================================================================
--- trunk/Assembly_Library/Src/Util/Registers.asm	(revision 590)
+++ trunk/Assembly_Library/Src/Util/Registers.asm	(revision 592)
@@ -59,5 +59,5 @@
 %endif
 
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifndef EXCLUDE_FROM_XUB
 ALIGN JUMP_ALIGN
 Registers_CopySSBPtoDSSI:
@@ -91,15 +91,15 @@
 ;
 ;--------------------------------------------------------------------
-%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS OR EXCLUDE_FROM_XTIDECFG
+%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_XTIDECFG
 ALIGN JUMP_ALIGN
 Registers_NormalizeESSI:
 	mov			cx, si
-	and			si, byte 0fh
-	jmp			Registers_NormalizeFinish
+	and			si, BYTE 0Fh
+	jmp			SHORT Registers_NormalizeFinish
 
 ALIGN JUMP_ALIGN
 Registers_NormalizeESDI:
 	mov			cx, di
-	and			di, byte 0fh
+	and			di, BYTE 0Fh
 ;;; fall-through
 
Index: trunk/Assembly_Library/Src/Util/Size.asm
===================================================================
--- trunk/Assembly_Library/Src/Util/Size.asm	(revision 590)
+++ trunk/Assembly_Library/Src/Util/Size.asm	(revision 592)
@@ -70,22 +70,15 @@
 	jae		SHORT Size_DivideSizeInBXDXAXby1024andIncrementMagnitudeInCX
 	add		sp, BYTE 2					; Clean return address from stack
-	xchg	si, cx						; CX = Remainder (0...1023), SI = Magnitude
 
 	; Convert remainder to tenths
-	xchg	bx, ax						; Store AX
-	mov		al, 5						; AH = 0
-	mul		cx							; DX:AX = remainder * (10 / 2)
-%ifdef USE_186
-	shr		ax, 9						; Divide AX by (1024 / 2)
-%else
-	shr		ax, 1
-	mov		al, ah
-	cbw
-%endif
-	xchg	cx, ax						; CX = tenths
-	xchg	ax, bx
+	mov		bx, 640
+	xchg	bx, ax						; BX = Size, AX = (10 / 1024) * 65536
+	mul		si							; DX = Remainder * (10 / 1024)
+	xchg	dx, ax
+	xchg	cx, ax						; CX = Tenths, AX = Magnitude
+	xchg	bx, ax						; AX = Size, BX	= Magnitude
 
 	; Convert magnitude to character
-	mov		dl, [cs:si+.rgbMagnitudeToChar]
+	mov		dl, [cs:bx+.rgbMagnitudeToChar]
 
 	pop		si
@@ -154,5 +147,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-%ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
+%ifdef EXCLUDE_FROM_XUB
 	%ifdef USE_386
 		%define EXCLUDE
Index: trunk/Assembly_Library/Src/Util/Sort.asm
===================================================================
--- trunk/Assembly_Library/Src/Util/Sort.asm	(revision 590)
+++ trunk/Assembly_Library/Src/Util/Sort.asm	(revision 592)
@@ -63,5 +63,7 @@
 	push	cx
 
+%ifdef CLD_NEEDED
 	cld
+%endif
 	mov		cx, di						; Restore item size to CX
 	xor		ax, ax						; Zero starting index
@@ -191,5 +193,5 @@
 
 	cmp		ax, dx	; If (left <= right)
-	jg		SHORT ArrangeItemsInRangeAXtoDXtoBothSidesOfPivotInESDI
+	jg		SHORT .BreakLoopSinceAllItemsExamined
 	call	SwapItemsFromIndexesAXandDX
 	inc		ax
