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