Index: trunk/Assembly_Library/Src/Keyboard/Keyboard.asm
===================================================================
--- trunk/Assembly_Library/Src/Keyboard/Keyboard.asm	(revision 103)
+++ trunk/Assembly_Library/Src/Keyboard/Keyboard.asm	(revision 104)
@@ -1,7 +1,3 @@
-; File name		:	Keyboard.asm
 ; Project name	:	Assembly Library
-; Created date	:	5.7.2010
-; Last update	:	24.10.2010
-; Author		:	Tomi Tilli
 ; Description	:	Functions for managing keyboard.
 
Index: trunk/Assembly_Library/Src/Menu/CharOutLineSplitter.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/CharOutLineSplitter.asm	(revision 103)
+++ trunk/Assembly_Library/Src/Menu/CharOutLineSplitter.asm	(revision 104)
@@ -1,7 +1,3 @@
-; File name		:	CharOutLineSplitter.asm
 ; Project name	:	Assembly Library
-; Created date	:	11.10.2010
-; Last update	:	12.10.2010
-; Author		:	Tomi Tilli
 ; Description	:	Functions for splitting menu lines during character output.
 
@@ -20,31 +16,21 @@
 ALIGN JUMP_ALIGN
 CharOutLineSplitter_PrepareForPrintingTextLines:
-	call	.GetLastTextLineColumnOffsetToDX
-	call	CharOutLineSplitter_GetFirstTextLineColumnOffsetToAX
-	mov		ah, dl			; AL = Text line first column, AH = Text line last column
+	; Get first text line column offset to DX
+	call	CharOutLineSplitter_GetFirstBorderLineColumnOffsetToAX
+	add		al, MENU_TEXT_COLUMN_OFFSET<<1
+	xchg	dx, ax
+
+	; Get last text line column offset to AX
+	call	MenuLocation_GetMaxTextLineLengthToAX
+	shl		ax, 1			; Characters to BYTEs
+	add		ax, dx
+
+	xchg	ax, dx			; AL = First text line column offset
+	mov		ah, dl			; AH = Last text line column offset
 	CALL_DISPLAY_LIBRARY SetCharacterOutputParameterFromAX
-	ret
-
-;--------------------------------------------------------------------
-; .GetLastTextLineColumnOffsetToDX
-;	Parameters:
-;		SS:BP:	Ptr to MENU
-;	Returns:
-;		DX:		Offset to last (allowed) character in text line
-;	Corrupts registers:
-;		AX
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-.GetLastTextLineColumnOffsetToDX:
-	call	CharOutLineSplitter_GetFirstTextLineColumnOffsetToAX
-	xchg	dx, ax
-	call	MenuLocation_GetMaxTextLineLengthToAX
-	shl		ax, 1
-	add		dx, ax
 	ret
 
 
 ;--------------------------------------------------------------------
-; CharOutLineSplitter_GetFirstTextLineColumnOffsetToAX
 ; CharOutLineSplitter_GetFirstBorderLineColumnOffsetToAX
 ;	Parameters:
@@ -55,10 +41,4 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-CharOutLineSplitter_GetFirstTextLineColumnOffsetToAX:
-	call	CharOutLineSplitter_GetFirstBorderLineColumnOffsetToAX
-	add		al, MENU_TEXT_COLUMN_OFFSET<<1
-	ret
-
 ALIGN JUMP_ALIGN
 CharOutLineSplitter_GetFirstBorderLineColumnOffsetToAX:
@@ -111,18 +91,8 @@
 	push	cx
 	push	ax
-
-	call	GetOffsetToPartialWordToSIandSizeToCX
-	call	MenuCharOut_PrintLFCRandAdjustOffsetForStartOfLine
-	jcxz	.NothingToMove
-	call	MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX
-.NothingToMove:
-	pop		ax
-	pop		cx
-	pop		si
-	ret
-
+	; Fall to .GetOffsetToPartialWordToSIandSizeToCX
 
 ;--------------------------------------------------------------------
-; GetOffsetToPartialWordToSIandSizeToCX
+; .GetOffsetToPartialWordToSIandSizeToCX
 ;	Parameters:
 ;		ES:DI:	Ptr to space before border character
@@ -133,6 +103,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-GetOffsetToPartialWordToSIandSizeToCX:
+.GetOffsetToPartialWordToSIandSizeToCX:
 	xor		cx, cx
 	mov		si, di
@@ -150,9 +119,22 @@
 	inc		si			; SI now points one past space
 	shl		cx, 1		; Characters to bytes
-	ret
-
+	; Fall to .ChangeLine
 
 ;--------------------------------------------------------------------
-; MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX
+; .ChangeLine
+;	Parameters:
+;		Nothing
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX, DX
+;--------------------------------------------------------------------
+.ChangeLine:
+	call	MenuCharOut_PrintLFCRandAdjustOffsetForStartOfLine
+	jcxz	.ReturnFromMovePartialWordToNewTextLine
+	; Fall to .MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX
+
+;--------------------------------------------------------------------
+; .MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX
 ;	Parameters:
 ;		CX:		Number of BYTEs in partial word
@@ -165,6 +147,5 @@
 ;		AX, CX, DX, SI
 ;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX:
+.MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX:
 	push	si
 	push	cx
@@ -178,3 +159,8 @@
 	call	DisplayPrint_RepeatCharacterFromALwithCountInCX
 	mov		di, si
+
+.ReturnFromMovePartialWordToNewTextLine:
+	pop		ax
+	pop		cx
+	pop		si
 	ret
Index: trunk/Assembly_Library/Src/Menu/Menu.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/Menu.asm	(revision 103)
+++ trunk/Assembly_Library/Src/Menu/Menu.asm	(revision 104)
@@ -1,7 +1,3 @@
-; File name		:	Menu.asm
 ; Project name	:	Assembly Library
-; Created date	:	3.8.2010
-; Last update	:	22.11.2010
-; Author		:	Tomi Tilli
 ; Description	:	Menu Library functions for CALL_MENU_LIBRARY macro
 ;					that users should use to make library call.
Index: trunk/Assembly_Library/Src/Menu/MenuAttributes.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/MenuAttributes.asm	(revision 103)
+++ trunk/Assembly_Library/Src/Menu/MenuAttributes.asm	(revision 104)
@@ -1,7 +1,3 @@
-; File name		:	MenuAttributes.asm
 ; Project name	:	Assembly Library
-; Created date	:	15.7.2010
-; Last update	:	9.8.2010
-; Author		:	Tomi Tilli
 ; Description	:	Finds suitable character attribute for
 ;					color, B/W and monochrome displays.
Index: trunk/Assembly_Library/Src/Menu/MenuBorders.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/MenuBorders.asm	(revision 103)
+++ trunk/Assembly_Library/Src/Menu/MenuBorders.asm	(revision 104)
@@ -1,7 +1,3 @@
-; File name		:	MenuBorders.asm
 ; Project name	:	Assembly Library
-; Created date	:	14.7.2010
-; Last update	:	9.12.2010
-; Author		:	Tomi Tilli
 ; Description	:	Functions for drawing menu borders.
 
@@ -56,4 +52,23 @@
 
 ;--------------------------------------------------------------------
+; MenuBorders_RefreshItemBorders
+;	Parameters
+;		SS:BP:	Ptr to MENU
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX, BX, CX, DX, SI, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+MenuBorders_RefreshItemBorders:
+	call	MenuBorders_AdjustDisplayContextForDrawingBorders
+	call	MenuLocation_GetItemBordersTopLeftCoordinatesToAX
+	CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
+
+	call	MenuBorders_GetNumberOfMiddleCharactersToDX
+	jmp		SHORT RefreshItemBorders
+
+
+;--------------------------------------------------------------------
 ; MenuBorders_AdjustDisplayContextForDrawingBorders
 ;	Parameters
@@ -81,23 +96,4 @@
 
 ;--------------------------------------------------------------------
-; MenuBorders_RefreshItemBorders
-;	Parameters
-;		SS:BP:	Ptr to MENU
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		AX, BX, CX, DX, SI, DI
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-MenuBorders_RefreshItemBorders:
-	call	MenuBorders_AdjustDisplayContextForDrawingBorders
-	call	MenuLocation_GetItemBordersTopLeftCoordinatesToAX
-	CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
-
-	call	MenuBorders_GetNumberOfMiddleCharactersToDX
-	jmp		SHORT RefreshItemBorders
-
-
-;--------------------------------------------------------------------
 ; MenuBorders_GetNumberOfMiddleCharactersToDX
 ;	Parameters
@@ -161,27 +157,24 @@
 	call	DrawSeparationBorderLine
 	call	MenuScrollbars_GetMaxVisibleItemsOnPageToCX
+	; Fall to DrawTextBorderLinesByCXtimes
+
+;--------------------------------------------------------------------
+; DrawTextBorderLinesByCXtimes
+;	Parameters
+;		CX:		Number of border lines to draw
+;		DX:		Number of times to repeat middle character
+;		SS:BP:	Ptr to MENU
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX, CX, SI, DI
+;--------------------------------------------------------------------
 DrawTextBorderLinesByCXtimes:
-	mov		bx, DrawTextBorderLine
-	; Fall to DrawBorderLinesByCXtimes
-
-;--------------------------------------------------------------------
-; DrawBorderLinesByCXtimes
-;	Parameters
-;		BX:		Offset to border drawing function
-;		CX:		Number of border lines to draw
-;		DX:		Number of times to repeat middle character
-;		SS:BP:	Ptr to MENU
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		AX, CX, SI, DI
-;--------------------------------------------------------------------
-DrawBorderLinesByCXtimes:
-	jcxz	.Return
+	jcxz	.NoBorderLinesToDraw
 ALIGN JUMP_ALIGN
 .DrawBordersWithFunctionInBX:
-	call	bx
+	call	DrawTextBorderLine
 	loop	.DrawBordersWithFunctionInBX
-.Return:
+.NoBorderLinesToDraw:
 	ret
 
@@ -228,6 +221,7 @@
 ALIGN JUMP_ALIGN
 DrawBottomShadowLine:
-	mov		ax, 1		; Increment column
-	call	MenuLocation_MoveCursorByALcolumnsAndAHrows
+	CALL_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX
+	inc		ax			; Move one column left
+	CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
 	inc		dx			; Increment repeat count...
 	inc		dx			; ...for both corner characters
@@ -319,15 +313,14 @@
 ALIGN JUMP_ALIGN
 PrintBorderCharactersFromCSSI:
-	cld
 	eSEG	cs
-	lodsb			; Load from [si+BORDER_CHARS.cLeft] to AL
+	lodsb			; Load from [cs:si+BORDER_CHARS.cLeft] to AL
 	call	MenuBorders_PrintSingleBorderCharacterFromAL
 
 	eSEG	cs
-	lodsb			; Load from [si+BORDER_CHARS.cMiddle] to AL
+	lodsb			; Load from [cs:si+BORDER_CHARS.cMiddle] to AL
 	call	MenuBorders_PrintMultipleBorderCharactersFromAL
 
 	eSEG	cs
-	lodsb			; Load from [si+BORDER_CHARS.cRight] to AL
+	lodsb			; Load from [cs:si+BORDER_CHARS.cRight] to AL
 	; Fall to MenuBorders_PrintSingleBorderCharacterFromAL
 
@@ -382,11 +375,14 @@
 ;		AX, SI, DI
 ;--------------------------------------------------------------------
-;ALIGN JUMP_ALIGN
 .PrintTimeoutStringWithSecondsInAX:
+	; Get attribute to AX
+	xchg	di, ax
+	mov		si, ATTRIBUTE_CHARS.cNormalTimeout
+	cmp		di, BYTE MENU_TIMEOUT_SECONDS_FOR_HURRY
+	eCMOVB	si, ATTRIBUTE_CHARS.cHurryTimeout
+	call	MenuAttribute_GetToAXfromTypeInSI
+
 	push	bp
-
-	xchg	di, ax
 	mov		bp, sp
-	call	.GetTimeoutAttributeToAXfromSecondsInDI
 	mov		si, .szSelectionTimeout
 	push	ax			; Push attribute
@@ -399,20 +395,4 @@
 	db		DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL
 	db		"%AAutoselection in %2u s",NULL
-
-;--------------------------------------------------------------------
-; .GetTimeoutAttributeToAXfromSecondsInDI
-;	Parameters
-;		DI:		Seconds to print
-;	Returns:
-;		AX:		Attribute byte for seconds
-;	Corrupts registers:
-;		SI
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-.GetTimeoutAttributeToAXfromSecondsInDI:
-	mov		si, ATTRIBUTE_CHARS.cNormalTimeout
-	cmp		di, BYTE MENU_TIMEOUT_SECONDS_FOR_HURRY
-	eCMOVB	si, ATTRIBUTE_CHARS.cHurryTimeout
-	jmp		MenuAttribute_GetToAXfromTypeInSI
 
 
Index: trunk/Assembly_Library/Src/Menu/MenuCharOut.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/MenuCharOut.asm	(revision 103)
+++ trunk/Assembly_Library/Src/Menu/MenuCharOut.asm	(revision 104)
@@ -1,7 +1,3 @@
-; File name		:	MenuCharOut.asm
 ; Project name	:	Assembly Library
-; Created date	:	15.7.2010
-; Last update	:	12.10.2010
-; Author		:	Tomi Tilli
 ; Description	:	Character out function for printing withing menu window.
 
Index: trunk/Assembly_Library/Src/Menu/MenuEvent.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/MenuEvent.asm	(revision 103)
+++ trunk/Assembly_Library/Src/Menu/MenuEvent.asm	(revision 104)
@@ -1,7 +1,3 @@
-; File name		:	MenuEvent.asm
 ; Project name	:	Assembly Library
-; Created date	:	13.7.2010
-; Last update	:	12.10.2010
-; Author		:	Tomi Tilli
 ; Description	:	Functions for initializing menu system.
 
Index: trunk/Assembly_Library/Src/Menu/MenuInit.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/MenuInit.asm	(revision 103)
+++ trunk/Assembly_Library/Src/Menu/MenuInit.asm	(revision 104)
@@ -1,7 +1,3 @@
-; File name		:	MenuInit.asm
 ; Project name	:	Assembly Library
-; Created date	:	13.7.2010
-; Last update	:	22.11.2010
-; Author		:	Tomi Tilli
 ; Description	:	Functions for initializing menu system.
 
@@ -25,7 +21,7 @@
 	LOAD_BDA_SEGMENT_TO ds, cx
 	push	WORD [BDA.wVidCurShape]
-	eENTER_STRUCT MENU_size
+	mov		cl, MENU_size
+	eENTER_STRUCT cx
 
-	mov		cx, MENU_size
 	call	Memory_ZeroSSBPwithSizeInCX
 	call	MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX
@@ -59,5 +55,5 @@
 	mov		ax, CURSOR_HIDDEN
 	CALL_DISPLAY_LIBRARY SetCursorShapeFromAX
-	call	MenuEvent_InitializeMenuinit		; User initialization
+	call	MenuEvent_InitializeMenuinit	; User initialization
 	call	MenuInit_RefreshMenuWindow
 	jmp		MenuLoop_Enter
Index: trunk/Assembly_Library/Src/Menu/MenuLocation.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/MenuLocation.asm	(revision 103)
+++ trunk/Assembly_Library/Src/Menu/MenuLocation.asm	(revision 104)
@@ -1,30 +1,7 @@
-; File name		:	MenuLocation.asm
 ; Project name	:	Assembly Library
-; Created date	:	14.7.2010
-; Last update	:	25.11.2010
-; Author		:	Tomi Tilli
 ; Description	:	Functions for calculation menu window dimensions.
 
 ; Section containing code
 SECTION .text
-
-;--------------------------------------------------------------------
-; MenuLocation_GetScrollbarCoordinatesToAXforItemInAX
-;	Parameters
-;		AX:		Item index
-;		SS:BP:	Ptr to MENU
-;	Returns:
-;		AL:		Column (X)
-;		AH:		Row (Y)
-;	Corrupts registers:
-;		Nothing
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-MenuLocation_GetScrollbarCoordinatesToAXforItemInAX:
-	call	MenuLocation_GetTextCoordinatesToAXforItemInAX
-	add		al, [bp+MENUINIT.bWidth]
-	sub		al, MENU_TEXT_COLUMN_OFFSET*2
-	ret
-
 
 ;--------------------------------------------------------------------
@@ -72,5 +49,4 @@
 ; MenuLocation_GetTitleBordersTopLeftCoordinatesToAX
 ; MenuLocation_GetItemBordersTopLeftCoordinatesToAX
-; MenuLocation_GetInformationBordersTopLeftCoordinatesToAX
 ; MenuLocation_GetBottomBordersTopLeftCoordinatesToAX
 ;	Parameters
@@ -93,15 +69,10 @@
 
 ALIGN JUMP_ALIGN
-MenuLocation_GetInformationBordersTopLeftCoordinatesToAX:
-	xor		ax, ax
-	jmp		SHORT AddInformationBordersTopLeftCoordinatesToAX
-
-ALIGN JUMP_ALIGN
 MenuLocation_GetBottomBordersTopLeftCoordinatesToAX:
 	xor		ax, ax
-	; Fall to AddBottomBordersTopLeftCoordinatesToAX
+	; Fall to .AddBottomBordersTopLeftCoordinatesToAX
 
 ;--------------------------------------------------------------------
-; AddBottomBordersTopLeftCoordinatesToAX
+; .AddBottomBordersTopLeftCoordinatesToAX
 ; AddInformationBordersTopLeftCoordinatesToAX
 ; AddItemBordersTopLeftCoordinatesToAX
@@ -116,6 +87,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-AddBottomBordersTopLeftCoordinatesToAX:
+.AddBottomBordersTopLeftCoordinatesToAX:
 	stc							; Compensate for Information top border
 	adc		ah, [bp+MENUINIT.bInfoLines]
@@ -160,23 +130,2 @@
 	sub		ax, BYTE MENU_HORIZONTAL_BORDER_LINES + MENU_TEXT_COLUMN_OFFSET
 	ret
-
-
-;--------------------------------------------------------------------
-; MenuLocation_MoveCursorByALcolumnsAndAHrows
-;	Parameters
-;		AL:		Number of columns to move
-;		AH:		Numver of rows to move
-;		SS:BP:	Ptr to MENU
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		AX, DI
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-MenuLocation_MoveCursorByALcolumnsAndAHrows:
-	push	ax
-	CALL_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX
-	pop		di
-	add		ax, di
-	CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
-	ret
Index: trunk/Assembly_Library/Src/Menu/MenuText.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/MenuText.asm	(revision 103)
+++ trunk/Assembly_Library/Src/Menu/MenuText.asm	(revision 104)
@@ -250,5 +250,8 @@
 	call	MenuBorders_AdjustDisplayContextForDrawingBorders
 	mov		ax, cx
-	call	MenuLocation_GetScrollbarCoordinatesToAXforItemInAX
+
+	call	MenuLocation_GetTextCoordinatesToAXforItemInAX
+	add		al, [bp+MENUINIT.bWidth]
+	sub		al, MENU_TEXT_COLUMN_OFFSET*2
 	CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
 
