Index: trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/BootMenuSettingsMenu.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/BootMenuSettingsMenu.asm	(revision 589)
+++ trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/BootMenuSettingsMenu.asm	(revision 592)
@@ -1,4 +1,4 @@
 ; Project name	:	XTIDE Universal BIOS Configurator v2
-; Description	:	"Boot Menu Settings" menu structs and functions.
+; Description	:	"Boot settings" menu structs and functions.
 
 ;
@@ -26,5 +26,5 @@
 	at	MENUPAGE.fnEnter,			dw	BootMenuSettingsMenu_EnterMenuOrModifyItemVisibility
 	at	MENUPAGE.fnBack,			dw	ConfigurationMenu_EnterMenuOrModifyItemVisibility
-	at	MENUPAGE.wMenuitems,		dw	6
+	at	MENUPAGE.wMenuitems,		dw	7
 iend
 
@@ -55,4 +55,22 @@
 iend
 
+g_MenuitemBootMnuStngsColorTheme:
+istruc MENUITEM
+	at	MENUITEM.fnActivate,		dw	Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
+	at	MENUITEM.fnFormatValue,		dw	MenuitemPrint_WriteLookupValueStringToBufferInESDIfromUnshiftedItemInDSSI
+	at	MENUITEM.szName,			dw	g_szItemColorTheme
+	at	MENUITEM.szQuickInfo,		dw	g_szNfoColorTheme
+	at	MENUITEM.szHelp,			dw	g_szHelpColorTheme
+	at	MENUITEM.bFlags,			db	FLG_MENUITEM_VISIBLE | FLG_MENUITEM_MODIFY_MENU
+	at	MENUITEM.bType,				db	TYPE_MENUITEM_MULTICHOICE
+	at	MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,		dw	ROMVARS.pColorTheme		; Only ever read - never modified
+	at	MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,				dw	g_szDlgColorTheme
+	at	MENUITEM.itemValue + ITEM_VALUE.szMultichoice,				dw	g_szMultichoiceColorTheme
+	at	MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup,		dw	NULL
+	at	MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup,	dw	g_rgszValueToStringLookupForColorTheme
+	at	MENUITEM.itemValue + ITEM_VALUE.fnValueReader,				dw	ReadColorTheme
+	at	MENUITEM.itemValue + ITEM_VALUE.fnValueWriter,				dw	WriteColorTheme
+iend
+
 g_MenuitemBootMnuStngsFloppyDrives:
 istruc MENUITEM
@@ -116,9 +134,4 @@
 	at	MENUITEM.itemValue + ITEM_VALUE.wMaxValue,					dw	1092
 iend
-
-
-g_rgwChoiceToValueLookupForEnableBootMenu:
-	dw	FALSE
-	dw	BOOT_MENU_DEFAULT_TIMEOUT
 
 g_rgwChoiceToValueLookupForDisplayModes:
@@ -146,4 +159,64 @@
 	dw	g_szValueBootFloppyDrvs4
 
+g_rgszValueToStringLookupForColorTheme:
+	dw	g_szValueColorTheme0
+	dw	g_szValueColorTheme1
+	dw	g_szValueColorTheme2
+	dw	g_szValueColorTheme3
+	dw	g_szValueColorTheme4
+	dw	g_szValueColorTheme5
+
+ColorThemeTable:
+	; Classic (default)
+	db	COLOR_ATTRIBUTE(COLOR_YELLOW, COLOR_BLUE)							; .cBordersAndBackground
+	db	COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)							; .cShadow
+	db	COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLUE)						; .cTitle
+	db	COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLUE)							; .cItem
+	db	COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_CYAN)						; .cHighlightedItem
+	db	COLOR_ATTRIBUTE(COLOR_RED, COLOR_BLUE) | FLG_COLOR_BLINK			; .cHurryTimeout
+	db	COLOR_ATTRIBUTE(COLOR_GREEN, COLOR_BLUE)							; .cNormalTimeout
+	; Argon Blue
+	db	COLOR_ATTRIBUTE(COLOR_LIGHT_BLUE, COLOR_BLACK)						; .cBordersAndBackground
+	db	COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)							; .cShadow
+	db	COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK)					; .cTitle
+	db	COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK)							; .cItem
+	db	COLOR_ATTRIBUTE(COLOR_LIGHT_BLUE, COLOR_BLACK)						; .cHighlightedItem
+	db	COLOR_ATTRIBUTE(COLOR_LIGHT_BLUE, COLOR_BLACK) | FLG_COLOR_BLINK	; .cHurryTimeout
+	db	COLOR_ATTRIBUTE(COLOR_LIGHT_BLUE, COLOR_BLACK)						; .cNormalTimeout
+	; Neon Red
+	db	COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK)						; .cBordersAndBackground
+	db	COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)							; .cShadow
+	db	COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK)					; .cTitle
+	db	COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK)							; .cItem
+	db	COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK)						; .cHighlightedItem
+	db	COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK) | FLG_COLOR_BLINK		; .cHurryTimeout
+	db	COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK)						; .cNormalTimeout
+	; Phosphor Green
+	db	COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK)						; .cBordersAndBackground
+	db	COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)							; .cShadow
+	db	COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK)					; .cTitle
+	db	COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK)							; .cItem
+	db	COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK)						; .cHighlightedItem
+	db	COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK) | FLG_COLOR_BLINK	; .cHurryTimeout
+	db	COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK)						; .cNormalTimeout
+	; Moon Surface
+	db	COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)							; .cBordersAndBackground
+	db	COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)							; .cShadow
+	db	COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK)					; .cTitle
+	db	COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK)							; .cItem
+	db	COLOR_ATTRIBUTE(COLOR_BROWN, COLOR_BLACK)							; .cHighlightedItem
+	db	COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) | FLG_COLOR_BLINK	; .cHurryTimeout
+	db	COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK)							; .cNormalTimeout
+	; Toxic Waste
+	db	COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK)						; .cBordersAndBackground
+	db	COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)							; .cShadow
+	db	COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK)						; .cTitle
+	db	COLOR_ATTRIBUTE(COLOR_LIGHT_CYAN, COLOR_BLACK)						; .cItem
+	db	COLOR_ATTRIBUTE(COLOR_LIGHT_CYAN, COLOR_BLUE)						; .cHighlightedItem
+	db	COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK) | FLG_COLOR_BLINK		; .cHurryTimeout
+	db	COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK)						; .cNormalTimeout
+EndOfColorThemeTable:
+CountOfThemes	equ		(EndOfColorThemeTable-ColorThemeTable) / ATTRIBUTE_CHARS_size
+
 
 ; Section containing code
@@ -166,4 +239,5 @@
 	call	.EnableOrDisableScanForSerialDrives
 	call	.EnableOrDisableDefaultBootDrive
+	call	.EnableOrDisableColorThemeSelection
 	call	.EnableOrDisableBootMenuSelectionTimeout
 	mov		si, g_MenupageForBootMenuSettingsMenu
@@ -202,4 +276,21 @@
 	mov		bx, g_MenuitemBootMnuStngsDefaultBootDrive
 	test	ax, FLG_ROMVARS_MODULE_HOTKEYS | FLG_ROMVARS_MODULE_BOOT_MENU
+	jmp		SHORT .DisableMenuitemFromCSBXifZFset
+
+
+;--------------------------------------------------------------------
+; .EnableOrDisableColorThemeSelection
+;	Parameters:
+;		AX:		ROMVARS.wFlags
+;		SS:BP:	Menu handle
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		BX
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+.EnableOrDisableColorThemeSelection:
+	mov		bx, g_MenuitemBootMnuStngsColorTheme
+	test	ax, FLG_ROMVARS_MODULE_BOOT_MENU
 	jmp		SHORT .DisableMenuitemFromCSBXifZFset
 
@@ -244,19 +335,92 @@
 
 ;--------------------------------------------------------------------
-; MENUITEM value reader functions
-;	Parameters:
-;		AX:		Value from MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset
-;		DS:SI:	Ptr to MENUITEM
-;		ES:DI:	Ptr to value variable
-;	Returns:
-;		AX:		Value with possible modifications
-;	Corrupts registers:
-;		Nothing
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-ValueReaderForEnableBootMenu:
-	test	ax, ax
-	jz		SHORT .NoNeedToModify
-	mov		ax, TRUE<<1
-.NoNeedToModify:
+; ReadColorTheme
+;	Parameters:
+;		AX:		Value read from the ROMVARS location
+;		ES:DI:	ROMVARS location where the value was just read from
+;		DS:SI:	MENUITEM pointer
+;	Returns:
+;		AX:		Value that the MENUITEM system will interact with and display
+;	Corrupts registers:
+;		BX, DI, ES
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+ReadColorTheme:
+	push	ds
+
+	push	es							; ES -> DS
+	pop		ds
+	push	cs							; CS -> ES
+	pop		es
+
+	mov		di, EndOfColorThemeTable-1	; ES:DI now points to the end of the last theme in the table of available themes in XTIDECFG
+	xor		bx, bx
+
+	push	si
+	push	cx
+	mov		cx, CountOfThemes
+	std
+.NextTheme:
+	push	cx
+	mov		cl, ATTRIBUTE_CHARS_size
+	mov		si, ax						; [ROMVARS.pColorTheme] to SI
+	dec		si
+	add		si, cx						; DS:SI now points to the end of the ColorTheme in the loaded BIOS
+	sub		di, bx						; Update the pointer to the end of the next theme in the table
+
+	; We verify that the theme in the loaded BIOS exists in our table. If it doesn't exist then that most likely means
+	; the loaded BIOS doesn't contain MODULE_BOOT_MENU and the theme actually isn't a theme - it's code. Either way,
+	; we don't trust it enough to copy it over as corrupt/invalid settings could render the UI in XTIDECFG unreadable.
+	repe	cmpsb
+	mov		bx, cx
+	pop		cx
+	loopne	.NextTheme
+	cld
+	mov		ax, cx
+	jne		SHORT .SkipCopy
+
+	; Copy the color theme fron the loaded BIOS overwriting XTIDECFG's own theme
+	inc		si
+	mov		di, ColorTheme				; ES:DI now points to ColorTheme in XTIDECFG
+
+	mov		cl, ATTRIBUTE_CHARS_size
+	call	Memory_CopyCXbytesFromDSSItoESDI
+
+.SkipCopy:
+	pop		cx
+	pop		si
+	pop		ds
 	ret
+
+
+;--------------------------------------------------------------------
+; WriteColorTheme
+;	Parameters:
+;		AX:		Value that the MENUITEM system was interacting with
+;		ES:DI:	ROMVARS location where the value is to be stored
+;		DS:SI:	MENUITEM pointer
+;	Returns:
+;		AX:		Value to actually write to ROMVARS
+;	Corrupts registers:
+;		Nothing
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+WriteColorTheme:
+	push	cx
+	push	si
+	push	di
+
+	mov		cx, ATTRIBUTE_CHARS_size
+	mul		cl							; Multiply with the menu choice index
+	mov		si, ColorThemeTable
+	add		si, ax
+	mov		ax, [es:di]					; Fetch the ptr to ColorTheme
+	mov		di, ax
+
+	call	Memory_CopyCXbytesFromDSSItoESDI
+
+	pop		di
+	pop		si
+	pop		cx
+	ret
+
Index: trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/ConfigurationMenu.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/ConfigurationMenu.asm	(revision 589)
+++ trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/ConfigurationMenu.asm	(revision 592)
@@ -245,5 +245,5 @@
 ;		Nothing
 ;	Corrupts registers:
-;		BX, DI, ES
+;		BX
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
@@ -262,5 +262,5 @@
 ;		Nothing
 ;	Corrupts registers:
-;		AX, BX, CX
+;		AX, BX
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
@@ -268,5 +268,5 @@
 	call	Buffers_GetRomvarsFlagsToAX
 	mov		bx, g_MenuitemConfigurationKiBtoStealFromRAM
-	test	ax, FLG_ROMVARS_FULLMODE
+	test	al, FLG_ROMVARS_FULLMODE
 	jz		SHORT .DisableMenuitemFromCSBX
 	jmp		SHORT .EnableMenuitemFromCSBX
@@ -319,4 +319,20 @@
 ;		All, except segments
 ;--------------------------------------------------------------------
+%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
+%if (ROMVARS.ideVars0 | ROMVARS.ideVars1 | ROMVARS.ideVars2 | ROMVARS.ideVars3) & 0FF00h = 0
+PrimaryIdeController:
+	mov		bl, ROMVARS.ideVars0 & 0FFh
+	SKIP2B	f
+SecondaryIdeController:
+	mov		bl, ROMVARS.ideVars1 & 0FFh
+	SKIP2B	f
+TertiaryIdeController:
+	mov		bl, ROMVARS.ideVars2 & 0FFh
+	SKIP2B	f
+QuaternaryIdeController:
+	mov		bl, ROMVARS.ideVars3 & 0FFh
+	xor		bh, bh
+	; Fall to DisplayIdeControllerMenu
+%else
 ALIGN JUMP_ALIGN
 PrimaryIdeController:
@@ -338,4 +354,6 @@
 	mov		bx, ROMVARS.ideVars3
 	; Fall to DisplayIdeControllerMenu
+%endif
+%endif
 
 ALIGN JUMP_ALIGN
@@ -383,5 +401,5 @@
 ;		Nothing
 ;	Corrupts registers:
-;		All
+;		AX, BX, CX, DX
 ;----------------------------------------------------------------------
 ConfigurationMenu_CheckAndMoveSerialDrivesToBottom:
@@ -428,10 +446,9 @@
 ; move serial to end of list, others up
 ;
+%ifdef CLD_NEEDED
 	cld
-
+%endif
 	mov		ax, di						; save end pointer of list after scan
-
 	sub		sp, IDEVARS_size			; copy serial to temporary space on stack
-
 	mov		di, sp
 
@@ -439,4 +456,5 @@
 	pop		es
 
+%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
 %if IDEVARS_size & 1
 	mov		cl, IDEVARS_size
@@ -446,7 +464,7 @@
 	rep movsw
 %endif
+%endif
 
 	lea		di, [si-IDEVARS_size]		; move up all the idevars below the serial, by one slot
-
 	mov		cx, ax						; restore end pointer of list, subtract off end of serial idevars
 	sub		cx, si
@@ -462,4 +480,5 @@
 	; di is already at last IDEVARS position
 
+%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
 %if IDEVARS_size & 1
 	mov		cl, IDEVARS_size
@@ -469,4 +488,5 @@
 	rep movsw
 %endif
+%endif
 
 	add		sp, IDEVARS_size
@@ -476,5 +496,4 @@
 
 	mov		dh, 1						; set flag that we have done a relocation
-
 	jmp		SHORT .outerLoop
 
Index: trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/FlashMenu.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/FlashMenu.asm	(revision 589)
+++ trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/FlashMenu.asm	(revision 592)
@@ -185,21 +185,19 @@
 	pop		ds
 
-	cmp		WORD [cs:g_cfgVars+CFGVARS.wEepromSegment], 0
-	jne		.alreadySet
+	cmp		WORD [g_cfgVars+CFGVARS.wEepromSegment], 0
+	jne		SHORT .AlreadySet
 
 	push	es
 	push	di
 	call	EEPROM_FindXtideUniversalBiosROMtoESDI
-	push	es
-	pop		ax
+	mov		ax, es
 	pop		di
 	pop		es
-	jc		.storeEepromSegment
+	jnc		SHORT .StoreEepromSegment
 	mov		ax, DEFAULT_EEPROM_SEGMENT
-.storeEepromSegment:
-	mov		WORD [cs:g_cfgVars+CFGVARS.wEepromSegment], ax
-
-.alreadySet:
-
+.StoreEepromSegment:
+	mov		[g_cfgVars+CFGVARS.wEepromSegment], ax
+
+.AlreadySet:
 	mov		si, g_MenupageForFlashMenu
 	jmp		Menupage_ChangeToNewMenupageInDSSI
@@ -256,4 +254,5 @@
 ALIGN JUMP_ALIGN, ret
 .ImageFitsInSelectedEeprom:
+.DoNotGenerateChecksumByte:
 	ret
 
@@ -271,9 +270,7 @@
 	call	EEPROM_LoadFromRomToRamComparisonBuffer
 	call	Buffers_AppendZeroesIfNeeded
-	test	WORD [cs:g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_CHECKSUM
+	test	BYTE [cs:g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_CHECKSUM
 	jz		SHORT .DoNotGenerateChecksumByte
 	jmp		Buffers_GenerateChecksum
-.DoNotGenerateChecksumByte:
-	ret
 
 ;--------------------------------------------------------------------
@@ -349,5 +346,9 @@
 .GetSelectedEepromSizeInWordsToAX:
 	eMOVZX	bx, [cs:g_cfgVars+CFGVARS.bEepromType]
-	mov		ax, [cs:bx+g_rgwEepromTypeToSizeInWords]
+;%if g_rgwEepromTypeToSizeInWords = 0	; *FIXME* It really is but NASM won't accept this.
+	mov		ax, [cs:bx]
+;%else
+;	mov		ax, [cs:bx+g_rgwEepromTypeToSizeInWords]
+;%endif
 	ret
 
Index: trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/IdeControllerMenu.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/IdeControllerMenu.asm	(revision 589)
+++ trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/IdeControllerMenu.asm	(revision 592)
@@ -135,5 +135,5 @@
 	at	MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,				dw	g_szDlgIdeCmdPort
 	at	MENUITEM.itemValue + ITEM_VALUE.wMinValue,					dw	8h
-	at	MENUITEM.itemValue + ITEM_VALUE.wMaxValue,					dw	3f8h
+	at	MENUITEM.itemValue + ITEM_VALUE.wMaxValue,					dw	3F8h
 	at	MENUITEM.itemValue + ITEM_VALUE.fnValueReader,				dw	IdeControllerMenu_SerialReadPort
 	at	MENUITEM.itemValue + ITEM_VALUE.fnValueWriter,				dw	IdeControllerMenu_SerialWritePort
@@ -306,9 +306,19 @@
 	mov		[cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
 
+%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
+%if IDEVARS.wBasePort = 0
+	mov		[cs:g_MenuitemIdeControllerCommandBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], bx
+%else
 	lea		ax, [bx+IDEVARS.wBasePort]
 	mov		[cs:g_MenuitemIdeControllerCommandBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
-
+%endif
+
+%if IDEVARS.bSerialPort = 0
+	mov		[cs:g_MenuitemIdeControllerSerialPort+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], bx
+%else
 	lea		ax, [bx+IDEVARS.bSerialPort]
 	mov		[cs:g_MenuitemIdeControllerSerialPort+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
+%endif
+%endif
 
 	lea		ax, [bx+IDEVARS.bSerialBaud]
@@ -361,5 +371,5 @@
 ALIGN JUMP_ALIGN
 .EnableOrDisableCommandBlockPort:
-	mov		bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
+	mov		bx, [g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
 	call	Buffers_GetRomvarsValueToAXfromOffsetInBX
 	mov		bx, g_MenuitemIdeControllerCommandBlockAddress
@@ -380,5 +390,5 @@
 ALIGN JUMP_ALIGN
 .EnableOrDisableControlBlockPort:
-	mov		bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
+	mov		bx, [g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
 	call	Buffers_GetRomvarsValueToAXfromOffsetInBX
 	mov		bx, g_MenuitemIdeControllerControlBlockAddress
@@ -404,5 +414,5 @@
 	jz		SHORT .DisableMenuitemFromCSBX
 
-	mov		bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
+	mov		bx, [g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
 	call	Buffers_GetRomvarsValueToAXfromOffsetInBX
 	mov		bx, g_MenuitemIdeControllerEnableInterrupt
@@ -424,5 +434,5 @@
 ALIGN JUMP_ALIGN
 .EnableOrDisableIRQchannelSelection:
-	mov		bx, [cs:g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
+	mov		bx, [g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
 	call	Buffers_GetRomvarsValueToAXfromOffsetInBX
 	mov		bx, g_MenuitemIdeControllerIdeIRQ
@@ -453,4 +463,13 @@
 
 
+;--------------------------------------------------------------------
+; .EnableOrDisableSerial
+;	Parameters:
+;		SS:BP:	Menu handle
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX, BX
+;--------------------------------------------------------------------
 .EnableOrDisableSerial:
 	mov		bx, g_MenuitemIdeControllerSerialBaud
@@ -463,8 +482,8 @@
 	call	DisableMenuitemFromCSBX
 
-	mov		bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
+	mov		bx, [g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
 	call	Buffers_GetRomvarsValueToAXfromOffsetInBX
 	cmp		al, DEVICE_SERIAL_PORT
-	jne		.DisableAllSerial
+	jne		SHORT .DisableAllSerial
 
 	mov		bx, g_MenuitemIdeControllerSerialCOM
@@ -474,5 +493,5 @@
 	call	EnableMenuitemFromCSBX
 
-	mov		bx, [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
+	mov		bx, [g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
 	call	Buffers_GetRomvarsValueToAXfromOffsetInBX
 	mov		bx, g_MenuitemIdeControllerSerialPort
@@ -483,4 +502,5 @@
 	ret
 
+
 ;--------------------------------------------------------------------
 ; MENUITEM activation functions (.fnActivate)
@@ -531,47 +551,21 @@
 	jmp		MasterSlaveMenu_EnterMenuOrModifyItemVisibility
 
-;------------------------------------------------------------------------------------------
-;
-; Reader/Writer Routines
-;
-; For serial drives, we pack the port number and baud rate into a single byte, and thus
-; 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
-; device choice.
-;
-; Writers:
-;	Parameters:
-;		AX:		Value that the MENUITEM system was interacting with
-;		ES:DI:	ROMVARS location where the value is to be stored
+
+;--------------------------------------------------------------------
+; IdeControllerMenu_WriteDevice
+;
+; Sets default values to ports and other device dependent stuff
+;
+;	Parameters:
+;		AX:		IDE controller/Device type menu choice index
+;		ES:DI:	Ptr to IDEVARS.bDevice
 ;		DS:SI:	MENUITEM pointer
 ;	Returns:
-;		AX:		Value to actually write to ROMVARS
-;	Corrupts registers:
-;		AX
-;
-; Readers:
-;	Parameters:
-;		AX:		Value read from the ROMVARS location
-;		ES:DI:	ROMVARS location where the value was just read from
-;		DS:SI:	MENUITEM pointer
-;	Returns:
-;		AX:		Value that the MENUITEM system will interact with and display
-;	Corrupts registers:
-;		AX
-;
-ALIGN JUMP_ALIGN
-WriterForXTCFwindow:
-	xor		al, al
-	SKIP2B	f
-ReaderForXTCFwindow:
-	xor		ah, ah
-	xchg	al, ah
-	ret
-
-
+;		AX:		IDE controller/Device type menu choice index
+;	Corrupts registers:
+;		BX, DX
+;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
 IdeControllerMenu_WriteDevice:
-	push	bx
 	push	di
 	push	ax
@@ -581,7 +575,5 @@
 
 	; Note! AL is the choice index, not device code
-	shl		al, 1								; Selection to device code
-
-	; Restore ports and other stuff to default values
+	eSHL_IM	al, 1								; Selection to device code
 	jz		SHORT .StandardIdeDevice			; DEVICE_16BIT_ATA
 
@@ -603,5 +595,5 @@
 	div		bl
 	mov		bx, .rgbLowByteOfStdIdeInterfacePorts
-	xlat
+	xlat										; DS=CS so no segment override needed
 	mov		ah, 1								; DEVICE_ATA_*_PORT >> 8
 	mov		bh, 3								; DEVICE_ATA_*_PORTCTRL >> 8
@@ -622,8 +614,6 @@
 
 .SupportForDeviceNotAvailable:
-	push	dx
 	mov		dx, g_szUnsupportedDevice
 	call	Dialogs_DisplayErrorFromCSDX
-	pop		dx
 
 	; Restore device type to the previous value
@@ -631,5 +621,6 @@
 	mov		al, bl								; Previous device type to AL
 	shr		al, 1								; Device code to choice index
-	jmp		SHORT .DoneWithNoChangeOfDevice
+	pop		di
+	ret
 
 .NotSerialDevice:
@@ -670,11 +661,15 @@
 
 .ChangingToSerial:
-	cmp		bl, DEVICE_SERIAL_PORT
-	je		SHORT .Done							; if we were already serial, nothing to do
-
+;
+; For serial drives, we pack the port number and baud rate into a single byte, and thus
+; 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
+; device choice.
+;
+	mov		al, SERIAL_DEFAULT_COM
 	mov		BYTE [es:di+IDEVARS.bSerialBaud-IDEVARS.wBasePort], SERIAL_DEFAULT_BAUD
-	mov		BYTE [es:di+IDEVARS.bIRQ-IDEVARS.wBasePort], 0	; Clear .bIRQ to keep the boot menu from printing it
-
-	mov		al, SERIAL_DEFAULT_COM
+	mov		[es:di+IDEVARS.bIRQ-IDEVARS.wBasePort], ah	; Clear .bIRQ to keep the boot menu from printing it
+
 	sub		di, IDEVARS.wBasePort - IDEVARS.bSerialCOMPortChar
 	call	IdeControllerMenu_SerialWriteCOM
@@ -683,53 +678,64 @@
 .Done:
 	pop		ax
-.DoneWithNoChangeOfDevice:
-	pop		di			; IDEVARS.bDevice
-	pop		bx
+	pop		di
 	ret
 
-;
-; 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
-;
+
+;--------------------------------------------------------------------
+; IdeControllerMenu_SerialWriteCOM
+;
+; Updates the port address based on COM port selection
+;
+;	Parameters:
+;		AL:		COM port
+;		ES:DI:	Ptr to IDEVARS.bSerialCOMPortChar
+;		DS:SI:	MENUITEM pointer
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		BX
+;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
 IdeControllerMenu_SerialWriteCOM:
 	push	ax
-	push	bx
 	push	si
 
-	mov		si, g_rgbChoiceToValueLookupForCOM
-	mov		bx, PackedCOMPortAddresses
-
-.loop:
-	mov		ah, [bx]
-
-	cmp		ah, (SERIAL_DEFAULT_CUSTOM_PORT >> 2)
-	je		.notFound
-
-	cmp		al, [si]
-	je		.found
-
+	mov		bx, PackedCOMPortAddresses - 1
+	mov		si, g_rgbChoiceToValueLookupForCOM - 2
+
+.Loop:
+	inc		bx
 	inc		si
 	inc		si
-	inc		bx
-
-	jmp		.loop
-
-.notFound:
-	mov		al, 'x'
-
-.found:
+
+	mov		ah, [bx]
+	cmp		ah, SERIAL_DEFAULT_CUSTOM_PORT >> 2
+	je		SHORT .NotFound
+
+	cmp		al, [si]
+	jne		SHORT .Loop
+
+.NotFound:
 	mov		[es:di+IDEVARS.bSerialPort-IDEVARS.bSerialCOMPortChar], ah
 
 	pop		si
-	pop		bx
 	pop		ax
-
 	ret
 
 
+;--------------------------------------------------------------------
+; IdeControllerMenu_SerialReadPort
 ;
 ; Packed Port (byte) -> Numeric Port (word)
 ;
+;	Parameters:
+;		AX:		Value read from the ROMVARS location
+;		ES:DI:	ROMVARS location where the value was just read from
+;		DS:SI:	MENUITEM pointer
+;	Returns:
+;		AX:		Value that the MENUITEM system will interact with and display
+;	Corrupts registers:
+;		Nothing
+;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
 IdeControllerMenu_SerialReadPort:
@@ -738,39 +744,48 @@
 	ret
 
+
+;--------------------------------------------------------------------
+; IdeControllerMenu_SerialWritePort
 ;
 ; Numeric Port (word) -> Packed Port (byte)
-; And convert from Custom to a defined COM port if we match one of the pre-defined COM port numbers
-;
+;
+; And convert from Custom to a defined COM port if we
+; match one of the pre-defined COM port numbers
+;
+;	Parameters:
+;		AX:		Value that the MENUITEM system was interacting with
+;		ES:DI:	ROMVARS location where the value is to be stored
+;		DS:SI:	MENUITEM pointer
+;	Returns:
+;		AX:		Value to actually write to ROMVARS
+;	Corrupts registers:
+;		BX
+;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
 IdeControllerMenu_SerialWritePort:
-	push	bx
 	push	si
 
 	eSHR_IM	ax, 2
-	and		al, 0feh			; force 8-byte boundary
-
-	mov		si, g_rgbChoiceToValueLookupForCOM
-	mov		bx, PackedCOMPortAddresses			; loop, looking for port address in known COM address list
-
-.loop:
-	mov		ah, [si]
-	cmp		ah, 'x'
-	je		.found
-
-	cmp		al, [bx]
-	je		.found
-
+	and		al, 0FEh							; Force 8-byte boundary
+
+	mov		si, g_rgbChoiceToValueLookupForCOM - 2
+	mov		bx, PackedCOMPortAddresses - 1		; Loop, looking for port address in known COM address list
+
+.Loop:
 	inc		si
 	inc		si
 	inc		bx
 
-	jmp		.loop
-
-.found:
+	mov		ah, [si]
+	cmp		ah, 'x'
+	je		SHORT .Found
+
+	cmp		al, [bx]
+	jne		SHORT .Loop
+
+.Found:
 	mov		[es:di+IDEVARS.bSerialCOMPortChar-IDEVARS.bSerialPort], ah
 
 	pop		si
-	pop		bx
-
 	ret
 
Index: trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/MainMenu.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/MainMenu.asm	(revision 589)
+++ trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/MainMenu.asm	(revision 592)
@@ -155,5 +155,5 @@
 .EnableOrDisableXtideRomItems:
 	call	EEPROM_FindXtideUniversalBiosROMtoESDI
-	jnc		SHORT .DisableAllRomItems
+	jc		SHORT .DisableAllRomItems
 	or		BYTE [g_MenuitemMainMenuLoadXtideUniversalBiosFromRom+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
 	call	Buffers_IsXtideUniversalBiosLoaded
@@ -201,5 +201,5 @@
 ALIGN JUMP_ALIGN
 .EnableOrDisableFlashEeprom:
-	test	WORD [g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_FILELOADED | FLG_CFGVARS_ROMLOADED
+	test	BYTE [g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_FILELOADED | FLG_CFGVARS_ROMLOADED
 	jz		SHORT .DisableFlashEeprom
 	or		BYTE [g_MenuitemMainMenuFlashEeprom+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
@@ -222,5 +222,5 @@
 ALIGN JUMP_ALIGN
 .EnableOrDisableSave:
-	test	WORD [g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_FILELOADED
+	test	BYTE [g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_FILELOADED
 	jz		SHORT .DisableSave
 	or		BYTE [g_MenuitemMainMenuSaveFile+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
@@ -257,4 +257,6 @@
 	add		si, BYTE FILE_DIALOG_IO.szFile
 	call	BiosFile_LoadFileFromDSSItoRamBuffer
+	call	LoadColorTheme
+	; *FIXME* Will load themes even from unrecognized versions of the BIOS which isn't really a problem but still 'unexpected behaviour' and therefore a bug.
 	call	MainMenu_EnterMenuOrModifyItemVisibility
 .CancelFileLoading:
@@ -272,4 +274,5 @@
 	mov		dx, g_szDlgMainLoadROM
 	call	Dialogs_DisplayNotificationFromCSDX
+	call	LoadColorTheme
 	jmp		MainMenu_EnterMenuOrModifyItemVisibility
 
@@ -281,4 +284,24 @@
 	call	Buffers_SetUnsavedChanges
 	mov		dx, g_szDlgMainLoadStngs
-	jmp		Dialogs_DisplayNotificationFromCSDX
-
+	call	Dialogs_DisplayNotificationFromCSDX
+	call	EEPROM_FindXtideUniversalBiosROMtoESDI
+	call	LoadColorTheme.FromROM
+	jmp		MainMenu_EnterMenuOrModifyItemVisibility
+
+
+;--------------------------------------------------------------------
+; LoadColorTheme
+;	Parameters:
+;		ES:		ROMVARS segment (only when loading theme from ROM)
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX, BX, DI, ES
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+LoadColorTheme:
+	call	Buffers_GetFileBufferToESDI
+.FromROM:
+	mov		ax, [es:ROMVARS.pColorTheme]
+	jmp		ReadColorTheme
+
Index: trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/MasterSlaveMenu.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/MasterSlaveMenu.asm	(revision 589)
+++ trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/MasterSlaveMenu.asm	(revision 592)
@@ -196,5 +196,4 @@
 	dw	DISABLE_WRITE_CACHE
 	dw	ENABLE_WRITE_CACHE
-
 g_rgszChoiceToStringLookupForWriteCache:
 	dw	g_szValueBootDispModeDefault
@@ -207,5 +206,4 @@
 	dw	TRANSLATEMODE_ASSISTED_LBA
 	dw	TRANSLATEMODE_AUTO
-
 g_rgszChoiceToStringLookupForXlateMode:
 	dw	g_szValueDrvXlateNormal
@@ -229,22 +227,35 @@
 ALIGN JUMP_ALIGN
 MasterSlaveMenu_InitializeToDrvparamsOffsetInBX:
+	push	ds
+
+	push	cs
+	pop		ds
+
+%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
+%if DRVPARAMS.wFlags = 0
+	mov		ax, bx
+%else
 	lea		ax, [bx+DRVPARAMS.wFlags]
-	mov		[cs:g_MenuitemMasterSlaveBlockModeTransfers+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
-	mov		[cs:g_MenuitemMasterSlaveChsTranslateMode+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
-	mov		[cs:g_MenuitemMasterSlaveWriteCache+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
-	mov		[cs:g_MenuitemMasterSlaveUserCHS+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
-	mov		[cs:g_MenuitemMasterSlaveUserLBA+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
+%endif
+%endif
+	mov		[g_MenuitemMasterSlaveBlockModeTransfers+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
+	mov		[g_MenuitemMasterSlaveChsTranslateMode+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
+	mov		[g_MenuitemMasterSlaveWriteCache+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
+	mov		[g_MenuitemMasterSlaveUserCHS+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
+	mov		[g_MenuitemMasterSlaveUserLBA+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
 
 	lea		ax, [bx+DRVPARAMS.wCylinders]
-	mov		[cs:g_MenuitemMasterSlaveCylinders+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
+	mov		[g_MenuitemMasterSlaveCylinders+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
 
 	lea		ax, [bx+DRVPARAMS.bHeads]
-	mov		[cs:g_MenuitemMasterSlaveHeads+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
+	mov		[g_MenuitemMasterSlaveHeads+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
 
 	lea		ax, [bx+DRVPARAMS.bSect]
-	mov		[cs:g_MenuitemMasterSlaveSectors+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
+	mov		[g_MenuitemMasterSlaveSectors+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
 
 	lea		ax, [bx+DRVPARAMS.dwMaximumLBA]
-	mov		[cs:g_MenuitemMasterSlaveUserLbaValue+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
+	mov		[g_MenuitemMasterSlaveUserLbaValue+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
+
+	pop		ds
 	ret
 
@@ -283,7 +294,7 @@
 	mov		bx, [g_MenuitemMasterSlaveUserLBA+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
 	call	Buffers_GetRomvarsValueToAXfromOffsetInBX
-	test	ax, FLG_DRVPARAMS_USERLBA
+	test	al, FLG_DRVPARAMS_USERLBA
 	jnz		SHORT .DisableCHSandEnableLBA
-	test	ax, FLG_DRVPARAMS_USERCHS
+	test	al, FLG_DRVPARAMS_USERCHS
 	jnz		SHORT .EnableCHSandDisableLBA
 
@@ -320,9 +331,9 @@
 ALIGN JUMP_ALIGN
 .EnableOrDisableCHandS:
-	mov		bx, [cs:g_MenuitemMasterSlaveUserCHS+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
+	mov		bx, [g_MenuitemMasterSlaveUserCHS+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
 	call	Buffers_GetRomvarsValueToAXfromOffsetInBX
-	test	ax, FLG_DRVPARAMS_USERCHS
+	test	al, FLG_DRVPARAMS_USERCHS
 	jz		SHORT .DisableCHandS
-	test	ax, FLG_DRVPARAMS_USERLBA
+	test	al, FLG_DRVPARAMS_USERLBA
 	jnz		SHORT .DisableCHandS
 
@@ -355,10 +366,10 @@
 ALIGN JUMP_ALIGN
 .EnableOrDisableUserLbaValue:
-	mov		bx, [cs:g_MenuitemMasterSlaveUserLBA+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
+	mov		bx, [g_MenuitemMasterSlaveUserLBA+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
 	call	Buffers_GetRomvarsValueToAXfromOffsetInBX
 	mov		bx, g_MenuitemMasterSlaveUserLbaValue
-	test	ax, FLG_DRVPARAMS_USERCHS
+	test	al, FLG_DRVPARAMS_USERCHS
 	jnz		SHORT .DisableMenuitemFromCSBX
-	test	ax, FLG_DRVPARAMS_USERLBA
+	test	al, FLG_DRVPARAMS_USERLBA
 	jz		SHORT .DisableMenuitemFromCSBX
 	; Fall to .EnableMenuitemFromCSBX
@@ -443,6 +454,6 @@
 ALIGN JUMP_ALIGN
 MasterSlaveMenu_WriteCHSFlag:
-	test	word [es:di], FLG_DRVPARAMS_USERCHS
-	jnz		.alreadySet
+	test	BYTE [es:di], FLG_DRVPARAMS_USERCHS
+	jnz		SHORT .AlreadySet
 
 	push	ax
@@ -466,5 +477,5 @@
 	pop		ax
 
-.alreadySet:
+.AlreadySet:
 	ret
 
@@ -475,6 +486,6 @@
 ALIGN JUMP_ALIGN
 MasterSlaveMenu_WriteLBAFlag:
-	test	word [es:di], FLG_DRVPARAMS_USERLBA
-	jnz		.alreadySet
+	test	BYTE [es:di], FLG_DRVPARAMS_USERLBA
+	jnz		SHORT .AlreadySet
 
 	push	ax
@@ -490,4 +501,5 @@
 	pop		ax
 
-.alreadySet:
+.AlreadySet:
 	ret
+
