Index: /trunk/Assembly_Library/Inc/Display.inc
===================================================================
--- /trunk/Assembly_Library/Inc/Display.inc	(revision 504)
+++ /trunk/Assembly_Library/Inc/Display.inc	(revision 505)
@@ -6,8 +6,9 @@
 %ifndef MODULE_STRINGS_COMPRESSED_PRECOMPRESS
 ;--------------------------------------------------------------------
-; Display Library users need to use this macro since it will provide
+; Display Library users need to use these macros since it will provide
 ; compatibility with future library versions.
 ;
 ; CALL_DISPLAY_LIBRARY
+; JMP_DISPLAY_LIBRARY
 ;	Parameters:
 ;		%1:			Function to call (functionName from DISPLAY_LIB)
@@ -28,4 +29,22 @@
 		mov		di, %1
 		call	Display_FunctionFromDI
+	%endif
+%endmacro
+
+%macro JMP_DISPLAY_LIBRARY 1
+	%ifidn %1, PushDisplayContext
+		jmp		DisplayContext_Push
+	%elifidn %1, PopDisplayContext
+		call	DisplayContext_Pop
+		ret
+	%elifidn %1, PrepareOffScreenBufferInESBXwithLengthInCX
+		jmp		DisplayContext_PrepareOffScreenBufferInESBXwithLengthInCX
+	%elifidn %1, FormatNullTerminatedStringFromCSSI
+		mov		di, %1
+		call	Display_FunctionFromDI
+		ret
+	%else
+		mov		di, %1
+		jmp		Display_FunctionFromDI
 	%endif
 %endmacro
Index: /trunk/Assembly_Library/Inc/MenuEvents.inc
===================================================================
--- /trunk/Assembly_Library/Inc/MenuEvents.inc	(revision 504)
+++ /trunk/Assembly_Library/Inc/MenuEvents.inc	(revision 505)
@@ -1,7 +1,3 @@
-; File name		:	MenuEvents.inc
 ; Project name	:	Assembly Library
-; Created date	:	13.7.2010
-; Last update	:	18.10.2010
-; Author		:	Tomi Tilli
 ; Description	:	Defines for Menu events send to the user.
 %ifndef MENUEVENTS_INC
@@ -27,6 +23,6 @@
 ;
 ; 2. If the program needs only one menu, %define MENUEVENT_INLINE_OFFSETS before this include file,
-;    and define (through EQU statements) each of the entry points as offsets from a base address.  
-; 
+;    and define (through EQU statements) each of the entry points as offsets from a base address.
+;
 
 ;
@@ -49,6 +45,6 @@
 	; Returns:
 	;	DS:SI:		Ptr to initialized MENUINIT struct
-	.InitializeMenuinitFromDSSI		resb	2
-MENUEVENT_InitializeMenuinitFromDSSI 	equ 	MENUEVENT.InitializeMenuinitFromDSSI
+	.InitializeMenuinitFromDSSI	resb	2
+%define MENUEVENT_InitializeMenuinitFromDSSI	MENUEVENT.InitializeMenuinitFromDSSI
 
 	; Parameters:
@@ -57,6 +53,6 @@
 	;	CF:			Set to exit menu
 	;				Clear to cancel exit
-	.ExitMenu						resb	2
-MENUEVENT_ExitMenu 					equ 	MENUEVENT.ExitMenu
+	.ExitMenu					resb	2
+%define MENUEVENT_ExitMenu						MENUEVENT.ExitMenu
 
 %ifdef MENUEVENT_IDLEPROCESSING_ENABLE
@@ -64,6 +60,6 @@
 	;	None
 	; See the definition of MENUEVENT_IDLEPROCESSING_ENABLE below.
-	.IdleProcessing					resb	2
-MENUEVENT_IdleProcessing 			equ		MENUEVENT.IdleProcessing
+	.IdleProcessing				resb	2
+%define MENUEVENT_IdleProcessing				MENUEVENT.IdleProcessing
 %endif
 
@@ -71,34 +67,34 @@
 	;	CX:			Index of new highlighted item
 	;	DX:			Index of previously highlighted item or NO_ITEM_HIGHLIGHTED
-	.ItemHighlightedFromCX			resb	2
-MENUEVENT_ItemHighlightedFromCX 	equ		MENUEVENT.ItemHighlightedFromCX
+	.ItemHighlightedFromCX		resb	2
+%define MENUEVENT_ItemHighlightedFromCX			MENUEVENT.ItemHighlightedFromCX
 
 	; Parameters:
 	;	CX:			Index of selected item
-	.ItemSelectedFromCX				resb	2
-MENUEVENT_ItemSelectedFromCX 		equ		MENUEVENT.ItemSelectedFromCX
+	.ItemSelectedFromCX			resb	2
+%define MENUEVENT_ItemSelectedFromCX			MENUEVENT.ItemSelectedFromCX
 
 	; Parameters:
 	;	AL:			ASCII character for the key
 	;	AH:			Keyboard library scan code for the key
-	.KeyStrokeInAX					resb	2
-MENUEVENT_KeyStrokeInAX 			equ 	MENUEVENT.KeyStrokeInAX
+	.KeyStrokeInAX				resb	2
+%define MENUEVENT_KeyStrokeInAX					MENUEVENT.KeyStrokeInAX
 
 	; Parameters:
 	;	CX:			Index of highlighted item
 	;	Cursor has been positioned to the beginning of first line
-	.RefreshTitle					resb	2
-	.RefreshInformation				resb	2
-MENUEVENT_RefreshTitle 				equ		MENUEVENT.RefreshTitle
-MENUEVENT_RefreshInformation 		equ		MENUEVENT.RefreshInformation
+	.RefreshTitle				resb	2
+	.RefreshInformation			resb	2
+%define MENUEVENT_RefreshTitle					MENUEVENT.RefreshTitle
+%define MENUEVENT_RefreshInformation			MENUEVENT.RefreshInformation
 
 	; Parameters:
 	;	CX:			Index of item to refresh
 	;	Cursor has been positioned to the beginning of item line
-	.RefreshItemFromCX				resb	2
-MENUEVENT_RefreshItemFromCX 		equ		MENUEVENT.RefreshItemFromCX
+	.RefreshItemFromCX			resb	2
+%define MENUEVENT_RefreshItemFromCX				MENUEVENT.RefreshItemFromCX
 endstruc
 
-%endif ; MENUEVENTS_INLINE_OFFSETS
+%endif ; MENUEVENT_INLINE_OFFSETS
 
 %endif ; MENUEVENTS_INC
Index: /trunk/Assembly_Library/Src/Display/DisplayFormatCompressed.asm
===================================================================
--- /trunk/Assembly_Library/Src/Display/DisplayFormatCompressed.asm	(revision 504)
+++ /trunk/Assembly_Library/Src/Display/DisplayFormatCompressed.asm	(revision 505)
@@ -139,8 +139,7 @@
 
 .PrintDigit:
-	add		al, 90h						; Convert binary digit in AL to ASCII hex digit (0 - 9 or A - F)
-	daa
-	adc		al, 40h
-	daa
+	cmp		al, 10						; Convert binary digit in AL to ASCII hex digit ('0'-'9' or 'A'-'F')
+	sbb		al, 69h
+	das
 
 	call	DisplayPrint_CharacterFromAL
Index: /trunk/Assembly_Library/Src/Display/DisplayPrint.asm
===================================================================
--- /trunk/Assembly_Library/Src/Display/DisplayPrint.asm	(revision 504)
+++ /trunk/Assembly_Library/Src/Display/DisplayPrint.asm	(revision 505)
@@ -306,5 +306,5 @@
 %endif
 
-%ifndef EXCLUDE				
+%ifndef EXCLUDE
 ;--------------------------------------------------------------------
 ; DisplayPrint_RepeatCharacterFromALwithCountInCX
@@ -397,5 +397,5 @@
 ;	Parameters:
 ;		AL:		Character to display
-;               Zero value is ignored (no characer is printed)
+;               Zero value is ignored (no character is printed)
 ;		DS:		BDA segment (zero)
 ;		ES:DI:	Ptr to cursor location in video RAM
@@ -407,5 +407,5 @@
 ALIGN DISPLAY_JUMP_ALIGN
 DisplayPrint_CharacterFromAL:
-	test	al,al
+	test	al, al
 	jz		DisplayPrint_Ret
 
Index: /trunk/Assembly_Library/Src/Menu/CharOutLineSplitter.asm
===================================================================
--- /trunk/Assembly_Library/Src/Menu/CharOutLineSplitter.asm	(revision 504)
+++ /trunk/Assembly_Library/Src/Menu/CharOutLineSplitter.asm	(revision 505)
@@ -45,6 +45,5 @@
 	xchg	ax, dx			; AL = First text line column offset
 	mov		ah, dl			; AH = Last text line column offset
-	CALL_DISPLAY_LIBRARY SetCharacterOutputParameterFromAX
-	ret
+	JMP_DISPLAY_LIBRARY SetCharacterOutputParameterFromAX
 
 
Index: /trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm
===================================================================
--- /trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm	(revision 504)
+++ /trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm	(revision 505)
@@ -3,5 +3,5 @@
 
 ;
-; XTIDE Universal BIOS and Associated Tools 
+; XTIDE Universal BIOS and Associated Tools
 ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
 ;
@@ -10,9 +10,9 @@
 ; the Free Software Foundation; either version 2 of the License, or
 ; (at your option) any later version.
-; 
+;
 ; This program is distributed in the hope that it will be useful,
 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-; GNU General Public License for more details.		
+; GNU General Public License for more details.
 ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 ;
@@ -197,6 +197,5 @@
 	call	.FindMatchingFilesAndPrintThemToOffScreenBuffer
 
-	CALL_DISPLAY_LIBRARY PopDisplayContext
-	ret
+	JMP_DISPLAY_LIBRARY PopDisplayContext
 
 ;--------------------------------------------------------------------
@@ -372,6 +371,5 @@
 ALIGN JUMP_ALIGN
 .FormatStringInCSSIandReturn:
-	CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
-	ret
+	JMP_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
 
 
@@ -755,6 +753,5 @@
 	call	MenuText_PrepareToDrawInformationArea
 	mov		si, g_szLoadingPleaseWait
-	CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
-	ret
+	JMP_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
 
 
Index: /trunk/Assembly_Library/Src/Menu/Dialog/DialogProgress.asm
===================================================================
--- /trunk/Assembly_Library/Src/Menu/Dialog/DialogProgress.asm	(revision 504)
+++ /trunk/Assembly_Library/Src/Menu/Dialog/DialogProgress.asm	(revision 505)
@@ -216,9 +216,6 @@
 ALIGN JUMP_ALIGN
 .RepeatProgressCharacterCXtimesFromAL:
-	jcxz	.NothingToRepeat
-	CALL_DISPLAY_LIBRARY PrintRepeatedCharacterFromALwithCountInCX
-ALIGN JUMP_ALIGN, ret
-.NothingToRepeat:
-	ret
+	jcxz	NothingToRepeat
+	JMP_DISPLAY_LIBRARY PrintRepeatedCharacterFromALwithCountInCX
 
 
@@ -236,4 +233,5 @@
 	mov		bx, [si+PROGRESS_DIALOG_IO.wMaxProgressValue]
 	sub		bx, [si+PROGRESS_DIALOG_IO.wMinProgressValue]
+NothingToRepeat:
 	ret
 
Index: /trunk/Assembly_Library/Src/Menu/Dialog/DialogWord.asm
===================================================================
--- /trunk/Assembly_Library/Src/Menu/Dialog/DialogWord.asm	(revision 504)
+++ /trunk/Assembly_Library/Src/Menu/Dialog/DialogWord.asm	(revision 505)
@@ -1,11 +1,7 @@
-; File name		:	DialogWord.asm
 ; Project name	:	Assembly Library
-; Created date	:	10.8.2010
-; Last update	:	18.11.2010
-; Author		:	Tomi Tilli
 ; Description	:	Displays word input dialog.
 
 ;
-; XTIDE Universal BIOS and Associated Tools 
+; XTIDE Universal BIOS and Associated Tools
 ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
 ;
@@ -14,12 +10,12 @@
 ; the Free Software Foundation; either version 2 of the License, or
 ; (at your option) any later version.
-; 
+;
 ; This program is distributed in the hope that it will be useful,
 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-; GNU General Public License for more details.		
+; GNU General Public License for more details.
 ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 ;
-		
+
 
 ; Section containing code
@@ -142,4 +138,4 @@
 
 	xchg	ax, dx
-	CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
-	ret
+	JMP_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
+
Index: /trunk/Assembly_Library/Src/Menu/MenuAttributes.asm
===================================================================
--- /trunk/Assembly_Library/Src/Menu/MenuAttributes.asm	(revision 504)
+++ /trunk/Assembly_Library/Src/Menu/MenuAttributes.asm	(revision 505)
@@ -4,5 +4,5 @@
 
 ;
-; XTIDE Universal BIOS and Associated Tools 
+; XTIDE Universal BIOS and Associated Tools
 ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
 ;
@@ -11,12 +11,12 @@
 ; the Free Software Foundation; either version 2 of the License, or
 ; (at your option) any later version.
-; 
+;
 ; This program is distributed in the hope that it will be useful,
 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-; GNU General Public License for more details.		
+; GNU General Public License for more details.
 ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 ;
-		
+
 
 ; Struct containing border characters for different types of menu window lines
@@ -48,6 +48,5 @@
 MenuAttribute_SetToDisplayContextFromTypeInSI:
 	call	MenuAttribute_GetToAXfromTypeInSI
-	CALL_DISPLAY_LIBRARY SetCharacterAttributeFromAL
-	ret
+	JMP_DISPLAY_LIBRARY SetCharacterAttributeFromAL
 
 
Index: /trunk/Assembly_Library/Src/Menu/MenuBorders.asm
===================================================================
--- /trunk/Assembly_Library/Src/Menu/MenuBorders.asm	(revision 504)
+++ /trunk/Assembly_Library/Src/Menu/MenuBorders.asm	(revision 505)
@@ -3,5 +3,5 @@
 
 ;
-; XTIDE Universal BIOS and Associated Tools 
+; XTIDE Universal BIOS and Associated Tools
 ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
 ;
@@ -10,12 +10,12 @@
 ; the Free Software Foundation; either version 2 of the License, or
 ; (at your option) any later version.
-; 
+;
 ; This program is distributed in the hope that it will be useful,
 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-; GNU General Public License for more details.		
+; GNU General Public License for more details.
 ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 ;
-		
+
 
 ; Struct containing border characters for different types of menu window lines
@@ -296,6 +296,5 @@
 ALIGN MENU_JUMP_ALIGN
 PrintNewlineToEndBorderLine:
-	CALL_DISPLAY_LIBRARY PrintNewlineCharacters
-	ret
+	JMP_DISPLAY_LIBRARY PrintNewlineCharacters
 
 
@@ -325,6 +324,5 @@
 	call	MenuBorders_PrintMultipleBorderCharactersFromAL	; AL does not matter
 
-	CALL_DISPLAY_LIBRARY PopDisplayContext
-	ret
+	JMP_DISPLAY_LIBRARY PopDisplayContext
 
 
@@ -365,6 +363,5 @@
 ALIGN MENU_JUMP_ALIGN
 MenuBorders_PrintSingleBorderCharacterFromAL:
-	CALL_DISPLAY_LIBRARY PrintCharacterFromAL
-	ret
+	JMP_DISPLAY_LIBRARY PrintCharacterFromAL
 
 ALIGN MENU_JUMP_ALIGN
Index: /trunk/Assembly_Library/Src/Menu/MenuEvent.asm
===================================================================
--- /trunk/Assembly_Library/Src/Menu/MenuEvent.asm	(revision 504)
+++ /trunk/Assembly_Library/Src/Menu/MenuEvent.asm	(revision 505)
@@ -3,5 +3,5 @@
 
 ;
-; XTIDE Universal BIOS and Associated Tools 
+; XTIDE Universal BIOS and Associated Tools
 ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
 ;
@@ -10,12 +10,12 @@
 ; the Free Software Foundation; either version 2 of the License, or
 ; (at your option) any later version.
-; 
+;
 ; This program is distributed in the hope that it will be useful,
 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-; GNU General Public License for more details.		
+; GNU General Public License for more details.
 ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 ;
-		
+
 
 ; Section containing code
@@ -58,5 +58,5 @@
 	jmp		SHORT MenuEvent_SendFromBX
 %endif
-		
+
 
 %ifdef MENUEVENT_IDLEPROCESSING_ENABLE
@@ -155,5 +155,5 @@
 ;		AX, BX, DX
 ;--------------------------------------------------------------------
-%ifdef MENUEVENT_KeyStrokInAX
+%ifdef MENUEVENT_KeyStrokeInAX
 ALIGN MENU_JUMP_ALIGN
 MenuEvent_KeyStrokeInAX:
Index: /trunk/Assembly_Library/Src/Menu/MenuText.asm
===================================================================
--- /trunk/Assembly_Library/Src/Menu/MenuText.asm	(revision 504)
+++ /trunk/Assembly_Library/Src/Menu/MenuText.asm	(revision 505)
@@ -3,5 +3,5 @@
 
 ;
-; XTIDE Universal BIOS and Associated Tools 
+; XTIDE Universal BIOS and Associated Tools
 ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
 ;
@@ -10,12 +10,12 @@
 ; the Free Software Foundation; either version 2 of the License, or
 ; (at your option) any later version.
-; 
+;
 ; This program is distributed in the hope that it will be useful,
 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-; GNU General Public License for more details.		
+; GNU General Public License for more details.
 ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 ;
-		
+
 
 ; Section containing code
@@ -40,5 +40,5 @@
 	jmp		SHORT MenuText_ClearInformationArea.ClearCLlinesOfText
 %endif
-		
+
 ALIGN MENU_JUMP_ALIGN
 MenuText_ClearInformationArea:
@@ -53,6 +53,5 @@
 	mov		al, ' '
 	CALL_DISPLAY_LIBRARY PrintRepeatedCharacterFromALwithCountInCX
-	CALL_DISPLAY_LIBRARY PopDisplayContext
-	ret
+	JMP_DISPLAY_LIBRARY PopDisplayContext
 
 
@@ -220,6 +219,5 @@
 
 	xchg	ax, bx
-	CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
-	ret
+	JMP_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
 
 
Index: /trunk/Assembly_Library/Src/TimerTest.asm
===================================================================
--- /trunk/Assembly_Library/Src/TimerTest.asm	(revision 504)
+++ /trunk/Assembly_Library/Src/TimerTest.asm	(revision 505)
@@ -3,5 +3,5 @@
 
 ;
-; XTIDE Universal BIOS and Associated Tools 
+; XTIDE Universal BIOS and Associated Tools
 ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
 ;
@@ -10,11 +10,11 @@
 ; the Free Software Foundation; either version 2 of the License, or
 ; (at your option) any later version.
-; 
+;
 ; This program is distributed in the hope that it will be useful,
 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-; GNU General Public License for more details.		
+; GNU General Public License for more details.
 ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-;		
+;
 
 ; Include .inc files
@@ -109,5 +109,5 @@
 ;	Parameters:
 ;		AX:		Difference in register and memory access durations
-;				(Precise Event Timer Ticks)	
+;				(Precise Event Timer Ticks)
 ;	Returns:
 ;		AX:		Duration for single BYTE in nanosecs
@@ -182,6 +182,5 @@
 	push	dx
 	push	ax
-	CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
-	ret
+	JMP_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
 
 
Index: /trunk/BIOS_Drive_Information_Tool/Src/Print.asm
===================================================================
--- /trunk/BIOS_Drive_Information_Tool/Src/Print.asm	(revision 504)
+++ /trunk/BIOS_Drive_Information_Tool/Src/Print.asm	(revision 505)
@@ -3,5 +3,5 @@
 
 ;
-; XTIDE Universal BIOS and Associated Tools 
+; XTIDE Universal BIOS and Associated Tools
 ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
 ;
@@ -10,11 +10,11 @@
 ; the Free Software Foundation; either version 2 of the License, or
 ; (at your option) any later version.
-; 
+;
 ; This program is distributed in the hope that it will be useful,
 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-; GNU General Public License for more details.		
+; GNU General Public License for more details.
 ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-;				
+;
 
 ; Section containing code
@@ -33,6 +33,6 @@
 	mov		bl, ATTRIBUTES_NOT_USED
 	mov		ax, DosCharOut
-	CALL_DISPLAY_LIBRARY	SetCharOutputFunctionFromAXwithAttribFlagInBL
-	ret
+	JMP_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInBL
+
 
 ;--------------------------------------------------------------------
@@ -72,5 +72,5 @@
 	call	Print_FormatStringFromSIwithParameterInAX
 	stc		; Keep the CF set
-ALIGN JUMP_ALIGN
+ALIGN JUMP_ALIGN, ret
 .NoErrors:
 	ret
@@ -182,6 +182,6 @@
 	push	ax
 	mov		si, g_szFormatCHS
-	CALL_DISPLAY_LIBRARY	FormatNullTerminatedStringFromCSSI
-	CALL_DISPLAY_LIBRARY	PrintNewlineCharacters
+	CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
+	CALL_DISPLAY_LIBRARY PrintNewlineCharacters
 
 	pop		si
@@ -243,5 +243,5 @@
 	call	Print_NullTerminatedStringFromSI
 	pop		si
-		
+
 	ret
 
@@ -275,7 +275,6 @@
 ;		AX, DI
 ;--------------------------------------------------------------------
-JumpToFormatNullTerminatedStringFromSI:	
-	CALL_DISPLAY_LIBRARY 	FormatNullTerminatedStringFromCSSI
-	ret
+JumpToFormatNullTerminatedStringFromSI:
+	JMP_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
 
 
@@ -290,4 +289,4 @@
 ;--------------------------------------------------------------------
 Print_NullTerminatedStringFromSI:
-	CALL_DISPLAY_LIBRARY	PrintNullTerminatedStringFromCSSI
-	ret
+	JMP_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
+
Index: /trunk/Serial_Server/win32/Win32File.h
===================================================================
--- /trunk/Serial_Server/win32/Win32File.h	(revision 504)
+++ /trunk/Serial_Server/win32/Win32File.h	(revision 505)
@@ -7,10 +7,10 @@
 // Routines for accessing the file system under Win32.  It's important
 // to use these direct Win32 calls for large files, since FILE * routines,
-// in particular ftell() and fseek(), are limites to signed 32-bits (2 GB).
+// in particular ftell() and fseek(), are limited to signed 32-bits (2 GB).
 // These are also likely faster since they are more direct.
-// 
+//
 
 //
-// XTIDE Universal BIOS and Associated Tools 
+// XTIDE Universal BIOS and Associated Tools
 // Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
 //
@@ -19,9 +19,9 @@
 // the Free Software Foundation; either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.		
+// GNU General Public License for more details.
 // Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 //
@@ -69,5 +69,5 @@
 		{
 			if( !CloseHandle( fp ) )
-				log( 0, "'%s', could not close file handle", name ? name : "unknown" );			
+				log( 0, "'%s', could not close file handle", name ? name : "unknown" );
 		}
 	}
@@ -126,5 +126,5 @@
 
     // LBA 28 limit - 28-bits (could be 1 more, but not worth pushing it)
-	const static unsigned long MaxSectors = 0xfffffff; 
+	const static unsigned long MaxSectors = 0xfffffff;
 #define USAGE_MAXSECTORS "137438 MB (LBA28 limit)"
 
Index: /trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc	(revision 504)
+++ /trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc	(revision 505)
@@ -71,8 +71,8 @@
 %endif
 %ifdef MODULE_FEATURE_SETS
-	FLGH_DPT_POWER_MANAGEMENT_SUPPORTED	EQU (1<<5)	; Bit 4, Drive supports power management
+	FLGH_DPT_POWER_MANAGEMENT_SUPPORTED	EQU (1<<5)	; Bit 5, Drive supports power management
 %endif
 %ifdef MODULE_ADVANCED_ATA
-	FLGH_DPT_IORDY						EQU	(1<<7)	; Bit 5, Controller and Drive supports IORDY
+	FLGH_DPT_IORDY						EQU	(1<<7)	; Bit 7, Controller and Drive supports IORDY
 %endif
 
Index: /trunk/XTIDE_Universal_BIOS/Inc/RamVars.inc
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Inc/RamVars.inc	(revision 504)
+++ /trunk/XTIDE_Universal_BIOS/Inc/RamVars.inc	(revision 505)
@@ -3,5 +3,5 @@
 
 ;
-; XTIDE Universal BIOS and Associated Tools 
+; XTIDE Universal BIOS and Associated Tools
 ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
 ;
@@ -10,9 +10,9 @@
 ; the Free Software Foundation; either version 2 of the License, or
 ; (at your option) any later version.
-; 
+;
 ; This program is distributed in the hope that it will be useful,
 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-; GNU General Public License for more details.		
+; GNU General Public License for more details.
 ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 ;
@@ -23,12 +23,9 @@
 ; Segment when RAMVARS is stored to top of interrupt vectors.
 %ifndef USE_AT
-LITE_MODE_RAMVARS_SEGMENT	EQU		30h
+	LITE_MODE_RAMVARS_SEGMENT	EQU		30h
 %endif
 
-%ifdef MODULE_SERIAL_FLOPPY
-	%define NEED_XLATEVARS
-%endif
 
-%ifdef MODULE_DRIVEXLATE
+%ifdef MODULE_SERIAL_FLOPPY OR MODULE_DRIVEXLATE
 	%define NEED_XLATEVARS
 %endif
@@ -77,5 +74,5 @@
 										; and number of drives (low order bit, max 2 drives supported).
 										; During initialization, until the end of DetectDrives_FromAllIDEControllers,
-										; this byte contains the raw number of floppy drives seen 
+										; this byte contains the raw number of floppy drives seen
 										; (using .bFlopCreateCnt)
 	%else
@@ -105,5 +102,5 @@
 
 ;
-; IDEPACK NOTE: The first six bytes of this structure are directly put on the 
+; IDEPACK NOTE: The first six bytes of this structure are directly put on the
 ; wire for MODULE_SERIAL, please do not change the order or insert other members.
 ;
Index: /trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIO.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIO.asm	(revision 504)
+++ /trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIO.asm	(revision 505)
@@ -56,8 +56,9 @@
 	mov		al, [di+DPT_ATA.bDevice]
 	cmp		al, DEVICE_8BIT_XTIDE_REV2
+	jb		SHORT .InputToALfromRegisterInDX	; Standard IDE controllers and XTIDE rev 1
+
+%ifdef MODULE_8BIT_IDE_ADVANCED
 	je		SHORT .ReverseA0andA3fromRegisterIndexInDX
-	jb		SHORT .InputToALfromRegisterInDX	; Standard IDE controllers and XTIDE rev 1
-		
-%ifdef MODULE_8BIT_IDE_ADVANCED
+
 	cmp		al, DEVICE_8BIT_JRIDE_ISA
 	jne		SHORT .ShlRegisterIndexInDX			; All XT-CF modes
@@ -71,5 +72,5 @@
 	ret
 %endif
-		
+
 .ReverseA0andA3fromRegisterIndexInDX:
 	mov		dl, [cs:bx+g_rgbSwapA0andA3fromIdeRegisterIndex]
@@ -77,5 +78,5 @@
 
 .ShlRegisterIndexInDX:
-	shl		dx, 1
+	eSHL_IM	dx, 1
 	; Fall to .InputToALfromRegisterInDX
 
@@ -102,8 +103,9 @@
 	mov		bl, [di+DPT_ATA.bDevice]
 	cmp		bl, DEVICE_8BIT_XTIDE_REV2
+	jb		SHORT .OutputALtoControlBlockRegisterInDX	; Standard IDE controllers and XTIDE rev 1
+
+%ifdef MODULE_8BIT_IDE_ADVANCED
 	je		SHORT .ReverseA0andA3fromRegisterIndexInDX
-	jb		SHORT .OutputALtoControlBlockRegisterInDX	; Standard IDE controllers and XTIDE rev 1
-
-%ifdef MODULE_8BIT_IDE_ADVANCED
+
 	cmp		bl, DEVICE_8BIT_JRIDE_ISA
 	jne		SHORT .ShlRegisterIndexInDX		; All XT-CF modes
@@ -125,5 +127,5 @@
 
 .ShlRegisterIndexInDX:
-	shl		dx, 1
+	eSHL_IM	dx, 1
 	add		dx, BYTE XTCF_CONTROL_BLOCK_OFFSET
 	jmp		SHORT OutputALtoRegisterInDX
@@ -152,8 +154,9 @@
 	mov		bl, [di+DPT_ATA.bDevice]
 	cmp		bl, DEVICE_8BIT_XTIDE_REV2
+	jb		SHORT OutputALtoRegisterInDX	; Standard IDE controllers and XTIDE rev 1
+
+%ifdef MODULE_8BIT_IDE_ADVANCED
 	je		SHORT .ReverseA0andA3fromRegisterIndexInDX
-	jb		SHORT OutputALtoRegisterInDX	; Standard IDE controllers and XTIDE rev 1
-
-%ifdef MODULE_8BIT_IDE_ADVANCED
+
 	cmp		bl, DEVICE_8BIT_JRIDE_ISA
 	jne		SHORT .ShlRegisterIndexInDX		; All XT-CF modes
@@ -177,5 +180,5 @@
 
 .ShlRegisterIndexInDX:
-	shl		dx, 1
+	eSHL_IM	dx, 1
 	; Fall to OutputALtoRegisterInDX
 
Index: /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm	(revision 504)
+++ /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm	(revision 505)
@@ -39,6 +39,6 @@
 AH0h_HandlerForDiskControllerReset:
 	; Reset foreign Floppy and Hard Drives (those handled by other BIOSes)
-	xor		bx, bx										; Zero BH to assume no errors
-	or		bl, dl										; Copy requested drive to BL
+	eMOVZX	bx, dl										; Copy requested drive to BL and zero BH to assume no errors
+
 	xor		ah, ah										; Disk Controller Reset
 	call	Int13h_CallPreviousInt13hHandler			; Reset floppy drives only or floppy drives and foreign hard disks
Index: /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1Eh_XTCF.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1Eh_XTCF.asm	(revision 504)
+++ /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1Eh_XTCF.asm	(revision 505)
@@ -102,4 +102,8 @@
 	out		dx, al
 
+	; We always need to enable 8-bit mode since 16-bit mode is restored
+	; when controller is reset (AH=00h or 0Dh)
+	ePUSH_T	bx, AH23h_Enable8bitPioMode
+
 	; Convert Control Register Contents to device code
 	test	al, al
@@ -108,22 +112,24 @@
 	jae		SHORT .SetMemoryMappedMode
 
+; We need to limit block size here. Consider this scenario;
+; 1. While in PIO mode or memory mapped mode, the drive is set to do
+;    block transfers larger than XTCF_DMA_MODE_MAX_BLOCK_SIZE.
+; 2. A call is subsequently made to change device mode to DEVICE_8BIT_XTCF_DMA.
+; 3. The call to AH24h_SetBlockSize fails but the change in device mode has been made.
+
 	; Set DMA Mode
 	mov		BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_DMA
 	mov		al, [di+DPT_ATA.bBlockSize]
-	call	AH24h_SetBlockSize	; AH=24h limits block size if necessary
-	jmp		SHORT .Enable8bitPioMode
+	MIN_U	al, XTCF_DMA_MODE_MAX_BLOCK_SIZE
+	jmp		SHORT AH24h_SetBlockSize	; Returns via AH23h_Enable8bitPioMode
 
 .SetMemoryMappedMode:
-	mov		BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_MEMMAP
-	jmp		SHORT .Enable8bitPioMode
+	mov		al, DEVICE_8BIT_XTCF_MEMMAP
+	SKIP2B	bx
 
 .Set8bitPioMode:
-	mov		BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_PIO8
-	; Fall to .Enable8bitPioMode
-
-	; We always need to enable 8-bit mode since 16-bit mode is restored
-	; when controller is reset (AH=00h or 0Dh)
-.Enable8bitPioMode:
-	jmp		AH23h_Enable8bitPioMode
+	mov		al, DEVICE_8BIT_XTCF_PIO8
+	mov		[di+DPT_ATA.bDevice], al
+	ret		; Via AH23h_Enable8bitPioMode
 
 
Index: /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm	(revision 504)
+++ /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm	(revision 505)
@@ -101,7 +101,11 @@
 	call	Device_SelectDrive
 	STORE_ERROR_FLAG_TO_DPT		FLG_INITERROR_FAILED_TO_SELECT_DRIVE
+%ifdef USE_386
+	jc		.ReturnWithErrorCodeInAH
+%else
 	jnc		SHORT .ContinueInitializationSinceDriveSelectedSuccesfully
 	jmp		.ReturnWithErrorCodeInAH
 .ContinueInitializationSinceDriveSelectedSuccesfully:
+%endif
 
 
Index: /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm	(revision 504)
+++ /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm	(revision 505)
@@ -3,5 +3,5 @@
 
 ;
-; XTIDE Universal BIOS and Associated Tools 
+; XTIDE Universal BIOS and Associated Tools
 ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
 ;
@@ -10,11 +10,11 @@
 ; the Free Software Foundation; either version 2 of the License, or
 ; (at your option) any later version.
-; 
+;
 ; This program is distributed in the hope that it will be useful,
 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-; GNU General Public License for more details.		
+; GNU General Public License for more details.
 ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-;		
+;
 
 ; Section containing code
@@ -107,9 +107,9 @@
 ; The following macro could be easily inlined below.  Why a macro?  Depending on the combination
 ; of MODULE_HOTKEYS or MODULE_BOOT_MENU, this code needs to either come before or after the
-; call to the boot menu.  
+; call to the boot menu.
 ;
 %macro TRY_TO_BOOT_DL_AND_DH_DRIVES 0
 	push	dx									; it's OK if this is left on the stack, if we are
-												; are successful, the following call does not return
+												; successful, the following call does not return
 	call	TryToBootFromPrimaryOrSecondaryBootDevice_AndBoot
 	pop		dx
@@ -117,12 +117,12 @@
 	call	TryToBootFromPrimaryOrSecondaryBootDevice_AndBoot
 %endmacro
-				
-%ifdef MODULE_HOTKEYS
-	call	HotkeyBar_ScanHotkeysFromKeyBufferAndStoreToBootvars		
+
+%ifdef MODULE_HOTKEYS
+	call	HotkeyBar_ScanHotkeysFromKeyBufferAndStoreToBootvars
 	cmp		al, ROM_BOOT_HOTKEY_SCANCODE
-	jz		.RomBoot							; CF clear so ROM boot
+	je		.RomBoot							; CF clear so ROM boot
 %ifdef MODULE_BOOT_MENU
 	cmp		al, BOOT_MENU_HOTKEY_SCANCODE
-	jz		.BootMenu
+	je		.BootMenu
 %endif
 	call	HotkeyBar_GetBootDriveNumbersToDX
@@ -130,30 +130,28 @@
 	TRY_TO_BOOT_DL_AND_DH_DRIVES
 	;; falls through to boot menu, if it is present.  If not present, falls through to rom boot.
-%endif
+%endif ; MODULE_HOTKEYS
 
 %ifdef MODULE_BOOT_MENU
-.BootMenu:		
+.BootMenu:
 	call	BootMenu_DisplayAndReturnDriveInDLRomBootClearCF
 	jnc		.RomBoot							; CF clear so ROM boot
 
 	mov		dh, dl								; Setup for secondary drive
-	not		dh									; Floppy goes to HD, or vice veras
-	and		dh, 080h							; Go to first drive of the floppy or HD set
+	not		dh									; Floppy goes to HD, or vice versa
+	and		dh, 80h								; Go to first drive of the floppy or HD set
 
 %ifdef MODULE_HOTKEYS
 	jmp		.TryUsingHotKeysCode
 %else
-	TRY_TO_BOOT_DL_AND_DH_DRIVES		
+	TRY_TO_BOOT_DL_AND_DH_DRIVES
 	jmp		.BootMenu
 %endif
-%endif
-
-%ifndef MODULE_HOTKEYS
-%ifndef MODULE_BOOT_MENU
+%endif ; MODULE_BOOT_MENU
+
+%ifndef MODULE_HOTKEYS OR MODULE_BOOT_MENU
 	xor		dl, dl			; Try to boot from Floppy Drive A
 	call	TryToBootFromPrimaryOrSecondaryBootDevice_AndBoot
 	mov		dl, 80h			; Try to boot from Hard Drive C
 	call	TryToBootFromPrimaryOrSecondaryBootDevice_AndBoot
-%endif
 %endif
 
@@ -162,5 +160,5 @@
 	call	DriveXlate_Reset					; Clean up any drive mappings before Rom Boot
 %endif
-	clc		
+	clc
 	;; fall through to JumpToBootSector_or_RomBoot
 
@@ -174,5 +172,5 @@
 ;	Parameters:
 ;		DL:		Drive to boot from (translated, 00h or 80h)
-;       CF:     Set for Boot Sector Boot 
+;       CF:     Set for Boot Sector Boot
 ;               Clear for ROM Boot
 ;	   	ES:BX:	(if CF set) Ptr to boot sector
@@ -187,5 +185,5 @@
 
 ; clear segment registers before boot sector or rom call
-	mov		ds, ax		
+	mov		ds, ax
 	mov		es, ax
 %ifdef USE_386
@@ -202,9 +200,9 @@
 ; Boot by calling INT 18h (ROM Basic of ROM DOS)
 .romboot:
-	int		BIOS_BOOT_FAILURE_INTERRUPT_18h	; Never returns	
-
-
-;--------------------------------------------------------------------
-; TryToBootFromPrimaryOrSecondaryBootDevice
+	int		BIOS_BOOT_FAILURE_INTERRUPT_18h	; Never returns
+
+
+;--------------------------------------------------------------------
+; TryToBootFromPrimaryOrSecondaryBootDevice_AndBoot
 ;	Parameters
 ;		DL:		Drive selected as boot device
@@ -229,6 +227,5 @@
 
 TryToBoot_FallThroughTo_BootSector_TryToLoadFromDriveDL_AndBoot:
-; fall through to BootSector_TryToLoadFromDriveDL_AndBoot				
-%endif
-		
-
+; fall through to BootSector_TryToLoadFromDriveDL_AndBoot
+%endif
+
Index: /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h/BootSector.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h/BootSector.asm	(revision 504)
+++ /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h/BootSector.asm	(revision 505)
@@ -3,5 +3,5 @@
 
 ;
-; XTIDE Universal BIOS and Associated Tools 
+; XTIDE Universal BIOS and Associated Tools
 ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
 ;
@@ -10,11 +10,11 @@
 ; the Free Software Foundation; either version 2 of the License, or
 ; (at your option) any later version.
-; 
+;
 ; This program is distributed in the hope that it will be useful,
 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ; GNU General Public License for more details.
-; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html				
-;		
+; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+;
 
 ; Section containing code
@@ -22,5 +22,5 @@
 
 ;--------------------------------------------------------------------
-; BootSector_TryToLoadFromDriveDL
+; BootSector_TryToLoadFromDriveDL_AndBoot
 ;	Parameters:
 ;		DL:		Drive to boot from (translated, 00h or 80h)
@@ -36,5 +36,9 @@
 	call	DetectPrint_TryToBootFromDL
 	call	LoadFirstSectorFromDriveDL
+%ifndef USE_386
 	jc		SHORT .FailedToLoadFirstSector
+%else
+	jc		DetectPrint_FailedToLoadFirstSector
+%endif
 
 	test	dl, dl
@@ -44,14 +48,16 @@
 .AlwaysBootFromFloppyDriveForBooterGames:
 	stc
-	jmp		SHORT JumpToBootSector_or_RomBoot		
+	jmp		SHORT JumpToBootSector_or_RomBoot
+
+%ifndef USE_386
 .FailedToLoadFirstSector:
-	call	DetectPrint_FailedToLoadFirstSector
-	ret
+	jmp		DetectPrint_FailedToLoadFirstSector
+%endif
+
 .FirstHardDiskSectorNotBootable:
 	mov		si, g_szBootSectorNotFound
-	call	DetectPrint_NullTerminatedStringFromCSSIandSetCF
-	ret
+	jmp		DetectPrint_NullTerminatedStringFromCSSIandSetCF
 
-%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS		
+%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
   %ifdef MODULE_DRIVEXLATE
     %if TryToBoot_FallThroughTo_BootSector_TryToLoadFromDriveDL_AndBoot <> BootSector_TryToLoadFromDriveDL_AndBoot
@@ -79,35 +85,21 @@
 
 .ReadRetryLoop:
-	call	.LoadFirstSectorFromDLtoESBX
-	jnc		SHORT .Return
+	mov		ax, 0201h						; Read 1 sector
+	mov		cx, 1							; Cylinder 0, Sector 1
+	xor		dh, dh							; Head 0
+	int		BIOS_DISK_INTERRUPT_13h
+	jc		SHORT .FailedToLoadFirstSector
+.Return:
+	ret
+
+.FailedToLoadFirstSector:
 	dec		di								; Decrement retry counter (preserve CF)
 	jz		SHORT .Return					; Loop while retries left
 
 	; Reset drive and retry
-	xor		ax, ax							; AH=0h, Disk Controller Reset
+	xor		ax, ax							; AH=00h, Disk Controller Reset
 	test	dl, dl							; Floppy drive?
-	eCMOVS	ah, RESET_HARD_DISK				; AH=Dh, Reset Hard Disk (Alternate reset)
+	eCMOVS	ah, RESET_HARD_DISK				; AH=0Dh, Reset Hard Disk (Alternate reset)
 	int		BIOS_DISK_INTERRUPT_13h
 	jmp		SHORT .ReadRetryLoop
 
-
-;--------------------------------------------------------------------
-; .LoadFirstSectorFromDLtoESBX
-;	Parameters:
-;		DL:		Drive to boot from (translated, 00h or 80h)
-;		ES:BX:	Destination buffer for boot sector
-;	Returns:
-;		AH:		INT 13h error code
-;		ES:BX:	Ptr to boot sector
-;		CF:		Cleared if read successful
-;				Set if any error
-;	Corrupts registers:
-;		AL, CX, DH
-;--------------------------------------------------------------------
-.LoadFirstSectorFromDLtoESBX:
-	mov		ax, 0201h						; Read 1 sector
-	mov		cx, 1							; Cylinder 0, Sector 1
-	xor		dh, dh							; Head 0
-	int		BIOS_DISK_INTERRUPT_13h
-.Return:
-	ret
Index: /trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm	(revision 504)
+++ /trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm	(revision 505)
@@ -50,5 +50,5 @@
 %ifdef MODULE_HOTKEYS
 	call	HotkeyBar_ScanHotkeysFromKeyBufferAndStoreToBootvars		; Done here while CX is still protected
-%endif				
+%endif
 
 	pop		cx
@@ -73,6 +73,6 @@
 %ifdef MODULE_HOTKEYS
 	cmp		al, COM_DETECT_HOTKEY_SCANCODE  ; Set by last call to HotkeyBar_UpdateDuringDriveDetection above
-	jz		.DriveDetectLoop
-%endif		
+	je		.DriveDetectLoop
+%endif
 
 	mov		al,[cs:ROMVARS.wFlags]			; Configurator set to always scan?
@@ -201,6 +201,6 @@
 %ifdef MODULE_HOTKEYS
 	call	HotkeyBar_UpdateDuringDriveDetection
-%endif				
-		
+%endif
+
 %ifdef MODULE_8BIT_IDE_ADVANCED
 	pop		dx
@@ -248,5 +248,5 @@
 ;		Nothing
 ;	Returns:
-;		CF:     Set (from BootMenuPrint_NullTerminatedStringFromCSSIandSetCF)
+;		CF:     Set (from DetectPrint_NullTerminatedStringFromCSSIandSetCF)
 ;	Corrupts registers:
 ;		AX, SI
Index: /trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm	(revision 504)
+++ /trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm	(revision 505)
@@ -3,5 +3,5 @@
 
 ;
-; XTIDE Universal BIOS and Associated Tools 
+; XTIDE Universal BIOS and Associated Tools
 ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
 ;
@@ -10,11 +10,11 @@
 ; the Free Software Foundation; either version 2 of the License, or
 ; (at your option) any later version.
-; 
+;
 ; This program is distributed in the hope that it will be useful,
 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-; GNU General Public License for more details.		
+; GNU General Public License for more details.
 ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-;		
+;
 
 ; Section containing code
@@ -31,8 +31,7 @@
 ;--------------------------------------------------------------------
 DetectPrint_InitializeDisplayContext:
-	CALL_DISPLAY_LIBRARY	InitializeDisplayContext
-	ret
-
-		
+	JMP_DISPLAY_LIBRARY InitializeDisplayContext
+
+
 %ifdef MODULE_HOTKEYS
 ;--------------------------------------------------------------------
@@ -46,9 +45,8 @@
 ;--------------------------------------------------------------------
 DetectPrint_GetSoftwareCoordinatesToAX:
-	CALL_DISPLAY_LIBRARY	GetSoftwareCoordinatesToAX
-	ret
+	JMP_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX
 %endif
 
-		
+
 ;--------------------------------------------------------------------
 ; DetectPrint_StartDetectWithMasterOrSlaveStringInCXandIdeVarsInCSBP
@@ -75,5 +73,5 @@
 ;	Corrupts registers:
 ;		AX, CX, DX, SI, DI
-;--------------------------------------------------------------------	
+;--------------------------------------------------------------------
 DetectPrint_StartDetectWithAutodetectedBasePortInAXandIdeVarsInCSBP:
 	mov		dx, [cs:bp+IDEVARS.bDevice-1]   ; for Serial: AL=port address>>2, AH=baud rate
@@ -152,5 +150,5 @@
 DetectPrint_DriveNameFromDrvDetectInfoInESBX:
 	push	bp
-	mov		bp,sp	
+	mov		bp,sp
 	lea		si,[bx+DRVDETECTINFO.szDrvName]
 	push	si
@@ -158,5 +156,5 @@
 	jmp		SHORT DetectPrint_FormatCSSIfromParamsInSSBP
 
-				
+
 ;--------------------------------------------------------------------
 ; Prints BIOS name and segment address where it is found.
@@ -175,5 +173,5 @@
 										; so that it can be a different value when using .BootMenuEntry
 
-.BootMenuEntry:	
+.BootMenuEntry:
 	push	bp
 	mov		bp, sp
@@ -186,5 +184,5 @@
 	push	ax
 %else
-	; szTitle and szVersion have the high order byte of their addresses zero, 
+	; szTitle and szVersion have the high order byte of their addresses zero,
 	; so these push instructions are only 2 bytes
 	;
@@ -259,5 +257,5 @@
 
 	mov		si, g_szTryToBoot
-	jmp		SHORT DetectPrint_FormatCSSIfromParamsInSSBP	
+	jmp		SHORT DetectPrint_FormatCSSIfromParamsInSSBP
 
 
Index: /trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenu.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenu.asm	(revision 504)
+++ /trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenu.asm	(revision 505)
@@ -3,5 +3,5 @@
 
 ;
-; XTIDE Universal BIOS and Associated Tools 
+; XTIDE Universal BIOS and Associated Tools
 ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
 ;
@@ -10,11 +10,11 @@
 ; the Free Software Foundation; either version 2 of the License, or
 ; (at your option) any later version.
-; 
+;
 ; This program is distributed in the hope that it will be useful,
 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ; GNU General Public License for more details.
-; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html		
-;		
+; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+;
 
 ; Section containing code
@@ -24,5 +24,5 @@
 ; Displays Boot Menu and returns Drive or Function number.
 ;
-; BootMenu_DisplayAndStoreSelection
+; BootMenu_DisplayAndReturnDriveInDLRomBootClearCF
 ;	Parameters:
 ;		DS:		RAMVARS segment
@@ -41,5 +41,5 @@
 
 	xchg	cx, ax
-		
+
 	; Clear Boot Menu from screen
 	mov		ax, ' ' | (MONO_NORMAL<<8)
@@ -52,14 +52,14 @@
 ;	Parameters:
 ;		CX:		Index of menuitem selected from Boot Menu
+;		DS:		RAMVARS segment
 ;	Returns:
 ;		DX:		Drive number to be used for booting
-;		DS:		RAMVARS segment
 ;       CF:     Set: There is a selected menu item, DL is valid
 ;               Clear: The item selected is Rom Boot, DL is not valid
 ;	Corrupts registers:
-;		AX, BX, DI
+;		AX, BX
 ;
 ; NOTE: We can't use the menu structure in here, as we are falling through
-; through from BootMenu_DisplayAndReturnDriveInDLRomBootClearCF when the
+; from BootMenu_DisplayAndReturnDriveInDLRomBootClearCF when the
 ; menu structure has already been destroyed.
 ;--------------------------------------------------------------------
@@ -73,5 +73,5 @@
 	sub		dl, al							; Remove floppy drives from index
 	call	RamVars_GetHardDiskCountFromBDAtoAX
-	or		al, 80h							; Or 80h into AL before the sub				
+	or		al, 80h							; Or 80h into AL before the sub
 	cmp		dl, al							; Set CF if hard disk
 											; Clear CF if last item, beyond hard disk list, which indicates ROM boot
Index: /trunk/XTIDE_Universal_BIOS/Src/Menus/DriveXlate.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Menus/DriveXlate.asm	(revision 504)
+++ /trunk/XTIDE_Universal_BIOS/Src/Menus/DriveXlate.asm	(revision 505)
@@ -3,5 +3,5 @@
 
 ;
-; XTIDE Universal BIOS and Associated Tools 
+; XTIDE Universal BIOS and Associated Tools
 ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
 ;
@@ -10,11 +10,11 @@
 ; the Free Software Foundation; either version 2 of the License, or
 ; (at your option) any later version.
-; 
+;
 ; This program is distributed in the hope that it will be useful,
 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-; GNU General Public License for more details.		
+; GNU General Public License for more details.
 ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-;		
+;
 
 ; Section containing code
@@ -48,7 +48,7 @@
 %if HotkeyBar_FallThroughTo_DriveXlate_ConvertDriveLetterInDLtoDriveNumber <> DriveXlate_ConvertDriveLetterInDLtoDriveNumber
 	%error "DriveXlate_ConvertDriveLetterInDLtoDriveNumber must be at the top of DriveXlate.asm, and that file must immediately follow HotKeys.asm"
-%endif		
 %endif
-		
+%endif
+
 ;--------------------------------------------------------------------
 ; DriveXlate_ConvertDriveNumberFromDLtoDriveLetter
@@ -64,10 +64,9 @@
 ;--------------------------------------------------------------------
 DriveXlate_ConvertDriveNumberFromDLtoDriveLetter:
-	test	dl, dl
-	jns		SHORT .GetDefaultFloppyDrive
+	xor		dl, 80h
+	js		SHORT .GetDefaultFloppyDrive
 
 	; Store default hard drive to boot from
 	call	DriveXlate_GetLetterForFirstHardDriveToAX
-	sub		dl, 80h
 	add		dl, al
 	stc
@@ -75,5 +74,5 @@
 
 .GetDefaultFloppyDrive:
-	add		dl, DEFAULT_FLOPPY_DRIVE_LETTER		; Clears CF
+	sub		dl, 80h - DEFAULT_FLOPPY_DRIVE_LETTER	; Clears CF
 	ret
 
@@ -96,5 +95,5 @@
 	MAX_U	al, DEFAULT_HARD_DRIVE_LETTER
 	ret
-				
+
 
 ;--------------------------------------------------------------------
@@ -168,5 +167,5 @@
 	mov		al, dl				; Store floppy translation
 	SKIP2B	di
-.SetHardDriveToSwap:	
+.SetHardDriveToSwap:
 	mov		ah, dl				; Store HD translation
 	mov		WORD [RAMVARS.xlateVars+XLATEVARS.wFDandHDswap], ax
Index: /trunk/XTIDE_Universal_BIOS/Src/Menus/HotkeyBar.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Menus/HotkeyBar.asm	(revision 504)
+++ /trunk/XTIDE_Universal_BIOS/Src/Menus/HotkeyBar.asm	(revision 505)
@@ -34,6 +34,6 @@
 	call	HotkeyBar_ScanHotkeysFromKeyBufferAndStoreToBootvars
 	; Fall to HotkeyBar_DrawToTopOfScreen
-		
-		
+
+
 ;--------------------------------------------------------------------
 ; HotkeyBar_DrawToTopOfScreen
@@ -127,5 +127,5 @@
 	call	FormatFunctionHotkeyString
 %endif
-	; Fall to .PrintRomBootHotkey		
+	; Fall to .PrintRomBootHotkey
 
 ;--------------------------------------------------------------------
@@ -169,11 +169,10 @@
 ;--------------------------------------------------------------------
 HotkeyBar_ClearRestOfTopRow:
-	CALL_DISPLAY_LIBRARY	GetColumnsToALandRowsToAH
+	CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH
 	eMOVZX	cx, al
-	CALL_DISPLAY_LIBRARY	GetSoftwareCoordinatesToAX
+	CALL_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX
 	sub		cl, al
 	mov		al, ' '
-	CALL_DISPLAY_LIBRARY	PrintRepeatedCharacterFromALwithCountInCX
-	ret
+	JMP_DISPLAY_LIBRARY PrintRepeatedCharacterFromALwithCountInCX
 
 
@@ -216,5 +215,5 @@
 
 	mov		si, ATTRIBUTE_CHARS.cHurryTimeout		; Selected hotkey
-	jz		SHORT GetDescriptionAttributeToDX		; From compare with bScancode above
+	je		SHORT GetDescriptionAttributeToDX		; From compare with bScancode above
 
 GetNonSelectedHotkeyDescriptionAttributeToDX:
@@ -226,5 +225,5 @@
 	call	MenuAttribute_GetToAXfromTypeInSI
 	xchg	dx, ax					; DX = Description attribute
-	;;  fall through to PushHotkeyParamsAndFormat 
+	;;  fall through to PushHotkeyParamsAndFormat
 
 
@@ -232,5 +231,5 @@
 
 	mov		dx, (COLOR_ATTRIBUTE(COLOR_YELLOW, COLOR_CYAN) << 8) | MONO_REVERSE_BLINK
-	jz		SHORT SelectAttributeFromDHorDLbasedOnVideoMode			; From compare with bScancode above
+	je		SHORT SelectAttributeFromDHorDLbasedOnVideoMode		; From compare with bScancode above
 
 GetNonSelectedHotkeyDescriptionAttributeToDX:
@@ -245,5 +244,5 @@
 	mov		dl, dh
 .AttributeLoadedToDL:
-	;;  fall through to PushHotkeyParamsAndFormat 		
+	;;  fall through to PushHotkeyParamsAndFormat
 
 %endif ; MODULE_BOOT_MENU
@@ -277,5 +276,5 @@
 	push	di				; Description string
 	push	cx				; Description string parameter
-		
+
 	push	si				; Key attribute for last space
 
@@ -308,6 +307,5 @@
 ;--------------------------------------------------------------------
 HotkeyBar_RestoreCursorCoordinatesFromAX:
-	CALL_DISPLAY_LIBRARY	SetCursorCoordinatesFromAX
-	ret
+	JMP_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
 
 
@@ -325,5 +323,5 @@
 HotkeyBar_StoreHotkeyToBootvarsForDriveLetterInDL:
 	eMOVZX	ax, dl
-	xor		al, 32	; Upper case drive letter to lower case keystroke
+	or		al, 32	; Upper case drive letter to lower case keystroke
 	jmp		SHORT HotkeyBar_StoreHotkeyToBootvarsIfValidKeystrokeInAX
 
@@ -364,11 +362,11 @@
 	; All scancodes are saved, even if it wasn't a drive letter,
 	; which also covers our function key case.  Invalid function keys
-	; will not do anything (won't be printed, won't be accepted as input)		
+	; will not do anything (won't be printed, won't be accepted as input)
 	mov		[es:di], ah
-		
+
 	; Drive letter hotkeys remaining, allow 'a' to 'z'
 	call	Char_IsLowerCaseLetterInAL
 	jnc		SHORT .KeystrokeIsNotValidDriveLetter
-	xor		al, 32					; We want to print upper case letters
+	and		al, ~32					; We want to print upper case letters
 
 	; Clear HD First flag to assume Floppy Drive hotkey
@@ -377,5 +375,5 @@
 
 	; Determine if Floppy or Hard Drive hotkey
-	eMOVZX	cx, al					; Clear CH to clear scancode
+	xchg	cx, ax
 	call	DriveXlate_GetLetterForFirstHardDriveToAX
 	cmp		cl, al
@@ -386,9 +384,9 @@
 
 .StoreDriveLetter:
-	sbb		di, BYTE 1			; Sub CF if Floppy Drive
+	sbb		di, BYTE 1				; Sub CF if Floppy Drive
 	xchg	ax, cx
-	mov		[es:di], al			; AH = zero to clear function hotkey
-
-.KeystrokeIsNotValidDriveLetter:		
+	mov		[es:di], al
+
+.KeystrokeIsNotValidDriveLetter:
 NoHotkeyToProcess:
 	mov		al, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode]
@@ -407,12 +405,12 @@
 HotkeyBar_GetBootDriveNumbersToDX:
 	mov		dx, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wFddAndHddLetters]
-	test	BYTE [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bFlags], FLG_HOTKEY_HD_FIRST		
+	test	BYTE [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bFlags], FLG_HOTKEY_HD_FIRST
 	jnz		.noflip
 	xchg	dl, dh
-.noflip:	
+.noflip:
 	call	DriveXlate_ConvertDriveLetterInDLtoDriveNumber
 	xchg	dl, dh
-	; Fall to HotkeyBar_FallThroughTo_DriveXlate_ConvertDriveLetterInDLtoDriveNumber		
-		
-HotkeyBar_FallThroughTo_DriveXlate_ConvertDriveLetterInDLtoDriveNumber:		
-
+	; Fall to HotkeyBar_FallThroughTo_DriveXlate_ConvertDriveLetterInDLtoDriveNumber
+
+HotkeyBar_FallThroughTo_DriveXlate_ConvertDriveLetterInDLtoDriveNumber:
+
Index: /trunk/XTIDE_Universal_BIOS/Src/Strings.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Strings.asm	(revision 504)
+++ /trunk/XTIDE_Universal_BIOS/Src/Strings.asm	(revision 505)
@@ -86,8 +86,8 @@
 g_szRomBootDash:		db	" -  "					; String fall through to g_szRomBoot
 %endif
-%ifdef MODULE_HOTKEYS OR MODULE_BOOT_MENU		
-g_szRomBoot:			db	"Rom%cBoot", NULL		; "RomBoot" or "Rom Boot"
-%endif
-		
+%ifdef MODULE_HOTKEYS OR MODULE_BOOT_MENU
+g_szRomBoot:			db	"Rom%cBoot",NULL		; "RomBoot" or "Rom Boot"
+%endif
+
 
 %ifdef MODULE_BOOT_MENU
Index: /trunk/XTIDE_Universal_BIOS/Src/StringsCompressed.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/StringsCompressed.asm	(revision 504)
+++ /trunk/XTIDE_Universal_BIOS/Src/StringsCompressed.asm	(revision 505)
@@ -177,6 +177,6 @@
 
 %endif
-%ifdef MODULE_HOTKEYS OR MODULE_BOOT_MENU		
-g_szRomBoot:			; db	"Rom%cBoot", NULL		; "RomBoot" or "Rom Boot"
+%ifdef MODULE_HOTKEYS OR MODULE_BOOT_MENU
+g_szRomBoot:			; db	"Rom%cBoot",NULL		; "RomBoot" or "Rom Boot"
             			; db	 52h,  6fh,  6dh,  25h,  63h,  42h,  6fh,  6fh,  74h,  00h    ; uncompressed
             			  db	 58h,  75h,  73h,  3ch,  48h,  75h,  75h, 0bah                ; compressed
Index: /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm	(revision 504)
+++ /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm	(revision 505)
@@ -3,5 +3,5 @@
 
 ;
-; XTIDE Universal BIOS and Associated Tools 
+; XTIDE Universal BIOS and Associated Tools
 ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
 ;
@@ -10,11 +10,11 @@
 ; the Free Software Foundation; either version 2 of the License, or
 ; (at your option) any later version.
-; 
+;
 ; This program is distributed in the hope that it will be useful,
 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-; GNU General Public License for more details.		
+; GNU General Public License for more details.
 ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-;		
+;
 
 ; Section containing code
@@ -98,5 +98,5 @@
 ;; when entering the boot menu and also before transferring control at boot time and
 ;; for ROM boots (in int19h.asm).
-		
+
 	pop		es
 	ret
@@ -158,5 +158,5 @@
 	call	RamVars_GetCountOfKnownDrivesToAX
 	push	ds
-	LOAD_BDA_SEGMENT_TO	ds, cx
+	LOAD_BDA_SEGMENT_TO	ds, bx
 	mov		bl, [BDA.bHDCount]
 	MAX_U	al, bl
Index: /trunk/XTIDE_Universal_BIOS/makefile
===================================================================
--- /trunk/XTIDE_Universal_BIOS/makefile	(revision 504)
+++ /trunk/XTIDE_Universal_BIOS/makefile	(revision 505)
@@ -16,5 +16,5 @@
 # Following modules can be included or excluded:                                                   #
 # MODULE_8BIT_IDE             Support for 8-BIT IDE cards like XTIDE                               #
-# MODULE_8BIT_IDE_ADVANCED	  Support for memory mapped and DMA based cards like JRIDE and XTCF    #
+# MODULE_8BIT_IDE_ADVANCED    Support for memory mapped and DMA based cards like JRIDE and XTCF    #
 # MODULE_ADVANCED_ATA         Native support for some VLB IDE controllers                          #
 # MODULE_BOOT_MENU            Boot Menu for selection of drive to boot from                        #
@@ -101,5 +101,5 @@
 DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_8BIT_IDE MODULE_SERIAL MODULE_SERIAL_FLOPPY
 DEFINES_XTPLUS = $(DEFINES_COMMON) $(DEFINES_XT) USE_186
-DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 USE_UNDOC_INTEL RELOCATE_INT13H_STACK MODULE_IRQ MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_ADVANCED_ATA 
+DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 USE_UNDOC_INTEL RELOCATE_INT13H_STACK MODULE_IRQ MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_ADVANCED_ATA
 
 DEFINES_XT_LARGE = $(DEFINES_XT) $(DEFINES_COMMON_LARGE)
Index: /trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/AutoConfigure.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/AutoConfigure.asm	(revision 504)
+++ /trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/AutoConfigure.asm	(revision 505)
@@ -114,8 +114,7 @@
 
 	; Point to next IDEVARS
+	add		si, IDEVARS_size
 	cmp		si, ROMVARS.ideVars3
-	jae		SHORT .AllPortsAlreadyDetected
-	add		si, IDEVARS_size
-	jmp		SHORT .DetectFromNextPort
+	jbe		SHORT .DetectFromNextPort
 .AllPortsAlreadyDetected:
 	ret
Index: /trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/IdeAutodetect.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/IdeAutodetect.asm	(revision 504)
+++ /trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/IdeAutodetect.asm	(revision 505)
@@ -22,5 +22,5 @@
 
 ;--------------------------------------------------------------------
-; IdeAutodetect_DetectIdeDeviceFromPortDXAndReturnControlBlockInCX
+; IdeAutodetect_DetectIdeDeviceFromPortDXAndReturnControlBlockInSI
 ;	Parameters:
 ;		DX:		IDE Base Port or segment address (Command Block)
@@ -193,5 +193,5 @@
 	jne		SHORT .InvalidStatusRegister
 
-	; Bytes were the same but it is possible they were both FFh, for 
+	; Bytes were the same but it is possible they were both FFh, for
 	; example. We must make sure bits are what is expected from valid
 	; IDE Status Register. So far all drives I've tested return 50h
Index: /trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Main.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Main.asm	(revision 504)
+++ /trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Main.asm	(revision 505)
@@ -3,5 +3,5 @@
 
 ;
-; XTIDE Universal BIOS and Associated Tools 
+; XTIDE Universal BIOS and Associated Tools
 ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
 ;
@@ -10,17 +10,17 @@
 ; the Free Software Foundation; either version 2 of the License, or
 ; (at your option) any later version.
-; 
+;
 ; This program is distributed in the hope that it will be useful,
 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-; GNU General Public License for more details.		
+; GNU General Public License for more details.
 ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-;		
+;
 
 ; Include .inc files
-		
+
 %define INCLUDE_MENU_DIALOGS
 %define INCLUDE_SERIAL_LIBRARY
-		
+
 %include "AssemblyLibrary.inc"	; Assembly Library. Must be included first!
 %include "Romvars.inc"			; XTIDE Universal BIOS variables
@@ -103,6 +103,5 @@
 	CALL_DISPLAY_LIBRARY InitializeDisplayContext	; Reset cursor etc
 	xchg	ax, dx
-	CALL_DISPLAY_LIBRARY ClearScreenWithCharInALandAttrInAH
-	ret
+	JMP_DISPLAY_LIBRARY ClearScreenWithCharInALandAttrInAH
 
 
Index: /trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/MenuEvents.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/MenuEvents.asm	(revision 504)
+++ /trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/MenuEvents.asm	(revision 505)
@@ -3,5 +3,5 @@
 
 ;
-; XTIDE Universal BIOS and Associated Tools 
+; XTIDE Universal BIOS and Associated Tools
 ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
 ;
@@ -10,11 +10,11 @@
 ; the Free Software Foundation; either version 2 of the License, or
 ; (at your option) any later version.
-; 
+;
 ; This program is distributed in the hope that it will be useful,
 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-; GNU General Public License for more details.		
+; GNU General Public License for more details.
 ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-;		
+;
 
 ; Section containing code
@@ -204,4 +204,5 @@
 	call	.PrintStatusOfUnsavedChanges
 	stc
+.ReturnSinceNothingToPrint:
 	ret
 
@@ -209,6 +210,5 @@
 .PrintProgramName:
 	mov		si, g_szProgramTitle
-	CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
-	ret
+	JMP_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
 
 ALIGN JUMP_ALIGN
@@ -223,6 +223,5 @@
 .PrintNothingLoaded:
 	mov		si, g_szBiosIsNotLoaded
-	CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
-	ret
+	JMP_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
 
 ALIGN JUMP_ALIGN
@@ -248,12 +247,10 @@
 	mov		bx, es
 	lea		si, [di+ROMVARS.szVersion]
-	CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromBXSI
-	ret
+	JMP_DISPLAY_LIBRARY PrintNullTerminatedStringFromBXSI
 
 ALIGN JUMP_ALIGN
 .PrintUnidentifiedType:
 	mov		si, g_szUnidentified
-	CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
-	ret
+	JMP_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
 
 ALIGN JUMP_ALIGN
@@ -262,5 +259,3 @@
 	jz		SHORT .ReturnSinceNothingToPrint
 	mov		si, g_szUnsaved
-	CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
-.ReturnSinceNothingToPrint:
-	ret
+	JMP_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
