Index: trunk/Assembly_Library/Inc/Display.inc
===================================================================
--- trunk/Assembly_Library/Inc/Display.inc	(revision 66)
+++ trunk/Assembly_Library/Inc/Display.inc	(revision 67)
@@ -2,5 +2,5 @@
 ; Project name	:	AssemblyLibrary
 ; Created date	:	25.6.2010
-; Last update	:	11.10.2010
+; Last update	:	7.12.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Defines for display library.
@@ -64,5 +64,5 @@
 	.PrintNewlineCharacters							resb	2
 	.ClearAreaWithHeightInAHandWidthInAL			resb	2
-	.ClearScreen									resb	2
+	.ClearScreenWithCharInALandAttrInAH				resb	2
 endstruc
 
@@ -229,4 +229,6 @@
 	%define	SCREEN_BACKGROUND_ATTRIBUTE		MONO_NORMAL
 %endif
+%define SCREEN_BACKGROUND_CHARACTER_AND_ATTRIBUTE	(SCREEN_BACKGROUND_CHARACTER | (SCREEN_BACKGROUND_ATTRIBUTE<<8))
+%define DOS_BACKGROUND_CHARACTER_AND_ATTRIBUTE		(' ' | (MONO_NORMAL<<8))
 
 %endif ; DISPLAY_INC
Index: trunk/Assembly_Library/Src/Display/Display.asm
===================================================================
--- trunk/Assembly_Library/Src/Display/Display.asm	(revision 66)
+++ trunk/Assembly_Library/Src/Display/Display.asm	(revision 67)
@@ -2,5 +2,5 @@
 ; Project name	:	Assembly Library
 ; Created date	:	2.7.2010
-; Last update	:	28.9.2010
+; Last update	:	7.12.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Display Library functions for CALL_DISPLAY_LIBRARY macro
@@ -90,4 +90,4 @@
 	at	DISPLAY_LIB.PrintNewlineCharacters,							dw	DisplayPrint_Newline
 	at	DISPLAY_LIB.ClearAreaWithHeightInAHandWidthInAL,			dw	DisplayPrint_ClearAreaWithHeightInAHandWidthInAL
-	at	DISPLAY_LIB.ClearScreen,									dw	DisplayPrint_ClearScreen
+	at	DISPLAY_LIB.ClearScreenWithCharInALandAttrInAH,				dw	DisplayPrint_ClearScreenWithCharInALandAttributeInAH
 iend
Index: trunk/Assembly_Library/Src/Display/DisplayPrint.asm
===================================================================
--- trunk/Assembly_Library/Src/Display/DisplayPrint.asm	(revision 66)
+++ trunk/Assembly_Library/Src/Display/DisplayPrint.asm	(revision 67)
@@ -2,5 +2,5 @@
 ; Project name	:	Assembly Library
 ; Created date	:	26.6.2010
-; Last update	:	11.10.2010
+; Last update	:	7.12.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Functions for display output.
@@ -222,6 +222,8 @@
 
 ;--------------------------------------------------------------------
-; DisplayPrint_ClearScreen
-;	Parameters:
+; DisplayPrint_ClearScreenWithCharInALandAttributeInAH
+;	Parameters:
+;		AL:		Character to clear with
+;		AH:		Attribute to clear with
 ;		DS:		BDA segment (zero)
 ;		ES:DI:	Ptr to cursor location in video RAM
@@ -232,10 +234,17 @@
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
-DisplayPrint_ClearScreen:
+DisplayPrint_ClearScreenWithCharInALandAttributeInAH:
 	push	di
+	push	cx
+
+	xchg	cx, ax
 	xor		ax, ax
-	call	DisplayCursor_SetCoordinatesFromAX
+	call	DisplayCursor_SetCoordinatesFromAX		; Updates DI
 	call	DisplayPage_GetColumnsToALandRowsToAH
-	call	DisplayPrint_ClearAreaWithHeightInAHandWidthInAL
+	mul		ah		; AX = AL*AH = Characters on screen
+	xchg	cx, ax	; AX = Char+Attr, CX = WORDs to store
+	rep stosw
+
+	pop		cx
 	pop		di
 	mov		[VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fpCursorPosition], di
Index: trunk/Assembly_Library/Src/File/FileIO.asm
===================================================================
--- trunk/Assembly_Library/Src/File/FileIO.asm	(revision 66)
+++ trunk/Assembly_Library/Src/File/FileIO.asm	(revision 67)
@@ -178,4 +178,5 @@
 	call	bp						; Transfer function
 	jc		SHORT .ErrorOccurredDuringTransfer
+	add		si, SPLIT_SIZE_FOR_LARGE_TRANSFERS
 	dec		dx
 	jnz		SHORT .TransferNextBytes
Index: trunk/Assembly_Library/Src/LibraryTests.asm
===================================================================
--- trunk/Assembly_Library/Src/LibraryTests.asm	(revision 66)
+++ trunk/Assembly_Library/Src/LibraryTests.asm	(revision 67)
@@ -2,5 +2,5 @@
 ; Project name	:	Assembly Library
 ; Created date	:	27.6.2010
-; Last update	:	22.11.2010
+; Last update	:	7.12.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Tests for Assembly Library.
@@ -31,5 +31,6 @@
 LibraryTests_Start:	
 	CALL_DISPLAY_LIBRARY InitializeDisplayContext
-	CALL_DISPLAY_LIBRARY ClearScreen
+	mov		ax, SCREEN_BACKGROUND_CHARACTER_AND_ATTRIBUTE
+	CALL_DISPLAY_LIBRARY ClearScreenWithCharInALandAttrInAH
 
 	;call	LibraryTests_Sort
Index: trunk/Assembly_Library/Src/Menu/MenuBorders.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/MenuBorders.asm	(revision 66)
+++ trunk/Assembly_Library/Src/Menu/MenuBorders.asm	(revision 67)
@@ -2,5 +2,5 @@
 ; Project name	:	Assembly Library
 ; Created date	:	14.7.2010
-; Last update	:	30.11.2010
+; Last update	:	9.12.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Functions for drawing menu borders.
@@ -29,5 +29,5 @@
 MenuBorders_RefreshAll:
 	call	MenuBorders_AdjustDisplayContextForDrawingBorders
-	call	GetNumberOfMiddleCharactersToDX
+	call	MenuBorders_GetNumberOfMiddleCharactersToDX
 	call	RefreshTitleBorders
 	call	RefreshItemBorders
@@ -51,5 +51,5 @@
 	call	MenuLocation_GetBottomBordersTopLeftCoordinatesToAX
 	CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
-	call	GetNumberOfMiddleCharactersToDX
+	call	MenuBorders_GetNumberOfMiddleCharactersToDX
 	jmp		SHORT DrawBottomBorderLine
 
@@ -95,10 +95,10 @@
 	CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
 
-	call	GetNumberOfMiddleCharactersToDX
+	call	MenuBorders_GetNumberOfMiddleCharactersToDX
 	jmp		SHORT RefreshItemBorders
 
 
 ;--------------------------------------------------------------------
-; GetNumberOfMiddleCharactersToDX
+; MenuBorders_GetNumberOfMiddleCharactersToDX
 ;	Parameters
 ;		SS:BP:	Ptr to MENU
@@ -109,5 +109,5 @@
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
-GetNumberOfMiddleCharactersToDX:
+MenuBorders_GetNumberOfMiddleCharactersToDX:
 	eMOVZX	dx, BYTE [bp+MENUINIT.bWidth]
 	sub		dx, BYTE MENU_HORIZONTAL_BORDER_LINES
@@ -300,5 +300,5 @@
 	pop		bx
 
-	call	PrintMultipleBorderCharactersFromAL	; AL does not matter
+	call	MenuBorders_PrintMultipleBorderCharactersFromAL	; AL does not matter
 
 	CALL_DISPLAY_LIBRARY PopDisplayContext
@@ -326,5 +326,5 @@
 	eSEG	cs
 	lodsb			; Load from [si+BORDER_CHARS.cMiddle] to AL
-	call	PrintMultipleBorderCharactersFromAL
+	call	MenuBorders_PrintMultipleBorderCharactersFromAL
 
 	eSEG	cs
@@ -334,8 +334,8 @@
 ;--------------------------------------------------------------------
 ; MenuBorders_PrintSingleBorderCharacterFromAL
-; PrintMultipleBorderCharactersFromAL
+; MenuBorders_PrintMultipleBorderCharactersFromAL
 ;	Parameters
 ;		AL:		Character to print
-;		DX:		Repeat count (PrintMultipleBorderCharactersFromAL)
+;		DX:		Repeat count (MenuBorders_PrintMultipleBorderCharactersFromAL)
 ;		SS:BP:	Ptr to MENU
 ;	Returns:
@@ -350,5 +350,5 @@
 
 ALIGN JUMP_ALIGN
-PrintMultipleBorderCharactersFromAL:
+MenuBorders_PrintMultipleBorderCharactersFromAL:
 	push	cx
 	mov		cx, dx
Index: trunk/Assembly_Library/Src/Menu/MenuScrollbars.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/MenuScrollbars.asm	(revision 66)
+++ trunk/Assembly_Library/Src/Menu/MenuScrollbars.asm	(revision 67)
@@ -2,5 +2,5 @@
 ; Project name	:	Assembly Library
 ; Created date	:	20.7.2010
-; Last update	:	12.10.2010
+; Last update	:	9.12.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Functions for drawing scroll bars over menu borders.
@@ -17,10 +17,12 @@
 ;				Cleared if no scroll bars needed
 ;	Corrupts registers:
-;		CX
+;		AX
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
 MenuScrollbars_AreScrollbarsNeeded:
+	xchg	ax, cx
 	call	MenuScrollbars_GetMaxVisibleItemsOnPageToCX
 	cmp		cx, [bp+MENUINIT.wItems]		; Set CF if max visible < total items
+	xchg	cx, ax
 	ret
 
Index: trunk/Assembly_Library/Src/Menu/MenuText.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/MenuText.asm	(revision 66)
+++ trunk/Assembly_Library/Src/Menu/MenuText.asm	(revision 67)
@@ -2,5 +2,5 @@
 ; Project name	:	Assembly Library
 ; Created date	:	21.7.2010
-; Last update	:	24.10.2010
+; Last update	:	9.12.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Functions for drawing menu texts by the user.
@@ -126,13 +126,15 @@
 MenuText_RefreshItemFromAX:
 	push	cx
-	mov		cx, ax					; Backup item to CX
-
+	push	ax
+
+	xchg	cx, ax
 	call	MenuScrollbars_IsItemInCXonVisiblePage
 	jnc		SHORT .InvalidItem
 	call	MenuText_AdjustDisplayContextForDrawingItemFromCX
+	call	ClearPreviousItem
 	call	MenuEvent_RefreshItemFromCX
-	call	DrawScrollbarIfNecessary
+	call	DrawScrollbarCharacterForItemInCXifNecessary
 .InvalidItem:
-	xchg	ax, cx					; Restore AX
+	pop		ax
 	pop		cx
 	ret
@@ -181,4 +183,28 @@
 
 ;--------------------------------------------------------------------
+; ClearPreviousItem
+;	Parameters
+;		SS:BP:	Ptr to MENU
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX, BX, DX, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+ClearPreviousItem:
+	CALL_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX
+	xchg	bx, ax
+
+	call	MenuBorders_GetNumberOfMiddleCharactersToDX
+	sub		dx, BYTE MENU_TEXT_COLUMN_OFFSET
+	mov		al, [cs:g_rgbTextBorderCharacters+BORDER_CHARS.cMiddle]
+	call	MenuBorders_PrintMultipleBorderCharactersFromAL
+
+	xchg	ax, bx
+	CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
+	ret
+
+
+;--------------------------------------------------------------------
 ; GetItemTextAttributeTypeToSIforItemInCX
 ;	Parameters
@@ -205,5 +231,5 @@
 
 ;--------------------------------------------------------------------
-; DrawScrollbarIfNecessary
+; DrawScrollbarCharacterForItemInCXifNecessary
 ;	Parameters
 ;		CX:		Item to refresh
@@ -212,58 +238,15 @@
 ;		Nothing
 ;	Corrupts registers:
-;		AX, BX, DX, SI, DI
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-DrawScrollbarIfNecessary:
-	push	cx
-	call	.DrawSpacesBeforeScrollbarCharacter
+;		AX, CX, BX, DX, SI, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+DrawScrollbarCharacterForItemInCXifNecessary:
 	call	MenuScrollbars_AreScrollbarsNeeded
-	pop		cx
 	jc		SHORT .DrawScrollbarCharacter
 	ret
 
-;--------------------------------------------------------------------
-; .DrawSpacesBeforeScrollbarCharacter
-;	Parameters
-;		CX:		Item to refresh
-;		SS:BP:	Ptr to MENU
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		AX, CX, DX, DI
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-.DrawSpacesBeforeScrollbarCharacter:
-	CALL_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX
-	xchg	dx, ax					; Current coordinates to DX
-	mov		ax, cx
-	call	MenuLocation_GetScrollbarCoordinatesToAXforItemInAX
-	sub		al, dl
-	sub		al, MENU_TEXT_COLUMN_OFFSET/2
-
-	eMOVZX	cx, al
-	jcxz	.NoSpacesNeeded
-	mov		al, ' '
-	CALL_DISPLAY_LIBRARY PrintRepeatedCharacterFromALwithCountInCX
-ALIGN JUMP_ALIGN, ret
-.NoSpacesNeeded:
-	ret
-
-;--------------------------------------------------------------------
-; .DrawScrollbarCharacter
-;	Parameters
-;		CX:		Item to refresh
-;		SS:BP:	Ptr to MENU
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		AX, BX, DX, SI, DI
-;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
 .DrawScrollbarCharacter:
-	push	cx
-
 	call	MenuBorders_AdjustDisplayContextForDrawingBorders
-
 	mov		ax, cx
 	call	MenuLocation_GetScrollbarCoordinatesToAXforItemInAX
@@ -273,6 +256,3 @@
 	sub		di, [bp+MENU.wFirstVisibleItem]		; Item to line
 	call	MenuScrollbars_GetScrollCharacterToALForLineInDI
-	CALL_DISPLAY_LIBRARY PrintCharacterFromAL
-
-	pop		cx
-	ret
+	jmp		MenuBorders_PrintSingleBorderCharacterFromAL
Index: trunk/Assembly_Library/Src/String/StringProcess.asm
===================================================================
--- trunk/Assembly_Library/Src/String/StringProcess.asm	(revision 66)
+++ trunk/Assembly_Library/Src/String/StringProcess.asm	(revision 67)
@@ -2,5 +2,5 @@
 ; Project name	:	Assembly Library
 ; Created date	:	12.10.2010
-; Last update	:	12.10.2010
+; Last update	:	7.12.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Functions for processing characters in a string.
@@ -10,8 +10,8 @@
 
 ;--------------------------------------------------------------------
-; Character processing callback function prototype for StringProcess_DSSIwithFunctionInBX.
+; Character processing callback function prototype for StringProcess_DSSIwithFunctionInDX.
 ;	Parameters:
 ;		AL:			Character to process
-;		CX:			Number of characters processed
+;		CX:			Character number (index for next character)
 ;		DS:SI:		Ptr to next character
 ;		BX,DI,ES:	Free to use by processing function
