Index: trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/IdeControllerMenu.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/IdeControllerMenu.asm	(revision 233)
+++ trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/IdeControllerMenu.asm	(revision 242)
@@ -98,5 +98,5 @@
 	at	MENUITEM.szHelp,			dw	g_szHelpIdeSerialCOM
 	at	MENUITEM.bFlags,			db	FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_BYTEVALUE | FLG_MENUITEM_CHOICESTRINGS
-	at	MENUITEM.bType,				db	TYPE_MENUITEM_MULTICHOICE 
+	at	MENUITEM.bType,				db	TYPE_MENUITEM_MULTICHOICE
 	at	MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,		dw	NULL
 	at	MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,				dw	g_szDlgDevice
@@ -122,7 +122,7 @@
 	at	MENUITEM.itemValue + ITEM_VALUE.fnValueReader,				dw	IdeControllerMenu_SerialReadPort
 	at	MENUITEM.itemValue + ITEM_VALUE.fnValueWriter,				dw	IdeControllerMenu_SerialWritePort
-iend		
-
-g_MenuitemIdeControllerSerialBaud:		
+iend
+
+g_MenuitemIdeControllerSerialBaud:
 istruc MENUITEM
 	at	MENUITEM.fnActivate,		dw	Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
@@ -139,5 +139,5 @@
 	at	MENUITEM.itemValue + ITEM_VALUE.rgszChoiceToStringLookup,	dw	g_rgszChoiceToStringLookupForBaud
 iend
-		
+
 g_MenuitemIdeControllerEnableInterrupt:
 istruc MENUITEM
@@ -200,5 +200,5 @@
 	dw	'C'
 	dw	'x'				; must be last entry (see reader/write routines)
-g_rgszChoiceToStringLookupForCOM:		
+g_rgszChoiceToStringLookupForCOM:
 	dw	g_szValueCfgCOM1
 	dw	g_szValueCfgCOM2
@@ -220,18 +220,18 @@
 PackedCOMPortAddresses:				; COM1 - COMC (or COM12)
 	db      DEVICE_SERIAL_COM1 >> 2
-	db		DEVICE_SERIAL_COM2 >> 2 
-	db		DEVICE_SERIAL_COM3 >> 2 
-	db		DEVICE_SERIAL_COM4 >> 2 
-	db		DEVICE_SERIAL_COM5 >> 2 
-	db		DEVICE_SERIAL_COM6 >> 2 
-	db		DEVICE_SERIAL_COM7 >> 2 
-	db		DEVICE_SERIAL_COM8 >> 2 
-	db		DEVICE_SERIAL_COM9 >> 2 
-	db		DEVICE_SERIAL_COMA >> 2 
-	db		DEVICE_SERIAL_COMB >> 2 
+	db		DEVICE_SERIAL_COM2 >> 2
+	db		DEVICE_SERIAL_COM3 >> 2
+	db		DEVICE_SERIAL_COM4 >> 2
+	db		DEVICE_SERIAL_COM5 >> 2
+	db		DEVICE_SERIAL_COM6 >> 2
+	db		DEVICE_SERIAL_COM7 >> 2
+	db		DEVICE_SERIAL_COM8 >> 2
+	db		DEVICE_SERIAL_COM9 >> 2
+	db		DEVICE_SERIAL_COMA >> 2
+	db		DEVICE_SERIAL_COMB >> 2
 	db		DEVICE_SERIAL_COMC >> 2
 	db		DEVICE_SERIAL_DEFAULT_CUSTOM_PORT >> 2			; must be last entry (see reader/writer routines)
 DEVICE_SERIAL_DEFAULT_COM			EQU		'1'
-		
+
 g_rgbChoiceToValueLookupForBaud:
 	dw		(115200 / 115200) & 0xff
@@ -280,16 +280,16 @@
 	lea		ax, [bx+IDEVARS.wPort]
 	mov		[cs:g_MenuitemIdeControllerCommandBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
-		
-	lea		ax, [bx+IDEVARS.bSerialPort]		
+
+	lea		ax, [bx+IDEVARS.bSerialPort]
 	mov		[cs:g_MenuitemIdeControllerSerialPort+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
 
 	lea		ax, [bx+IDEVARS.bSerialBaud]
 	mov		[cs:g_MenuitemIdeControllerSerialBaud+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
-		
+
 	lea		ax, [bx+IDEVARS.wPortCtrl]
 	mov		[cs:g_MenuitemIdeControllerControlBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
-		
+
 	lea		ax, [bx+IDEVARS.bSerialCOMPortChar]
-	mov		[cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax				
+	mov		[cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
 
 	lea		ax, [bx+IDEVARS.bIRQ]
@@ -374,6 +374,6 @@
 	mov		bx, g_MenuitemIdeControllerSerialPort
 	call	.DisableMenuitemFromCSBX
-				
-	mov		bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]		
+
+	mov		bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
 	call	Buffers_GetRomvarsValueToAXfromOffsetInBX
 	cmp		al,DEVICE_SERIAL_PORT
@@ -386,5 +386,5 @@
 	call	.EnableMenuitemFromCSBX
 
-	mov		bx, [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]			
+	mov		bx, [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
 	call	Buffers_GetRomvarsValueToAXfromOffsetInBX
 	mov		bx, g_MenuitemIdeControllerSerialPort
@@ -402,8 +402,8 @@
 
 	mov		bx, g_MenuitemIdeControllerEnableInterrupt
-	call	.EnableMenuitemFromCSBX				
+	call	.EnableMenuitemFromCSBX
 
 	ret
-		
+
 ;--------------------------------------------------------------------
 ; MENUITEM activation functions (.fnActivate)
@@ -431,5 +431,5 @@
 ;
 	push	bx
-	mov		bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]		
+	mov		bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
 	call	Buffers_GetRomvarsValueToAXfromOffsetInBX
 	mov		bx, g_MenuitemMasterSlaveBlockModeTransfers
@@ -438,9 +438,9 @@
 	or		BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
 	jmp		.isDone
-.isSerial:		
+.isSerial:
 	and		BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
 .isDone:
 	pop		bx
-			
+
 	call	MasterSlaveMenu_InitializeToDrvparamsOffsetInBX
 	jmp		MasterSlaveMenu_EnterMenuOrModifyItemVisibility
@@ -453,5 +453,5 @@
 ; we need to take care to properly read/write just the bits we need.  In addition, since
 ; we use the Port/PortCtrl bytes in a special way for serial drives, we need to properly
-; default the values stored in both these words  when switching in and out of the Serial 
+; default the values stored in both these words when switching in and out of the Serial
 ; device choice.
 ;
@@ -479,6 +479,5 @@
 ;
 ; No change to Device byte, but use this opportunity to change defaults stored in wPort and wPortCtrl if we are
-; changing in/out of a Serial device (since we use these bytes in radically different ways).  Also clear the
-; interrupt informtion is we are moving into Serial (since the serial device does not use interrupts).
+; changing in/out of a Serial device (since we use these bytes in radically different ways).
 ;
 ALIGN JUMP_ALIGN
@@ -489,7 +488,7 @@
 
 		mov		bl,[es:di]							; what is the current Device?
-		
+
 		add		di,IDEVARS.wPort - IDEVARS.bDevice	; Get ready to set the Port addresses
-		
+
 		cmp		al,DEVICE_SERIAL_PORT
 		jz		.changingToSerial
@@ -500,21 +499,21 @@
 .changingFromSerial:
 		cmp		al,DEVICE_16BIT_ATA
-		jl		.xtide
+
+		mov		ax,DEVICE_XTIDE_DEFAULT_PORT		; Defaults for 8-bit XTIDE devices
+		mov		bx,DEVICE_XTIDE_DEFAULT_PORTCTRL
+
+		jb		.writeNonSerial
 
 		mov		ax,DEVICE_ATA_DEFAULT_PORT			; Defaults for 16-bit and better ATA devices
 		mov		bx,DEVICE_ATA_DEFAULT_PORTCTRL
-		jmp		.writeNonSerial
-
-.xtide:	
-		mov		ax,DEVICE_XTIDE_DEFAULT_PORT		; Defaults for 8-bit XTIDE devices
-		mov		bx,DEVICE_XTIDE_DEFAULT_PORTCTRL		
-
-.writeNonSerial:		
-		mov		[es:di],ax							; Store defaults in IDEVARS.wPort and IDEVARS.wPortCtrl
-		mov		[es:di+2],bx
+
+.writeNonSerial:
+		stosw										; Store defaults in IDEVARS.wPort and IDEVARS.wPortCtrl
+		xchg	bx, ax
+		stosw
 
 		jmp		.done
 
-.changingToSerial:		
+.changingToSerial:
 		cmp		bl,DEVICE_SERIAL_PORT
 		jz		.done								; if we were already serial, nothing to do
@@ -525,7 +524,7 @@
 		add		di,IDEVARS.bSerialCOMPortChar-IDEVARS.wPort
 		call	IdeControllerMenu_SerialWriteCOM
-		mov		[es:di],al
-				
-.done:	
+		stosb
+
+.done:
 		pop		di
 		pop		bx
@@ -536,6 +535,6 @@
 ;
 ; Doesn't modify COM character (unless it is not recognized, which would be an error case),
-; But does update the port address based on COM port selection  
-;				
+; But does update the port address based on COM port selection
+;
 ALIGN JUMP_ALIGN
 IdeControllerMenu_SerialWriteCOM:
@@ -543,5 +542,5 @@
 		push	bx
 		push	si
-		
+
 		mov		si,g_rgbChoiceToValueLookupForCOM
 		mov		bx,PackedCOMPortAddresses
@@ -552,18 +551,18 @@
 		cmp		ah,(DEVICE_SERIAL_DEFAULT_CUSTOM_PORT >> 2)
 		jz		.notFound
-		
+
 		cmp		al,[si]
 		jz		.found
-		
+
 		inc		si
 		inc		si
 		inc		bx
-		
+
 		jmp		.loop
 
 .notFound:
 		mov		al, 'x'
-		
-.found:			
+
+.found:
 		mov		[es:di+IDEVARS.bSerialPort-IDEVARS.bSerialCOMPortChar], ah
 
@@ -571,16 +570,15 @@
 		pop		bx
 		pop		ax
-		
+
 		ret
-		
+
 
 ;
 ; Packed Port (byte) -> Numeric Port (word)
-;				
+;
 ALIGN JUMP_ALIGN
 IdeControllerMenu_SerialReadPort:
 		xor		ah,ah
-		shl		ax,1
-		shl		ax,1
+		eSHL_IM	ax, 2
 		ret
 
@@ -590,13 +588,12 @@
 ;
 ALIGN JUMP_ALIGN
-IdeControllerMenu_SerialWritePort:		
+IdeControllerMenu_SerialWritePort:
 		push	bx
 		push	si
 
-		shr		ax,1
-		shr		ax,1
+		eSHR_IM	ax, 2
 		and		al,0feh			; force 8-byte boundary
 
-		mov		si,g_rgbChoiceToValueLookupForCOM						
+		mov		si,g_rgbChoiceToValueLookupForCOM
 		mov		bx,PackedCOMPortAddresses			; loop, looking for port address in known COM address list
 
@@ -605,15 +602,15 @@
 		cmp		ah,'x'
 		jz		.found
-				
+
 		cmp		al,[bx]
 		jz		.found
-		
+
 		inc		si
 		inc		si
 		inc		bx
-		
+
 		jmp		.loop
 
-.found:	
+.found:
 		mov		[es:di+IDEVARS.bSerialCOMPortChar-IDEVARS.bSerialPort], ah
 
@@ -623,8 +620,2 @@
 		ret
 
-
-
-
-
-
-
Index: trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Strings.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Strings.asm	(revision 233)
+++ trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Strings.asm	(revision 242)
@@ -14,5 +14,5 @@
 g_szUnidentified:					db	"Unidentified",NULL
 g_szUnsaved:						db	" ",SINGLE_LEFT_HORIZONTAL_TO_VERTICAL,
-									db	"Unsaved",SINGLE_RIGHT_HORIZONTAL_TO_VERTICAL, NULL
+									db	"Unsaved",SINGLE_RIGHT_HORIZONTAL_TO_VERTICAL,NULL
 
 ; Item formatting
@@ -124,5 +124,5 @@
 g_szDlgIdeEnIRQ:		db	"Enable interrupt?",NULL
 g_szDlgIdeIRQ:			db	"Enter IRQ channel (2...7 for 8-bit controllers, 2...15 for any other controller).",NULL
-		
+
 g_szNfoIdeBackToCfgMenu:db	"Back to XTIDE Universal BIOS Configuration Menu.",NULL
 g_szNfoIdeMaster:		db	"Settings for Master Drive.",NULL
@@ -135,5 +135,5 @@
 g_szNfoIdeSerialCOM:	db	"Select a COM port by number.",NULL
 g_szNfoIdeSerialBaud:	db	"Select the COM port's Baud Rate. The server must match this speed. Note that UART clock multipliers may impact the actual speed.",NULL
-g_szNfoIdeSerialPort:	db	"Select a COM port by custom I/O port address. Any address is valud up to 3f8h, but must be on an 8-byte boundary.", NULL
+g_szNfoIdeSerialPort:	db	"Select a COM port by custom I/O port address. Any address is valid up to 3f8h, but must be on an 8-byte boundary.",NULL
 
 g_szHelpIdeCmdPort:		incbin	"IDE_CommandPort.txt"
@@ -188,5 +188,5 @@
 g_szValueCfgCOMC:		db		"COMC",NULL
 g_szValueCfgCOMx:		db		"Custom",NULL
-		
+
 g_szSerialBaudChoice:
 						db  "115.2K baud",LF
@@ -196,5 +196,5 @@
 						db  "19.2K baud",LF
 						db	"9600 baud",LF
-						db  "4800 baud",LF		
+						db  "4800 baud",LF
 						db  "2400 baud",NULL
 
@@ -205,8 +205,8 @@
 g_szValueCfgBaud19_2:	db		"19.2K",NULL
 g_szValueCfgBaud9600:	db		"9600",NULL
-g_szValueCfgBaud4800:	db		"4800",NULL		
+g_szValueCfgBaud4800:	db		"4800",NULL
 g_szValueCfgBaud2400:	db		"2400",NULL
 
-		
+
 g_szValueCfgDeviceDual8b:	db	"XTIDE",NULL
 g_szValueCfgDeviceMod:		db	"Chuck(G)",NULL
@@ -257,5 +257,5 @@
 g_szDlgBootSwap:		db	"Enable drive number translation?",NULL
 g_szDlgSerialDetect:	db	"Scan for serial drives?",NULL
-		
+
 g_szNfoBootTimeout:		db	"Menu item selection timeout in BIOS timer ticks.",NULL
 g_szNfoBootDrive:		db	"Default drive on boot menu.",NULL
@@ -375,4 +375,2 @@
 g_szValueUnknownError:	db	"Error!",NULL
 
-
-
