Index: trunk/Assembly_Library/Src/Menu/MenuBorders.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/MenuBorders.asm	(revision 67)
+++ 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
 
 
