Index: /trunk/Assembly_Library/Inc/AssemblyLibrary.inc
===================================================================
--- /trunk/Assembly_Library/Inc/AssemblyLibrary.inc	(revision 104)
+++ /trunk/Assembly_Library/Inc/AssemblyLibrary.inc	(revision 105)
@@ -14,4 +14,5 @@
 %include "Macros.inc"
 %include "Math.inc"
+%include "Registers.inc"
 
 ; Library dependencies
Index: /trunk/Assembly_Library/Inc/Menu.inc
===================================================================
--- /trunk/Assembly_Library/Inc/Menu.inc	(revision 104)
+++ /trunk/Assembly_Library/Inc/Menu.inc	(revision 105)
@@ -129,5 +129,5 @@
 MENU_TEXT_ROW_OFFSET				EQU		1
 MENU_TEXT_COLUMN_OFFSET				EQU		2
-MENU_TIMEOUT_STRING_CHARACTERS		EQU		23
+MENU_TIMEOUT_STRING_CHARACTERS		EQU		19
 MENU_TIMEOUT_SECONDS_FOR_HURRY		EQU		3
 
Index: /trunk/Assembly_Library/Inc/Registers.inc
===================================================================
--- /trunk/Assembly_Library/Inc/Registers.inc	(revision 105)
+++ /trunk/Assembly_Library/Inc/Registers.inc	(revision 105)
@@ -0,0 +1,65 @@
+; Project name	:	Assembly Library
+; Description	:	Register related macros.
+%ifndef REGISTERS_INC
+%define REGISTERS_INC
+
+;--------------------------------------------------------------------
+; NORMALIZE_FAR_POINTER
+;	Parameters:
+;		%1:%2:		Far pointer to normalize
+;		%3:			Scratch register
+;		%4:			Scratch register
+;	Returns:
+;		%1:%2:		Normalized far pointer
+;	Corrupts registers:
+;		%3, %4
+;--------------------------------------------------------------------
+%macro NORMALIZE_FAR_POINTER 4
+	mov		%4, %2				; Copy offset to scratch reg
+	and		%2, BYTE 0Fh		; Clear offset bits 15...4
+	eSHR_IM	%4, 4				; Divide offset by 16
+	mov		%3, %1				; Copy segment to scratch reg
+	add		%3, %4				; Add shifted offset to segment
+	mov		%1, %3				; Set normalized segment
+%endmacro
+
+
+;--------------------------------------------------------------------
+; COPY_SSBP_TO_ESDI
+; COPY_SSBP_TO_DSSI
+; COPY_DSSI_TO_ESDI
+; COPY_ESDI_to_DSSI
+;	Parameters
+;		Nothing
+;	Returns:
+;		Copies farm pointer to different segment/pointer register pair
+;	Corrupts registers:
+;		Nothing
+;--------------------------------------------------------------------
+%macro COPY_SSBP_TO_ESDI 0
+	push	ss
+	pop		es
+	mov		di, bp
+%endmacro
+
+%macro COPY_SSBP_TO_DSSI 0
+	push	ss
+	pop		ds
+	mov		si, bp
+%endmacro
+
+%macro COPY_DSSI_TO_ESDI 0
+	push	ds
+	pop		es
+	mov		di, si
+%endmacro
+
+%macro COPY_ESDI_to_DSSI 0
+	push	es
+	pop		ds
+	mov		si, di
+%endmacro
+
+
+
+%endif ; REGISTERS_INC
Index: /trunk/Assembly_Library/Src/File/FileIO.asm
===================================================================
--- /trunk/Assembly_Library/Src/File/FileIO.asm	(revision 104)
+++ /trunk/Assembly_Library/Src/File/FileIO.asm	(revision 105)
@@ -1,7 +1,3 @@
-; File name		:	FileIO.asm
 ; Project name	:	Assembly Library
-; Created date	:	1.9.2010
-; Last update	:	6.12.2010
-; Author		:	Tomi Tilli
 ; Description	:	Functions for file access.
 
@@ -175,5 +171,5 @@
 ALIGN JUMP_ALIGN
 .TransferNextBytes:
-	call	Registers_NormalizeDSSI
+	call	NormalizeDSSI
 	call	bp						; Transfer function
 	jc		SHORT .ErrorOccurredDuringTransfer
@@ -184,5 +180,5 @@
 	pop		cx						; CX = Bytes for last transfer
 	jcxz	.ReturnErrorCodeInAX	; No remaining bytes
-	call	Registers_NormalizeDSSI
+	call	NormalizeDSSI
 	call	bp
 .ReturnErrorCodeInAX:
@@ -195,4 +191,22 @@
 	pop		cx						; Remove bytes for last transfer
 	jmp		SHORT .ReturnErrorCodeInAX
+
+;--------------------------------------------------------------------
+; NormalizeDSSI
+;	Parameters
+;		DS:SI:	Ptr to normalize
+;	Returns:
+;		DS:SI:	Normalized pointer
+;	Corrupts registers:
+;		Nothing
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+NormalizeDSSI:
+	push	dx
+	push	ax
+	NORMALIZE_FAR_POINTER ds, si, ax, dx
+	pop		ax
+	pop		dx
+	ret
 
 
Index: /trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm
===================================================================
--- /trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm	(revision 104)
+++ /trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm	(revision 105)
@@ -45,5 +45,5 @@
 .ItemSelectedFromCX:
 	call	LoadItemStringBufferToESDI
-	Registers_CopyESDItoDSSI
+	COPY_ESDI_to_DSSI
 	call	ItemLineSplitter_GetLineToDSSIandLengthToCXfromStringInDSSIwithIndexInCX
 	jmp		ParseSelectionFromItemLineInDSSI
@@ -128,5 +128,5 @@
 	call	RemoveLastLFandTerminateESDIwithNull
 
-	Registers_CopySSBPtoDSSI
+	COPY_SSBP_TO_DSSI
 	xor		ax, ax
 	call	Dialog_EventInitializeMenuinitFromDSSIwithHighlightedItemInAX
@@ -198,5 +198,5 @@
 ALIGN JUMP_ALIGN
 .ClearDLifInRootDirectory:
-	Registers_CopyESDItoDSSI
+	COPY_ESDI_to_DSSI
 	call	Directory_WriteCurrentPathToDSSI
 	mov		dl, [si]
@@ -374,5 +374,5 @@
 ALIGN JUMP_ALIGN
 SortDirectoryContentsStringFromESDIwithCountInCX:
-	Registers_CopyESDItoDSSI
+	COPY_ESDI_to_DSSI
 	call	.AddDirectoryContentsStringLengthToDI
 	mov		bx, .FileStringComparator
Index: /trunk/Assembly_Library/Src/Menu/MenuBorders.asm
===================================================================
--- /trunk/Assembly_Library/Src/Menu/MenuBorders.asm	(revision 104)
+++ /trunk/Assembly_Library/Src/Menu/MenuBorders.asm	(revision 105)
@@ -394,5 +394,5 @@
 	db		DOUBLE_BOTTOM_LEFT_CORNER
 	db		DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL
-	db		"%AAutoselection in %2u s",NULL
+	db		"%ASelection in %2u s",NULL
 
 
Index: /trunk/Assembly_Library/Src/Menu/MenuLoop.asm
===================================================================
--- /trunk/Assembly_Library/Src/Menu/MenuLoop.asm	(revision 104)
+++ /trunk/Assembly_Library/Src/Menu/MenuLoop.asm	(revision 105)
@@ -1,7 +1,3 @@
-; File name		:	MenuLoop.asm
 ; Project name	:	Assembly Library
-; Created date	:	22.7.2010
-; Last update	:	25.11.2010
-; Author		:	Tomi Tilli
 ; Description	:	Menu loop for waiting keystrokes.
 
@@ -22,5 +18,5 @@
 	call	KeystrokeProcessing
 	call	TimeoutProcessing
-	call	IdleTimeProcessing
+	call	MenuEvent_IdleProcessing	; User idle processing
 	test	BYTE [bp+MENU.bFlags], FLG_MENU_EXIT
 	jz		SHORT MenuLoop_Enter
@@ -29,7 +25,6 @@
 
 ;--------------------------------------------------------------------
-; IdleTimeProcessing
+; KeystrokeProcessing
 ; TimeoutProcessing
-; KeystrokeProcessing
 ;	Parameters
 ;		SS:BP:	Ptr to MENU
@@ -40,19 +35,16 @@
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
-IdleTimeProcessing:
-	jmp		MenuEvent_IdleProcessing		; User idle processing
+KeystrokeProcessing:
+	call	Keyboard_GetKeystrokeToAX
+	jnz		SHORT ProcessKeystrokeFromAX
+NoKeystrokeToProcess:
+	ret
 
 ALIGN JUMP_ALIGN
 TimeoutProcessing:
 	call	MenuTime_UpdateSelectionTimeout
+	jnc		NoKeystrokeToProcess
 	mov		ah, MENU_KEY_ENTER				; Fake ENTER to select item
-	jc		SHORT ProcessKeystrokeFromAX	; Process faked ENTER
-	ret
-
-ALIGN JUMP_ALIGN
-KeystrokeProcessing:
-	call	Keyboard_GetKeystrokeToAX
-	jnz		SHORT ProcessKeystrokeFromAX
-	ret
+	; Fall to ProcessKeystrokeFromAX
 
 
@@ -74,9 +66,6 @@
 	xchg	ax, cx
 	call	.ProcessMenuSystemKeystrokeFromAX
-	jc		SHORT .Return
+	jc		SHORT NoKeystrokeToProcess
 	jmp		MenuEvent_KeyStrokeInAX
-ALIGN JUMP_ALIGN, ret
-.Return:
-	ret
 
 ;--------------------------------------------------------------------
Index: /trunk/Assembly_Library/Src/Menu/MenuScrollbars.asm
===================================================================
--- /trunk/Assembly_Library/Src/Menu/MenuScrollbars.asm	(revision 104)
+++ /trunk/Assembly_Library/Src/Menu/MenuScrollbars.asm	(revision 105)
@@ -1,7 +1,3 @@
-; File name		:	MenuScrollbars.asm
 ; Project name	:	Assembly Library
-; Created date	:	20.7.2010
-; Last update	:	9.12.2010
-; Author		:	Tomi Tilli
 ; Description	:	Functions for drawing scroll bars over menu borders.
 
@@ -185,5 +181,5 @@
 
 ;--------------------------------------------------------------------
-; .IsItemInCXonVisiblePage
+; MenuScrollbars_IsItemInCXonVisiblePage
 ;	Parameters
 ;		CX:		Item whose visibility is to be checked
@@ -197,7 +193,4 @@
 ALIGN JUMP_ALIGN
 MenuScrollbars_IsItemInCXonVisiblePage:
-	cmp		cx, [bp+MENUINIT.wItems]
-	jae		SHORT .ItemIsNotVisible
-
 	cmp		cx, [bp+MENU.wFirstVisibleItem]
 	jb		SHORT .ItemIsNotVisible
@@ -215,5 +208,5 @@
 
 ;--------------------------------------------------------------------
-; MenuLocation_GetLastVisibleItemOnPageToAX
+; MenuScrollbars_GetLastVisibleItemOnPageToAX
 ;	Parameters
 ;		SS:BP:	Ptr to MENU
Index: /trunk/Assembly_Library/Src/Menu/MenuTime.asm
===================================================================
--- /trunk/Assembly_Library/Src/Menu/MenuTime.asm	(revision 104)
+++ /trunk/Assembly_Library/Src/Menu/MenuTime.asm	(revision 105)
@@ -1,7 +1,3 @@
-; File name		:	MenuTime.asm
 ; Project name	:	Assembly Library
-; Created date	:	25.7.2010
-; Last update	:	30.11.2010
-; Author		:	Tomi Tilli
 ; Description	:	Menu timeouts other time related functions.
 
@@ -41,10 +37,7 @@
 MenuTime_StopSelectionTimeout:
 	test	BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN
-	jz		SHORT .TimeoutAlreadyStopped
+	jz		SHORT TimeoutAlreadyStopped
 	and		BYTE [bp+MENU.bFlags], ~FLG_MENU_TIMEOUT_COUNTDOWN
 	jmp		MenuBorders_RedrawBottomBorderLine
-ALIGN JUMP_ALIGN
-.TimeoutAlreadyStopped:
-	ret
 
 
@@ -77,6 +70,6 @@
 	call	MenuBorders_RedrawBottomBorderLine
 	clc
-ALIGN JUMP_ALIGN
 .ReturnSinceTimeoutDisabled:
+TimeoutAlreadyStopped:
 	ret
 
Index: /trunk/Assembly_Library/Src/Util/Memory.asm
===================================================================
--- /trunk/Assembly_Library/Src/Util/Memory.asm	(revision 104)
+++ /trunk/Assembly_Library/Src/Util/Memory.asm	(revision 105)
@@ -66,5 +66,5 @@
 	push	di
 	push	ax
-	Registers_CopySSBPtoESDI
+	call	Registers_CopySSBPtoESDI
 	call	Memory_ZeroESDIwithSizeInCX
 	pop		ax
Index: /trunk/Assembly_Library/Src/Util/Registers.asm
===================================================================
--- /trunk/Assembly_Library/Src/Util/Registers.asm	(revision 104)
+++ /trunk/Assembly_Library/Src/Util/Registers.asm	(revision 105)
@@ -1,57 +1,8 @@
 ; Project name	:	Assembly Library
 ; Description	:	Functions for register operations.
-
-;--------------------------------------------------------------------
-; NORMALIZE_FAR_POINTER
-;	Parameters:
-;		%1:%2:		Far pointer to normalize
-;		%3:			Scratch register
-;		%4:			Scratch register
-;	Returns:
-;		%1:%2:		Normalized far pointer
-;	Corrupts registers:
-;		%3, %4
-;--------------------------------------------------------------------
-%macro NORMALIZE_FAR_POINTER 4
-	mov		%4, %2				; Copy offset to scratch reg
-	and		%2, BYTE 0Fh		; Clear offset bits 15...4
-	eSHR_IM	%4, 4				; Divide offset by 16
-	mov		%3, %1				; Copy segment to scratch reg
-	add		%3, %4				; Add shifted offset to segment
-	mov		%1, %3				; Set normalized segment
-%endmacro
 
 
 ; Section containing code
 SECTION .text
-
-;--------------------------------------------------------------------
-; Registers_NormalizeDSSI
-; Registers_NormalizeESDI
-;	Parameters
-;		DS:SI or ES:DI:	Ptr to normalize
-;	Returns:
-;		DS:SI or ES:DI:	Normalized pointer
-;	Corrupts registers:
-;		Nothing
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-Registers_NormalizeDSSI:
-	push	dx
-	push	ax
-	NORMALIZE_FAR_POINTER ds, si, ax, dx
-	pop		ax
-	pop		dx
-	ret
-
-ALIGN JUMP_ALIGN
-Registers_NormalizeESDI:
-	push	dx
-	push	ax
-	NORMALIZE_FAR_POINTER es, di, ax, dx
-	pop		ax
-	pop		dx
-	ret
-
 
 ;--------------------------------------------------------------------
@@ -76,7 +27,7 @@
 ;--------------------------------------------------------------------
 ; Registers_CopySSBPtoESDI
-; Registers_CopySSBPtoDSSI
-; Registers_CopyDSSItoESDI
-; Registers_CopyESDItoDSSI
+; Registers_CopySSBPtoDSSI (uncommented to save bytes)
+; Registers_CopyDSSItoESDI (uncommented to save bytes)
+; Registers_CopyESDItoDSSI (uncommented to save bytes)
 ;	Parameters
 ;		Nothing
@@ -86,31 +37,27 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-%macro Registers_CopySSBPtoESDI 0
-	push	ss
-	pop		es
-	mov		di, bp
-%endmacro
+ALIGN JUMP_ALIGN
+Registers_CopySSBPtoESDI:
+	COPY_SSBP_TO_ESDI
+	ret
 
-%macro Registers_CopySSBPtoDSSI 0
-	push	ss
-	pop		ds
-	mov		si, bp
-%endmacro
+;ALIGN JUMP_ALIGN
+;Registers_CopySSBPtoDSSI:
+;	COPY_SSBP_TO_DSSI
+;	ret
 
-%macro Registers_CopyDSSItoESDI 0
-	push	ds
-	pop		es
-	mov		di, si
-%endmacro
+;ALIGN JUMP_ALIGN
+;Registers_CopyDSSItoESDI:
+;	COPY_DSSI_TO_ESDI
+;	ret
 
-%macro Registers_CopyESDItoDSSI 0
-	push	es
-	pop		ds
-	mov		si, di
-%endmacro
+;ALIGN JUMP_ALIGN
+;Registers_CopyESDItoDSSI:
+;	COPY_ESDI_to_DSSI
+;	ret
 
 
 ;--------------------------------------------------------------------
-; Registers_SetZFifNullPointerInDSSI
+; Registers_SetZFifNullPointerInDSSI (uncommented to save bytes)
 ;	Parameters
 ;		DS:SI:	Far pointer
@@ -120,9 +67,9 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-Registers_SetZFifNullPointerInDSSI:
-	push	ax
-	mov		ax, ds
-	or		ax, si
-	pop		ax
-	ret
+;ALIGN JUMP_ALIGN
+;Registers_SetZFifNullPointerInDSSI:
+;	push	ax
+;	mov		ax, ds
+;	or		ax, si
+;	pop		ax
+;	ret
