Index: trunk/Configurator/Src/BiosFile.asm
===================================================================
--- trunk/Configurator/Src/BiosFile.asm	(revision 170)
+++ trunk/Configurator/Src/BiosFile.asm	(revision 181)
@@ -29,7 +29,8 @@
 
 	; Ask if user wants to save
-	mov		ax, cs
-	mov		ds, ax
-	mov		es, ax
+	push	cs
+	pop		ds
+	push	cs
+	pop		es
 	call	BiosFile_DoesUserWantToSaveChanges
 	jnc		SHORT .Return
Index: trunk/Configurator/Src/Libraries/math.asm
===================================================================
--- trunk/Configurator/Src/Libraries/math.asm	(revision 170)
+++ trunk/Configurator/Src/Libraries/math.asm	(revision 181)
@@ -1,9 +1,4 @@
-; File name		:	math.asm
 ; Project name	:	Math library
-; Created date	:	7.10.2009
-; Last update	:	4.1.2011
-; Author		:	Tomi Tilli,
-;				:	Krister Nordvall (optimizations)
-; Description	:	ASM library to for math related functions.		
+; Description	:	ASM library for math related functions.
 
 ;--------------- Equates -----------------------------
@@ -27,5 +22,5 @@
 ;--------------------------------------------------------------------
 ; Macro to select lesser of two unsigned operands.
-; 
+;
 ; MIN_U
 ;	Parameters:
@@ -48,5 +43,5 @@
 ;--------------------------------------------------------------------
 ; Macro to select greater of two unsigned operands.
-; 
+;
 ; MAX_U
 ;	Parameters:
@@ -69,5 +64,5 @@
 ;--------------------------------------------------------------------
 ; Macro to select lesser and greater of two unsigned operands.
-; 
+;
 ; MINMAX_U
 ;	Parameters:
@@ -82,5 +77,5 @@
 %macro MINMAX_U 2
 	cmp		%1, %2				; Is %1 smaller?
-	jbe		%%Return			;  If so, return
+	jb		%%Return			;  If so, return
 	xchg	%1, %2				; Exchange operands
 ALIGN JUMP_ALIGN
@@ -93,5 +88,5 @@
 ; Multiplies unsigned 32-bit integer by unsigned 16-bit integer.
 ; Result is unsigned 32-bit integer, so overflow is possible.
-; 
+;
 ; Math_MulDWbyW
 ;	Parameters:
@@ -130,5 +125,5 @@
 ;--------------------------------------------------------------------
 ; Divide a 32-bit unsigned integer so that quotient can be 32-bit.
-; 
+;
 ; Math_DivDWbyW
 ;	Parameters:
@@ -157,5 +152,5 @@
 ;--------------------------------------------------------------------
 ; Converts remainder to tenths.
-; 
+;
 ; Math_RemToTenths
 ;	Parameters:
Index: trunk/Configurator/Src/Libraries/menu/menudraw.asm
===================================================================
--- trunk/Configurator/Src/Libraries/menu/menudraw.asm	(revision 170)
+++ trunk/Configurator/Src/Libraries/menu/menudraw.asm	(revision 181)
@@ -287,6 +287,5 @@
 	test	BYTE [bp+MENUVARS.bFlags], FLG_MNU_HIDENFO	; Information hidden?
 	jnz		SHORT .JumpToBottomBorder
-	test	cx, cx							; Any info strings?
-	jz		SHORT MenuDraw_BottomBorder
+	jcxz	MenuDraw_BottomBorder			; Any info strings?
 	push	cx
 	call	MenuDraw_MiddleBorder			; Draw middle border
Index: trunk/Configurator/Src/Libraries/menu/menumsg.asm
===================================================================
--- trunk/Configurator/Src/Libraries/menu/menumsg.asm	(revision 170)
+++ trunk/Configurator/Src/Libraries/menu/menumsg.asm	(revision 181)
@@ -1,8 +1,4 @@
-; File name		:	menumsg.asm
 ; Project name	:	Menu library
-; Created date	:	13.11.2009
-; Last update	:	10.1.2010
-; Author		:	Tomi Tilli
-; Description	:	ASM library to menu system.
+; Description	:	ASM library for menu system.
 ;					Contains functions for displaying messages.
 
@@ -156,6 +152,5 @@
 ALIGN JUMP_ALIGN
 MenuMsg_GetTokenForLine:
-	test	cx, cx				; Line 0 wanted?
-	jz		.GetFirst			;  If so, just get token length
+	jcxz	.GetFirst			; Line 0 wanted? If so, just get token length
 	push	bp
 	push	si
@@ -218,5 +213,5 @@
 	jnc		.EndOfString					; Return if no tokens
 	eMOVZX	dx, BYTE [bp+MENUVARS.bWidth]	; Menu width
-	sub		dl, SIZE_MSG_HBRDR				; To line length 
+	sub		dl, SIZE_MSG_HBRDR				; To line length
 	mov		bl, ' '							; Space character
 ALIGN JUMP_ALIGN
Index: trunk/Configurator/Src/Libraries/print.asm
===================================================================
--- trunk/Configurator/Src/Libraries/print.asm	(revision 170)
+++ trunk/Configurator/Src/Libraries/print.asm	(revision 181)
@@ -1,8 +1,3 @@
-; File name		:	print.asm
 ; Project name	:	Print library
-; Created date	:	6.10.2009
-; Last update	:	4.1.2011
-; Author		:	Tomi Tilli,
-;				:	Krister Nordvall (optimizations)
 ; Description	:	ASM library for character and string
 ;					printing related functions.
@@ -95,5 +90,5 @@
 ;--------------------------------------------------------------------
 ; Debugging macro that prints wanted character and newline.
-; 
+;
 ; PRINT_DBG_CH
 ;	Parameters:
@@ -141,5 +136,5 @@
 ;
 ;	NOTE! Caller must clean the stack variables!
-; 
+;
 ; Print_Format
 ;	Parameters:
@@ -341,5 +336,5 @@
 ;--------------------------------------------------------------------
 ; Prints newline character to change line.
-; 
+;
 ; Print_Newline
 ;	Parameters:
@@ -363,9 +358,9 @@
 	ret
 %endif
-	
+
 
 ;--------------------------------------------------------------------
 ; Prints wanted number of characters.
-; 
+;
 ; Print_CharBuffer
 ;	Parameters:
@@ -404,5 +399,5 @@
 ;--------------------------------------------------------------------
 ; Repeats wanted character.
-; 
+;
 ; Print_Repeat
 ;	Parameters:
@@ -429,5 +424,5 @@
 ;--------------------------------------------------------------------
 ; Prints boolean value.
-; 
+;
 ; Print_Bool
 ;	Parameters:
@@ -455,5 +450,5 @@
 ;--------------------------------------------------------------------
 ; Prints signed or unsigned 16-bit integer.
-; 
+;
 ; Print_IntSW	Prints signed 16-bit word
 ; Print_IntUW	Prints unsigned 16-bit word
@@ -506,6 +501,6 @@
 	PRINT_CHAR					; Print character
 	inc		di					; Increment chars printed
-	test	cx, cx				; Characters left
-	jnz		.PrintLoop			;  If so, loop
+	inc		cx					; Characters left
+	loop	.PrintLoop			;  If so, loop
 	mov		dx, di				; Copy chars printed to DX
 	pop		cx
@@ -518,5 +513,5 @@
 ;--------------------------------------------------------------------
 ; Prints unsigned 32-bit integer.
-; 
+;
 ; Print_IntUDW
 ;	Parameters:
@@ -552,6 +547,6 @@
 	PRINT_CHAR					; Print character
 	inc		di					; Increment chars printed
-	test	cx, cx				; Characters left
-	jnz		.PrintLoop			;  If so, loop
+	inc		cx					; Characters left
+	loop	.PrintLoop			;  If so, loop
 	mov		dx, di				; Copy characters printed to DX
 	pop		cx
@@ -565,5 +560,5 @@
 ;--------------------------------------------------------------------
 ; Prints 8-bit byte as hexadecimal string.
-; 
+;
 ; Print_IntHexB
 ;	Parameters:
@@ -593,5 +588,5 @@
 ;--------------------------------------------------------------------
 ; Prints 16-bit word as hexadecimal string.
-; 
+;
 ; Print_IntHexW
 ;	Parameters:
@@ -621,5 +616,5 @@
 ;--------------------------------------------------------------------
 ; Prints 32-bit dword as hexadecimal string.
-; 
+;
 ; Print_IntHexDW
 ;	Parameters:
@@ -658,5 +653,5 @@
 ;--------------------------------------------------------------------
 ; Prints hexadecimal character for every nybble for WORD.
-; 
+;
 ; Print_HexString
 ;	Parameters:
Index: trunk/Configurator/Src/MenuPageItem.asm
===================================================================
--- trunk/Configurator/Src/MenuPageItem.asm	(revision 170)
+++ trunk/Configurator/Src/MenuPageItem.asm	(revision 181)
@@ -65,7 +65,7 @@
 ALIGN JUMP_ALIGN
 MenuPageItem_DisplayHelpDialog:
+	push	cs
+	pop		es
 	mov		di, [di+MENUPAGEITEM.szHelp]	; ES:DI now points to help string
-	push	cs
-	pop		es
 	mov		bl, WIDTH_DLG					; Dialog width
 	jmp		Menu_ShowMsgDlg
Index: trunk/Configurator/Src/Menupages/FlashMenu.asm
===================================================================
--- trunk/Configurator/Src/Menupages/FlashMenu.asm	(revision 170)
+++ trunk/Configurator/Src/Menupages/FlashMenu.asm	(revision 181)
@@ -371,6 +371,6 @@
 FlashMenu_CalculateCompletionPercentage:
 	cmp		WORD [si+FLASHVARS.wPagesLeft], 0
+	mov		ax, 100
 	je		SHORT .FlashComplete
-	mov		ax, 100
 	mul		WORD [si+FLASHVARS.wPagesLeft]
 	div		WORD [si+FLASHVARS.wTotalPages]		; AX = Percentage left to write
@@ -382,5 +382,4 @@
 ALIGN JUMP_ALIGN
 .FlashComplete:
-	mov		ax, 100
 	stc
 	ret
