Index: trunk/Assembly_Library/Src/AssemblyLibrary.asm
===================================================================
--- trunk/Assembly_Library/Src/AssemblyLibrary.asm	(revision 53)
+++ trunk/Assembly_Library/Src/AssemblyLibrary.asm	(revision 54)
@@ -2,5 +2,5 @@
 ; Project name	:	Assembly Library
 ; Created date	:	15.9.2010
-; Last update	:	12.10.2010
+; Last update	:	24.10.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Assembly Library main file. This is the only file that
@@ -48,4 +48,5 @@
 	%ifdef INCLUDE_MENU_DIALOGS
 		%include "Dialog.asm"
+		%include "DialogDrive.asm"
 		%include "DialogFile.asm"
 		%include "DialogMessage.asm"
@@ -73,4 +74,5 @@
 	%include "Bit.asm"
 	%include "Memory.asm"
+	%include "Registers.asm"
 	%include "Size.asm"
 	%include "Sort.asm"
Index: trunk/Assembly_Library/Src/Keyboard/Keyboard.asm
===================================================================
--- trunk/Assembly_Library/Src/Keyboard/Keyboard.asm	(revision 53)
+++ trunk/Assembly_Library/Src/Keyboard/Keyboard.asm	(revision 54)
@@ -2,5 +2,5 @@
 ; Project name	:	Assembly Library
 ; Created date	:	5.7.2010
-; Last update	:	12.10.2010
+; Last update	:	24.10.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Functions for managing keyboard.
@@ -34,7 +34,7 @@
 
 	call	Char_GetFilterFunctionToDXforNumericBaseInBX
-	call	Memory_ExchangeDSSIwithESDI
+	call	Registers_ExchangeDSSIwithESDI
 	call	Keyboard_ReadUserInputtedStringToESDIWhilePrinting
-	call	Memory_ExchangeDSSIwithESDI	; Does not modify FLAGS
+	call	Registers_ExchangeDSSIwithESDI	; Does not modify FLAGS
 	jz		SHORT .CancelledByUser
 
@@ -42,5 +42,5 @@
 .CancelledByUser:
 	add		sp, BYTE BUFFER_SIZE_FOR_WORD_INPUT
-	test	cx, cx					; Set ZF if string length is zero
+	test	cx, cx							; Set ZF if string length is zero
 	pop		cx
 	pop		si
Index: trunk/Assembly_Library/Src/Menu/Dialog/DialogDrive.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/Dialog/DialogDrive.asm	(revision 54)
+++ trunk/Assembly_Library/Src/Menu/Dialog/DialogDrive.asm	(revision 54)
@@ -0,0 +1,127 @@
+; File name		:	DialogDrive.asm
+; Project name	:	Assembly Library
+; Created date	:	22.10.2010
+; Last update	:	23.10.2010
+; Author		:	Tomi Tilli
+; Description	:	Displays drive dialog.
+
+
+; Section containing code
+SECTION .text
+
+;--------------------------------------------------------------------
+; DialogDrive_GetDriveWithIoInDSSI
+;	Parameters:
+;		DS:SI:	Ptr to DRIVE_DIALOG_IO
+;		SS:BP:	Ptr to parent MENU
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX, BX, CX, DX, SI, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+DialogDrive_GetDriveWithIoInDSSI:
+	mov		bx, DriveEventHandler
+	mov		BYTE [si+DRIVE_DIALOG_IO.bUserCancellation], TRUE
+	jmp		Dialog_DisplayWithDialogInputInDSSIandHandlerInBX
+
+
+;--------------------------------------------------------------------
+; DriveEventHandler
+;	Common parameters for all events:
+;		BX:			Menu event (anything from MENUEVENT struct)
+;		SS:BP:		Ptr to DIALOG
+;	Common return values for all events:
+;		CF:			Set if event processed
+;					Cleared if event not processed
+;	Corrupts registers:
+;		All
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+DriveEventHandler:
+	jmp		[cs:bx+.rgfnEventHandlers]
+
+
+ALIGN JUMP_ALIGN
+.InitializeMenuinitFromDSSI:
+	xor		ax, ax
+	call	Dialog_EventInitializeMenuinitFromDSSIforSingleItemWithHighlightedItemInAX
+	call	Drive_GetFlagsForAvailableDrivesToDXAX
+	mov		[bp+MENU.dwUserData], ax
+	mov		[bp+MENU.dwUserData+2], dx
+
+	call	Bit_GetSetCountToCXfromDXAX
+	mov		[bp+MENUINIT.wItems], cx
+
+	dec		cx			; Items initialized to one. Ignore it.
+	add		cl, [bp+MENUINIT.bHeight]
+	CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH
+	MIN_U	cl, ah
+	mov		[bp+MENUINIT.bHeight], cl
+	ret
+
+
+ALIGN JUMP_ALIGN
+.ItemSelectedFromCX:
+	call	ConvertDriveLetterToBLfromItemIndexInCX
+	lds		si, [bp+DIALOG.fpDialogIO]
+	mov		BYTE [si+DRIVE_DIALOG_IO.bUserCancellation], FALSE
+	mov		[si+DRIVE_DIALOG_IO.cReturnDriveLetter], bl
+	sub		bl, 'A'
+	mov		[si+DRIVE_DIALOG_IO.bReturnDriveNumber], bl
+	jmp		MenuInit_CloseMenuWindow
+
+
+ALIGN JUMP_ALIGN
+.RefreshItemFromCX:
+	push	bp
+
+	call	ConvertDriveLetterToBLfromItemIndexInCX
+	mov		bp, sp
+	push	bx
+	mov		si, g_szDriveFormat
+	CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
+
+	pop		bp
+	stc
+	ret
+
+
+.rgfnEventHandlers:
+istruc MENUEVENT
+	at	MENUEVENT.InitializeMenuinitFromDSSI,	dw	.InitializeMenuinitFromDSSI
+	at	MENUEVENT.ExitMenu,						dw	Dialog_EventNotHandled
+	at	MENUEVENT.IdleProcessing,				dw	Dialog_EventNotHandled
+	at	MENUEVENT.ItemHighlightedFromCX,		dw	Dialog_EventNotHandled
+	at	MENUEVENT.ItemSelectedFromCX,			dw	.ItemSelectedFromCX
+	at	MENUEVENT.KeyStrokeInAX,				dw	Dialog_EventNotHandled
+	at	MENUEVENT.RefreshTitle,					dw	Dialog_EventRefreshTitle
+	at	MENUEVENT.RefreshInformation,			dw	Dialog_EventRefreshInformation
+	at	MENUEVENT.RefreshItemFromCX,			dw	.RefreshItemFromCX
+iend
+
+
+;--------------------------------------------------------------------
+; ConvertDriveLetterToBLfromItemIndexInCX
+;	Parameters:
+;		CX:		Item index
+;		SS:BP:	Ptr to DIALOG
+;	Returns:
+;		BL:		Drive letter
+;	Corrupts registers:
+;		AX, CX, DX
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+ConvertDriveLetterToBLfromItemIndexInCX:
+	inc		cx			; Index to count
+	mov		bl, 'A'-1
+	mov		ax, [bp+MENU.dwUserData]
+	mov		dx, [bp+MENU.dwUserData+2]
+ALIGN JUMP_ALIGN
+.CheckNextBit:
+	inc		bx			; Increment drive letter
+	shr		dx, 1
+	rcr		ax, 1
+	jnc		SHORT .CheckNextBit
+	loop	.CheckNextBit
+	ret
Index: trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm	(revision 53)
+++ trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm	(revision 54)
@@ -2,5 +2,5 @@
 ; Project name	:	Assembly Library
 ; Created date	:	6.9.2010
-; Last update	:	13.10.2010
+; Last update	:	24.10.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Displays file dialog.
@@ -49,5 +49,5 @@
 .ItemSelectedFromCX:
 	call	LoadItemStringBufferToESDI
-	call	Memory_CopyESDItoDSSI
+	call	Registers_CopyESDItoDSSI
 	call	ItemLineSplitter_GetLineToDSSIandLengthToCXfromStringInDSSIwithIndexInCX
 	jmp		ParseSelectionFromItemLineInDSSI
@@ -113,7 +113,7 @@
 
 ;--------------------------------------------------------------------
+; ReInitializeMenuinitFromSSBP
 ; InitializeMenuinitFromSSBP
 ;	Parameters:
-;		DS:SI:		Ptr to MENUINIT to initialize (also points to DIALOG)
 ;		SS:BP:		Ptr to DIALOG
 ;	Returns:
@@ -123,4 +123,6 @@
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
+ReInitializeMenuinitFromSSBP:
+	call	DisplayLoadingMessageInInformationArea
 InitializeMenuinitFromSSBP:
 	call	LoadItemStringBufferToESDI
@@ -129,5 +131,6 @@
 	call	SortDirectoryContentsStringFromESDIwithCountInCX
 	call	RemoveLastLFandTerminateESDIwithNull
-	call	Memory_CopySSBPtoDSSI
+
+	call	Registers_CopySSBPtoDSSI
 	xor		ax, ax
 	call	Dialog_EventInitializeMenuinitFromDSSIwithHighlightedItemInAX
@@ -199,5 +202,5 @@
 ALIGN JUMP_ALIGN
 .ClearDLifInRootDirectory:
-	call	Memory_CopyESDItoDSSI
+	call	Registers_CopyESDItoDSSI
 	call	Directory_WriteCurrentPathToDSSI
 	mov		dl, [si]
@@ -375,5 +378,5 @@
 ALIGN JUMP_ALIGN
 SortDirectoryContentsStringFromESDIwithCountInCX:
-	call	Memory_CopyESDItoDSSI
+	call	Registers_CopyESDItoDSSI
 	call	.AddDirectoryContentsStringLengthToDI
 	mov		bx, .FileStringComparator
@@ -431,4 +434,21 @@
 	cmp		bh, bl
 	jmp		SHORT .ReturnFromComparison
+
+
+;--------------------------------------------------------------------
+; RemoveLastLFandTerminateESDIwithNull
+;	Parameters:
+;		ES:DI:	Ptr to end of buffer to terminate
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+RemoveLastLFandTerminateESDIwithNull:
+	dec		di
+	xor		ax, ax
+	stosb
+	ret
 
 
@@ -547,5 +567,5 @@
 ALIGN JUMP_ALIGN
 RefreshFilesToDisplay:
-	call	InitializeMenuinitFromSSBP
+	call	ReInitializeMenuinitFromSSBP
 	jmp		MenuInit_RefreshMenuWindow
 
@@ -661,117 +681,66 @@
 	jz		SHORT ReturnWithoutHandlingKeystroke
 
-	call	.ShowDriveSelectionDialogAndGetDriveNumberToDL
-	jnc		SHORT RefreshFilesToDisplay
+	call	DisplayLoadingMessageInInformationArea
+	mov		cx, DRIVE_DIALOG_IO_size
+	call	Memory_ReserveCXbytesFromStackToDSSI
+	call	.DisplayDriveSelectionDialogWithIoInDSSI
+	call	.ChangeDriveToUserSelectionFromIoInDSSI
+	add		sp, BYTE DRIVE_DIALOG_IO_size
+	ret
+
+;--------------------------------------------------------------------
+; .DisplayDriveSelectionDialogWithIoInDSSI
+;	Parameters:
+;		DS:SI:	Ptr to uninitialized DRIVE_DIALOG_IO
+;		SS:BP:	Ptr to DIALOG
+;	Returns:
+;		DS:SI:	Ptr to DRIVE_DIALOG_IO
+;	Corrupts registers:
+;		AX, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+.DisplayDriveSelectionDialogWithIoInDSSI:
+	call	InitializeNullStringsToDialogInputInDSSI
+	mov		WORD [si+DIALOG_INPUT.fszTitle], g_szSelectNewDrive
+	CALL_MENU_LIBRARY GetDriveWithIoInDSSI
+	ret
+
+;--------------------------------------------------------------------
+; .ChangeDriveToUserSelectionFromIoInDSSI
+;	Parameters:
+;		DS:SI:	Ptr to DRIVE_DIALOG_IO
+;		SS:BP:	Ptr to DIALOG
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		All, except BP
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+.ChangeDriveToUserSelectionFromIoInDSSI:
+	cmp		BYTE [si+DRIVE_DIALOG_IO.bUserCancellation], FALSE
+	jne		SHORT .UserCancelledDriveChange
+
+	mov		dl, [si+DRIVE_DIALOG_IO.bReturnDriveNumber]
 	call	Drive_SetDefaultFromDL
-	jmp		SHORT RefreshFilesToDisplay
-
-;--------------------------------------------------------------------
-; .ShowDriveSelectionDialogAndGetDriveNumberToDL
-;	Parameters:
-;		SS:BP:	Ptr to DIALOG
-;	Returns:
-;		DL:		Drive selected by user
-;		CF:		Set if new drive selected
-;				Cleared if selection cancelled by user
-;	Corrupts registers:
-;		All, except BP
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-.ShowDriveSelectionDialogAndGetDriveNumberToDL:
-	mov		cx, DIALOG_INPUT_size
-	call	Memory_ReserveCXbytesFromStackToDSSI
-	call	.InitializeDialogInputInDSSIforDriveSelection
-	call	DialogSelection_GetSelectionToAXwithInputInDSSI
-	add		sp, BYTE DIALOG_INPUT_size
-	cmp		ax, BYTE NO_ITEM_SELECTED	; Clear CF if equal
-	jne		SHORT .ConvertDriveNumberToDLfromItemIndexInAX
-	ret
-
-ALIGN JUMP_ALIGN
-.InitializeDialogInputInDSSIforDriveSelection:
-	call	InitializeNullStringsToDialogInputInDSSI
-	call	LoadItemStringBufferToESDI
-	mov		WORD [si+DIALOG_INPUT.fszTitle], g_szSelectNewDrive
-	mov		[si+DIALOG_INPUT.fszItems], di
-	mov		[si+DIALOG_INPUT.fszItems+2], es
-	call	Drive_GetFlagsForAvailableDrivesToDXAX
-	; Fall to .GenerateDriveSelectionStringToESDIfromDriveFlagsInDXAX
-
-;--------------------------------------------------------------------
-; .GenerateDriveSelectionStringToESDIfromDriveFlagsInDXAX
-;	Parameters:
-;		DX:AX:	Drive letter flags
-;		ES:DI:	Ptr to item string buffer
-;		SS:BP:	Ptr to DIALOG
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		AX, BX, CX, DX, DI, ES
-;--------------------------------------------------------------------
-;ALIGN JUMP_ALIGN
-.GenerateDriveSelectionStringToESDIfromDriveFlagsInDXAX:
-	cld
-	xchg	cx, ax
-	mov		ax, 3A41h		; A:
-ALIGN JUMP_ALIGN
-.BitShiftLoop:
-	shr		dx, 1
-	rcr		cx, 1
-	jnc		SHORT .CheckIfMoreDrivesLeft
-	stosw
-	mov		BYTE [es:di], LF
-	inc		di
-ALIGN JUMP_ALIGN
-.CheckIfMoreDrivesLeft:
-	inc		ax				; Next drive letter
-	mov		bx, dx
-	or		bx, cx
-	jnz		SHORT .BitShiftLoop
-	jmp		SHORT TerminateESDIwithNull
-
-;--------------------------------------------------------------------
-; .ConvertDriveNumberToDLfromItemIndexInAX
-;	Parameters:
-;		AX:		Selected drive item	
-;	Returns:
-;		DL:		Drive number
-;		CF:		Set since drive selected
-;	Corrupts registers:
-;		AX, CX, DH
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-.ConvertDriveNumberToDLfromItemIndexInAX:
-	mov		ah, -1
-	xchg	cx, ax
-	call	Drive_GetFlagsForAvailableDrivesToDXAX
-ALIGN JUMP_ALIGN
-.BitScanLoop:
-	shr		dx, 1
-	rcr		ax, 1
-	inc		ch				; Increment drive number
-	sbb		cl, 0			; Decrement selection index
-	jnc		SHORT .BitScanLoop
-	mov		dl, ch
-	stc						; Drive selected by user
-	ret
-
-
-;--------------------------------------------------------------------
-; RemoveLastLFandTerminateESDIwithNull
-; TerminateESDIwithNull
-;	Parameters:
-;		ES:DI:	Ptr to end of buffer to terminate
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		AX
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-RemoveLastLFandTerminateESDIwithNull:
-	dec		di
-ALIGN JUMP_ALIGN
-TerminateESDIwithNull:
-	xor		ax, ax
-	stosb
+	jmp		RefreshFilesToDisplay
+.UserCancelledDriveChange:
+	ret
+
+
+;--------------------------------------------------------------------
+; DisplayLoadingMessageInInformationArea
+;	Parameters:
+;		SS:BP:		Ptr to DIALOG
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX, BX, CX, DX, SI, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+DisplayLoadingMessageInInformationArea:
+	call	MenuText_ClearInformationArea
+	call	MenuText_PrepareToDrawInformationArea
+	mov		si, g_szLoadingPleaseWait
+	CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
 	ret
 
Index: trunk/Assembly_Library/Src/Menu/Dialog/StringsForDialogs.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/Dialog/StringsForDialogs.asm	(revision 53)
+++ trunk/Assembly_Library/Src/Menu/Dialog/StringsForDialogs.asm	(revision 54)
@@ -2,5 +2,5 @@
 ; Project name	:	Assembly Library
 ; Created date	:	14.9.2010
-; Last update	:	1.10.2010
+; Last update	:	23.10.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Strings used by dialogs.
@@ -11,4 +11,7 @@
 g_szTimeFormat:			db	" %2-u min %2-u sec",LF,CR,NULL
 
+; Strings for Drive Dialog
+g_szDriveFormat:		db	"%c:",NULL
+
 ; Strings for File Dialog
 g_szChangeDrive:		db	"F2 Change Drive",LF,CR,NULL
@@ -18,4 +21,6 @@
 g_szSelectNewDrive:
 	db		"Select new drive.",NULL
+g_szLoadingPleaseWait:
+	db		"Loading. Please wait...",NULL
 
 g_szEnterNewFileOrDirectory:
Index: trunk/Assembly_Library/Src/Menu/Menu.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/Menu.asm	(revision 53)
+++ trunk/Assembly_Library/Src/Menu/Menu.asm	(revision 54)
@@ -2,5 +2,5 @@
 ; Project name	:	Assembly Library
 ; Created date	:	3.8.2010
-; Last update	:	7.10.2010
+; Last update	:	23.10.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Menu Library functions for CALL_MENU_LIBRARY macro
@@ -69,4 +69,5 @@
 	at	MENU_LIB.GetStringWithIoInDSSI,							dw	DialogString_GetStringWithIoInDSSI
 	at	MENU_LIB.GetFileNameWithIoInDSSI,						dw	DialogFile_GetFileNameWithIoInDSSI
+	at	MENU_LIB.GetDriveWithIoInDSSI,							dw	DialogDrive_GetDriveWithIoInDSSI
 %endif
 iend
Index: trunk/Assembly_Library/Src/Menu/MenuText.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/MenuText.asm	(revision 53)
+++ trunk/Assembly_Library/Src/Menu/MenuText.asm	(revision 54)
@@ -2,5 +2,5 @@
 ; Project name	:	Assembly Library
 ; Created date	:	21.7.2010
-; Last update	:	12.10.2010
+; Last update	:	24.10.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Functions for drawing menu texts by the user.
@@ -27,9 +27,9 @@
 ALIGN JUMP_ALIGN
 MenuText_ClearInformationArea:
-	call	PrepareToDrawInformationArea
+	call	MenuText_PrepareToDrawInformationArea
 	mov		cl, [bp+MENUINIT.bInfoLines]
 ClearCLlinesOfText:
 	mov		al, [bp+MENUINIT.bWidth]
-	sub		al, MENU_HORIZONTAL_BORDER_LINES+MENU_TEXT_COLUMN_OFFSET
+	sub		al, MENU_HORIZONTAL_BORDER_LINES+(MENU_TEXT_COLUMN_OFFSET/2)
 	mul		cl
 	xchg	cx, ax
@@ -60,5 +60,5 @@
 	cmp		BYTE [bp+MENUINIT.bInfoLines], 0
 	jz		SHORT NothingToRefresh
-	call	PrepareToDrawInformationArea
+	call	MenuText_PrepareToDrawInformationArea
 	jmp		MenuEvent_RefreshInformation
 
@@ -80,5 +80,5 @@
 
 ALIGN JUMP_ALIGN
-PrepareToDrawInformationArea:
+MenuText_PrepareToDrawInformationArea:
 	mov		si, ATTRIBUTE_CHARS.cInformation
 	call	MenuLocation_GetInformationTextTopLeftCoordinatesToAX
Index: trunk/Assembly_Library/Src/String/String.asm
===================================================================
--- trunk/Assembly_Library/Src/String/String.asm	(revision 53)
+++ trunk/Assembly_Library/Src/String/String.asm	(revision 54)
@@ -2,5 +2,5 @@
 ; Project name	:	Assembly Library
 ; Created date	:	12.7.2010
-; Last update	:	13.10.2010
+; Last update	:	24.10.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Functions for handling characters.
@@ -106,10 +106,10 @@
 	push	si
 
-	call	Memory_ExchangeDSSIwithESDI
+	call	Registers_ExchangeDSSIwithESDI
 	xor		ax, ax		; Find NULL
 	mov		cx, -1		; Full segment if necessary
 	repne scasb
 	mov		cx, di
-	call	Memory_ExchangeDSSIwithESDI
+	call	Registers_ExchangeDSSIwithESDI
 
 	pop		si
Index: trunk/Assembly_Library/Src/Util/Memory.asm
===================================================================
--- trunk/Assembly_Library/Src/Util/Memory.asm	(revision 53)
+++ trunk/Assembly_Library/Src/Util/Memory.asm	(revision 54)
@@ -2,5 +2,5 @@
 ; Project name	:	Assembly Library
 ; Created date	:	14.7.2010
-; Last update	:	11.10.2010
+; Last update	:	24.10.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Functions for memory access.
@@ -70,5 +70,5 @@
 	push	di
 	push	ax
-	call	Memory_CopySSBPtoESDI
+	call	Registers_CopySSBPtoESDI
 	call	Memory_ZeroESDIwithSizeInCX
 	pop		ax
@@ -110,82 +110,4 @@
 
 ;--------------------------------------------------------------------
-; Memory_ExchangeDSSIwithESDI
-;	Parameters
-;		Nothing
-;	Returns:
-;		DS:SI and ES:DI are exchanged.
-;	Corrupts registers:
-;		Nothing
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-Memory_ExchangeDSSIwithESDI:
-	push	ds
-	push	es
-	pop		ds
-	pop		es
-	xchg	si, di
-	ret
-
-
-;--------------------------------------------------------------------
-; Memory_CopySSBPtoESDI
-; Memory_CopySSBPtoDSSI
-; Memory_CopyDSSItoESDI
-; Memory_CopyESDItoDSSI
-;	Parameters
-;		Nothing
-;	Returns:
-;		Copies farm pointer to different segment/pointer register pair
-;	Corrupts registers:
-;		Nothing
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-Memory_CopySSBPtoESDI:
-	push	ss
-	pop		es
-	mov		di, bp
-	ret
-
-ALIGN JUMP_ALIGN
-Memory_CopySSBPtoDSSI:
-	push	ss
-	pop		ds
-	mov		si, bp
-	ret
-
-ALIGN JUMP_ALIGN
-Memory_CopyDSSItoESDI:
-	push	ds
-	pop		es
-	mov		di, si
-	ret
-
-ALIGN JUMP_ALIGN
-Memory_CopyESDItoDSSI:
-	push	es
-	pop		ds
-	mov		si, di
-	ret
-
-
-;--------------------------------------------------------------------
-; Memory_SetZFifNullPointerInDSSI
-;	Parameters
-;		DS:SI:	Far pointer
-;	Returns:
-;		ZF:		Set if NULL pointer in DS:SI
-;	Corrupts registers:
-;		Nothing
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-Memory_SetZFifNullPointerInDSSI:
-	push	ax
-	mov		ax, ds
-	or		ax, si
-	pop		ax
-	ret
-
-
-;--------------------------------------------------------------------
 ; Memory_ReserveCXbytesFromStackToDSSI
 ;	Parameters
Index: trunk/Assembly_Library/Src/Util/Registers.asm
===================================================================
--- trunk/Assembly_Library/Src/Util/Registers.asm	(revision 54)
+++ trunk/Assembly_Library/Src/Util/Registers.asm	(revision 54)
@@ -0,0 +1,86 @@
+; File name		:	Registers.asm
+; Project name	:	Assembly Library
+; Created date	:	24.10.2010
+; Last update	:	24.10.2010
+; Author		:	Tomi Tilli
+; Description	:	Functions for register operations.
+
+; Section containing code
+SECTION .text
+
+;--------------------------------------------------------------------
+; Registers_ExchangeDSSIwithESDI
+;	Parameters
+;		Nothing
+;	Returns:
+;		DS:SI and ES:DI are exchanged.
+;	Corrupts registers:
+;		Nothing
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+Registers_ExchangeDSSIwithESDI:
+	push	ds
+	push	es
+	pop		ds
+	pop		es
+	xchg	si, di
+	ret
+
+
+;--------------------------------------------------------------------
+; Registers_CopySSBPtoESDI
+; Registers_CopySSBPtoDSSI
+; Registers_CopyDSSItoESDI
+; Registers_CopyESDItoDSSI
+;	Parameters
+;		Nothing
+;	Returns:
+;		Copies farm pointer to different segment/pointer register pair
+;	Corrupts registers:
+;		Nothing
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+Registers_CopySSBPtoESDI:
+	push	ss
+	pop		es
+	mov		di, bp
+	ret
+
+ALIGN JUMP_ALIGN
+Registers_CopySSBPtoDSSI:
+	push	ss
+	pop		ds
+	mov		si, bp
+	ret
+
+ALIGN JUMP_ALIGN
+Registers_CopyDSSItoESDI:
+	push	ds
+	pop		es
+	mov		di, si
+	ret
+
+ALIGN JUMP_ALIGN
+Registers_CopyESDItoDSSI:
+	push	es
+	pop		ds
+	mov		si, di
+	ret
+
+
+;--------------------------------------------------------------------
+; Registers_SetZFifNullPointerInDSSI
+;	Parameters
+;		DS:SI:	Far pointer
+;	Returns:
+;		ZF:		Set if NULL pointer in DS:SI
+;	Corrupts registers:
+;		Nothing
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+Registers_SetZFifNullPointerInDSSI:
+	push	ax
+	mov		ax, ds
+	or		ax, si
+	pop		ax
+	ret
Index: trunk/Assembly_Library/Src/Util/Sort.asm
===================================================================
--- trunk/Assembly_Library/Src/Util/Sort.asm	(revision 53)
+++ trunk/Assembly_Library/Src/Util/Sort.asm	(revision 54)
@@ -2,5 +2,5 @@
 ; Project name	:	Assembly Library
 ; Created date	:	28.9.2010
-; Last update	:	1.10.2010
+; Last update	:	24.10.2010
 ; Author		:	Tomi Tilli
 ; Description	:	Sorting algorithms
@@ -230,5 +230,5 @@
 
 	; Item DX to Item AX
-	call	Memory_ExchangeDSSIwithESDI
+	call	Registers_ExchangeDSSIwithESDI
 	call	GetItemPointerToDSSIfromIndexInDX
 	call	CopyItemFromDSSItoESDI
@@ -236,5 +236,5 @@
 	; Stack to Item DX
 	call	GetPointerToTemporaryItemToESDI
-	call	Memory_ExchangeDSSIwithESDI
+	call	Registers_ExchangeDSSIwithESDI
 	call	CopyItemFromDSSItoESDI
 
