Index: trunk/Assembly_Library/Inc/Emulate.inc
===================================================================
--- trunk/Assembly_Library/Inc/Emulate.inc	(revision 440)
+++ trunk/Assembly_Library/Inc/Emulate.inc	(revision 445)
@@ -465,16 +465,29 @@
 	eSHIFT_IM	%1, %2, shr
 %endmacro
+
 %macro eSHL_IM 2
+%ifdef USE_386
+	%if %2 = 1
+		add		%1, %1	; Same size but faster on 386 and 486. Fails if %1 is a memory operand.
+	%else
+		eSHIFT_IM	%1, %2, shl
+	%endif
+%else
 	eSHIFT_IM	%1, %2, shl
-%endmacro
+%endif
+%endmacro
+
 %macro eROR_IM 2
 	eSHIFT_IM	%1, %2, ror
 %endmacro
+
 %macro eROL_IM 2
 	eSHIFT_IM	%1, %2, rol
 %endmacro
+
 %macro eRCR_IM 2
 	eSHIFT_IM	%1, %2, rcr
 %endmacro
+
 %macro eRCL_IM 2
 	eSHIFT_IM	%1, %2, rcl
Index: trunk/Assembly_Library/Inc/Math.inc
===================================================================
--- trunk/Assembly_Library/Inc/Math.inc	(revision 440)
+++ trunk/Assembly_Library/Inc/Math.inc	(revision 445)
@@ -79,5 +79,5 @@
 ALIGN JUMP_ALIGN
 .ShiftNextBit:
-	shl		ax, 1
+	eSHL_IM	ax, 1
 	rcl		dx, 1
 	loop	.ShiftNextBit
Index: trunk/Assembly_Library/Src/Display/DisplayCursor.asm
===================================================================
--- trunk/Assembly_Library/Src/Display/DisplayCursor.asm	(revision 440)
+++ trunk/Assembly_Library/Src/Display/DisplayCursor.asm	(revision 445)
@@ -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
@@ -72,5 +72,5 @@
 	xor		dh, dh
 	add		ax, dx							; Add column offset
-	shl		ax, 1							; Convert to WORD offset
+	eSHL_IM	ax, 1							; Convert to WORD offset
 	add		ax, [VIDEO_BDA.wPageOffset]		; AX = Video RAM offset
 	mov		[VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fpCursorPosition], ax
Index: trunk/Assembly_Library/Src/Display/DisplayFormat.asm
===================================================================
--- trunk/Assembly_Library/Src/Display/DisplayFormat.asm	(revision 440)
+++ trunk/Assembly_Library/Src/Display/DisplayFormat.asm	(revision 445)
@@ -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
@@ -137,5 +137,5 @@
 .ConvertIndexToFunctionOffset:
 	sub		bx, .rgcFormatCharToLookupIndex
-	shl		bx, 1				; Shift for WORD lookup
+	eSHL_IM	bx, 1				; Shift for WORD lookup
 	mov		ax, [cs:bx+.rgfnFormatSpecifierParser]
 	ret
Index: trunk/Assembly_Library/Src/Display/DisplayFormatCompressed.asm
===================================================================
--- trunk/Assembly_Library/Src/Display/DisplayFormatCompressed.asm	(revision 440)
+++ trunk/Assembly_Library/Src/Display/DisplayFormatCompressed.asm	(revision 445)
@@ -6,5 +6,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.
 ;
@@ -13,9 +13,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
 ;
@@ -194,5 +194,5 @@
 
 .process_after_output:
-	shl		ch,1								; check high order bits for end of string or space
+	eSHL_IM	ch,1								; check high order bits for end of string or space
 	jns		short DisplayFormatCompressed_ret
 	jnc		.decode
@@ -208,5 +208,5 @@
 ; DisplayFormatCompressed_BaseFormatOffset and jump targets (must fit in 256 bytes)
 ;
-	shl		ch,1				; setup ch for later testing of null in .process_after_output
+	eSHL_IM	ch,1				; setup ch for later testing of null in .process_after_output
 	and		ax,0001fh			; also clears AH for addition with BX and DX below
 
Index: trunk/Assembly_Library/Src/Menu/CharOutLineSplitter.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/CharOutLineSplitter.asm	(revision 440)
+++ trunk/Assembly_Library/Src/Menu/CharOutLineSplitter.asm	(revision 445)
@@ -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 @@
 	; Get last text line column offset to AX
 	call	MenuLocation_GetMaxTextLineLengthToAX
-	shl		ax, 1			; Characters to BYTEs
+	eSHL_IM	ax, 1			; Characters to BYTEs
 	add		ax, dx
 
@@ -62,5 +62,5 @@
 	call	MenuLocation_GetTitleBordersTopLeftCoordinatesToAX
 	xor		ah, ah
-	shl		ax, 1
+	eSHL_IM	ax, 1
 	ret
 
@@ -82,5 +82,5 @@
 
 	mov		dl, [VIDEO_BDA.wColumns]
-	shl		dl, 1			; DX = bytes per row
+	eSHL_IM	dl, 1			; DX = bytes per row
 	mov		ax, di
 	div		dl				; AL = row index, AH = column index
Index: trunk/Assembly_Library/Src/Util/Memory.asm
===================================================================
--- trunk/Assembly_Library/Src/Util/Memory.asm	(revision 440)
+++ trunk/Assembly_Library/Src/Util/Memory.asm	(revision 445)
@@ -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
@@ -151,16 +151,21 @@
 ;	Returns:
 ;		AL:		Sum of bytes
+;		ZF:		Set if result is zero
+;				Cleared if result is non-zero
 ;	Corrupts registers:
 ;		CX
 ;--------------------------------------------------------------------
+%ifndef EXCLUDE_FROM_XTIDECFG
 ALIGN JUMP_ALIGN
 Memory_SumCXbytesFromESSItoAL:
 	push	si
+	dec		si
 	xor		al, al
 ALIGN JUMP_ALIGN
 .AddNextByteToAL:
+	inc		si
 	add		al, [es:si]
-	inc		si
 	loop	.AddNextByteToAL
 	pop		si
 	ret
+%endif
Index: trunk/Assembly_Library/Src/Util/Sort.asm
===================================================================
--- trunk/Assembly_Library/Src/Util/Sort.asm	(revision 440)
+++ trunk/Assembly_Library/Src/Util/Sort.asm	(revision 445)
@@ -7,5 +7,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.
 ;
@@ -14,11 +14,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
-;		
+;
 
 ; Algorith is from http://www.algolist.net/Algorithms/Sorting/Quicksort
@@ -62,5 +62,5 @@
 	push	di
 	mov		di, cx
-	shl		cx, 1						; Reserve temp and pivot items
+	eSHL_IM	cx, 1						; Reserve temp and pivot items
 	add		cx, BYTE QSORT_PARAMS_size
 	eENTER_STRUCT cx
