Index: trunk/Assembly_Library/Src/Display/DisplayPrint.asm
===================================================================
--- trunk/Assembly_Library/Src/Display/DisplayPrint.asm	(revision 41)
+++ trunk/Assembly_Library/Src/Display/DisplayPrint.asm	(revision 42)
@@ -2,5 +2,5 @@
 ; Project name	:	Assembly Library
 ; Created date	:	26.6.2010
-; Last update	:	10.8.2010
+; Last update	:	18.9.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Functions for display output.
@@ -250,42 +250,4 @@
 
 ;--------------------------------------------------------------------
-; DisplayPrint_RepeatCharacterFromALwithCountInCX
-;	Parameters:
-;		AL:		Character to display
-;		CX:		Repeat count
-;		DS:		BDA segment (zero)
-;		ES:DI:	Ptr to cursor location in video RAM
-;	Returns:
-;		DI:		Updated offset to video RAM
-;	Corrupts registers:
-;		AX, DX
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-DisplayPrint_RepeatCharacterFromALwithCountInCX:
-	push	ax
-	call	DisplayPrint_CharacterFromAL
-	pop		ax
-	loop	DisplayPrint_RepeatCharacterFromALwithCountInCX
-	ret
-
-
-;--------------------------------------------------------------------
-; DisplayPrint_CharacterFromAL
-;	Parameters:
-;		AL:		Character to display
-;		DS:		BDA segment (zero)
-;		ES:DI:	Ptr to cursor location in video RAM
-;	Returns:
-;		DI:		Updated offset to video RAM
-;	Corrupts registers:
-;		AX, DX
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-DisplayPrint_CharacterFromAL:
-	mov		ah, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bAttribute]
-	jmp		[VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fnCharOut]
-
-
-;--------------------------------------------------------------------
 ; DisplayPrint_ClearScreen
 ;	Parameters:
@@ -317,5 +279,5 @@
 ;		ES:DI:	Ptr to cursor location in video RAM
 ;	Returns:
-;		Nothing
+;		DI:		Updated offset to video RAM
 ;	Corrupts registers:
 ;		AX, DX
@@ -323,34 +285,66 @@
 ALIGN JUMP_ALIGN
 DisplayPrint_ClearAreaWithHeightInAHandWidthInAL:
+	push	si
 	push	cx
 	push	bx
-	push	di
-
-	xchg	bx, ax							; Move parameters to BX
+
+	xchg	bx, ax							; Area size to BX
 	call	DisplayCursor_GetSoftwareCoordinatesToAX
-	xchg	dx, ax							; Coordinates now in DX
-	xor		cx, cx							; Zero CX
-
-ALIGN JUMP_ALIGN
-.ClearRowFromArea:
+	xchg	si, ax							; Software (Y,X) coordinates now in SI
+	xor		cx, cx
+
+ALIGN JUMP_ALIGN
+.ClearRowLoop:
+	mov		cl, bl							; Area width now in CX
 	mov		al, ' '							; Clear with space
-	mov		ah, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bAttribute]
-	mov		cl, bl							; Area width = WORDs to clear
-	rep stosw
-	dec		bh
-	jz		SHORT .AreaCleared
-
-	inc		dh								; Increment row
-	push	dx
-	xchg	ax, dx
+	call	DisplayPrint_RepeatCharacterFromALwithCountInCX
+
+	xchg	ax, si							; Coordinates to AX
+	inc		ah								; Increment row
+	mov		si, ax
 	call	DisplayCursor_SetCoordinatesFromAX
-	pop		dx
-	jmp		SHORT .ClearRowFromArea
-
-ALIGN JUMP_ALIGN
-.AreaCleared:
-	pop		di
-	mov		[VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fpCursorPosition], di
+	dec		bh								; Decrement rows left
+	jnz		SHORT .ClearRowLoop
+
 	pop		bx
 	pop		cx
-	ret
+	pop		si
+	ret
+
+
+;--------------------------------------------------------------------
+; DisplayPrint_RepeatCharacterFromALwithCountInCX
+;	Parameters:
+;		AL:		Character to display
+;		CX:		Repeat count
+;		DS:		BDA segment (zero)
+;		ES:DI:	Ptr to cursor location in video RAM
+;	Returns:
+;		DI:		Updated offset to video RAM
+;	Corrupts registers:
+;		AX, DX
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+DisplayPrint_RepeatCharacterFromALwithCountInCX:
+	push	ax
+	call	DisplayPrint_CharacterFromAL
+	pop		ax
+	loop	DisplayPrint_RepeatCharacterFromALwithCountInCX
+	ret
+
+
+;--------------------------------------------------------------------
+; DisplayPrint_CharacterFromAL
+;	Parameters:
+;		AL:		Character to display
+;		DS:		BDA segment (zero)
+;		ES:DI:	Ptr to cursor location in video RAM
+;	Returns:
+;		DI:		Updated offset to video RAM
+;	Corrupts registers:
+;		AX, DX
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+DisplayPrint_CharacterFromAL:
+	mov		ah, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bAttribute]
+	jmp		[VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fnCharOut]
