Index: trunk/Assembly_Library/Inc/AssemblyLibrary.inc
===================================================================
--- trunk/Assembly_Library/Inc/AssemblyLibrary.inc	(revision 595)
+++ trunk/Assembly_Library/Inc/AssemblyLibrary.inc	(revision 596)
@@ -9,10 +9,9 @@
 %include "BiosData.inc"
 %include "BiosFunctions.inc"
+%include "CgaSnow.inc"
 %include "CMOS.inc"
-%include "CgaSnow.inc"
 %include "Debug.inc"
 %include "Delay.inc"
 %include "DosFunctions.inc"
-%include "CMOS.inc"
 %include "File.inc"
 %include "Math.inc"
@@ -27,5 +26,5 @@
 	%define INCLUDE_KEYBOARD_LIBRARY
 	%define INCLUDE_TIME_LIBRARY
-	
+
 	%ifdef INCLUDE_MENU_DIALOGS
 		%include "Dialog.inc"
Index: trunk/Assembly_Library/Inc/BiosFunctions.inc
===================================================================
--- trunk/Assembly_Library/Inc/BiosFunctions.inc	(revision 595)
+++ trunk/Assembly_Library/Inc/BiosFunctions.inc	(revision 596)
@@ -66,5 +66,5 @@
 
 ; BIOS PCI 2.0+ functions
-PCI_INSTALLATION_CHECK				EQU		0B101h
+PCI_INSTALLATION_CHECK			EQU		0B101h
 
 
Index: trunk/Assembly_Library/Inc/Emulate.inc
===================================================================
--- trunk/Assembly_Library/Inc/Emulate.inc	(revision 595)
+++ trunk/Assembly_Library/Inc/Emulate.inc	(revision 596)
@@ -18,4 +18,11 @@
 ;%define USE_386				; Define to use 386 instructions
 ;%define USE_AT					; Define for AT class machine
+
+%ifdef USE_NEC_V				; This will run on NEC V20/V30 processors only
+	%define USE_186				; Define to use 18x/V20/V30 instructions
+	%ifdef USE_UNDOC_INTEL OR USE_286 OR USE_386
+		%fatal "Conflicting processor define used together with USE_NEC_V!"
+	%endif
+%endif
 
 %ifdef USE_386
@@ -87,4 +94,9 @@
 	%endif
 %endmacro
+
+
+%ifdef USE_NEC_V
+	%include "NEC_V.inc"
+%endif
 
 
Index: trunk/Assembly_Library/Inc/Macros.inc
===================================================================
--- trunk/Assembly_Library/Inc/Macros.inc	(revision 595)
+++ trunk/Assembly_Library/Inc/Macros.inc	(revision 596)
@@ -125,5 +125,5 @@
 
 ;--------------------------------------------------------------------
-; Small delay between I/O port accessess if needed.
+; Small delay between I/O port accesses if needed.
 ;
 ; IO_DELAY
Index: trunk/Assembly_Library/Src/Menu/Dialog/DialogDrive.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/Dialog/DialogDrive.asm	(revision 595)
+++ trunk/Assembly_Library/Src/Menu/Dialog/DialogDrive.asm	(revision 596)
@@ -29,5 +29,5 @@
 ;		Nothing
 ;	Corrupts registers:
-;		AX, BX, CX, DX, SI, DI
+;		AX, BX, CX, DX, DI
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
Index: trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm	(revision 595)
+++ trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm	(revision 596)
@@ -49,5 +49,8 @@
 	pop		dx
 	cmp		BYTE [si+FILE_DIALOG_IO.bUserCancellation], TRUE
-	je		Drive_SetDefaultFromDL
+	jne		SHORT .UserDidNotCancel
+	jmp		Drive_SetDefaultFromDL
+
+.UserDidNotCancel:
 	ret
 
Index: trunk/Assembly_Library/Src/Menu/Dialog/DialogMessage.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/Dialog/DialogMessage.asm	(revision 595)
+++ trunk/Assembly_Library/Src/Menu/Dialog/DialogMessage.asm	(revision 596)
@@ -30,5 +30,5 @@
 ;		Nothing
 ;	Corrupts registers:
-;		AX, BX, CX, DX, SI, DI
+;		AX, BX, CX, DX, DI
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
Index: trunk/Assembly_Library/Src/Menu/Dialog/DialogProgress.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/Dialog/DialogProgress.asm	(revision 595)
+++ trunk/Assembly_Library/Src/Menu/Dialog/DialogProgress.asm	(revision 596)
@@ -30,5 +30,5 @@
 ;		Nothing
 ;	Corrupts registers:
-;		AX, BX, CX, DX, SI, DI
+;		AX, BX, CX, DX, DI
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
Index: trunk/Assembly_Library/Src/Menu/Dialog/DialogSelection.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/Dialog/DialogSelection.asm	(revision 595)
+++ trunk/Assembly_Library/Src/Menu/Dialog/DialogSelection.asm	(revision 596)
@@ -30,5 +30,5 @@
 ;		Nothing
 ;	Corrupts registers:
-;		AX, BX, CX, DX, SI, DI
+;		AX, BX, CX, DX, DI
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
Index: trunk/Assembly_Library/Src/Menu/Dialog/DialogString.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/Dialog/DialogString.asm	(revision 595)
+++ trunk/Assembly_Library/Src/Menu/Dialog/DialogString.asm	(revision 596)
@@ -29,5 +29,5 @@
 ;		Nothing
 ;	Corrupts registers:
-;		AX, BX, CX, DX, SI, DI
+;		AX, BX, CX, DX, DI
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
Index: trunk/Assembly_Library/Src/Menu/Dialog/DialogWord.asm
===================================================================
--- trunk/Assembly_Library/Src/Menu/Dialog/DialogWord.asm	(revision 595)
+++ trunk/Assembly_Library/Src/Menu/Dialog/DialogWord.asm	(revision 596)
@@ -30,5 +30,5 @@
 ;		Nothing
 ;	Corrupts registers:
-;		AX, BX, CX, DX, SI, DI
+;		AX, BX, CX, DX, DI
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
@@ -93,5 +93,5 @@
 ;		Nothing (User input stored to WORD_DIALOG_IO)
 ;	Corrupts registers:
-;		AX, BX, CX, DX, SI, DI
+;		AX, BX, CX, DX, SI, DI, DS
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
Index: trunk/Assembly_Library/Src/Util/Registers.asm
===================================================================
--- trunk/Assembly_Library/Src/Util/Registers.asm	(revision 595)
+++ trunk/Assembly_Library/Src/Util/Registers.asm	(revision 596)
@@ -21,4 +21,9 @@
 SECTION .text
 
+%ifdef EXCLUDE_FROM_XUB
+	%ifndef MODULE_EBIOS
+		%define EXCLUDE
+	%endif
+%endif
 ;--------------------------------------------------------------------
 ; Registers_ExchangeDSSIwithESDI
@@ -30,4 +35,5 @@
 ;		Nothing
 ;--------------------------------------------------------------------
+%ifndef EXCLUDE
 ALIGN JUMP_ALIGN
 Registers_ExchangeDSSIwithESDI:
@@ -38,4 +44,6 @@
 	xchg	si, di
 	ret
+%endif
+%undef EXCLUDE
 
 
@@ -48,5 +56,5 @@
 ;		Nothing
 ;	Returns:
-;		Copies farm pointer to different segment/pointer register pair
+;		Copies far pointer to different segment/pointer register pair
 ;	Corrupts registers:
 ;		Nothing
Index: trunk/Assembly_Library/Src/Util/Size.asm
===================================================================
--- trunk/Assembly_Library/Src/Util/Size.asm	(revision 595)
+++ trunk/Assembly_Library/Src/Util/Size.asm	(revision 596)
@@ -159,5 +159,5 @@
 ALIGN UTIL_SIZE_JUMP_ALIGN
 Size_ConvertSectorCountInBXDXAXtoKiB:	; unused entrypoint ok
-Size_DivideBXDXAXbyTwo:
+Size_DivideBXDXAXbyTwo:					; unused entrypoint ok
 	shr		bx, 1					; Divide sector count by 2...
 	rcr		dx, 1					; ...to get disk size in...
Index: trunk/XTIDE_Universal_BIOS/Inc/BootVars.inc
===================================================================
--- trunk/XTIDE_Universal_BIOS/Inc/BootVars.inc	(revision 595)
+++ trunk/XTIDE_Universal_BIOS/Inc/BootVars.inc	(revision 596)
@@ -43,4 +43,5 @@
 	.wFddAndHddLetters:
 	.bFddLetter			resb	1		; Floppy Drive letter hotkey (upper case)
+	.wHddLetterAndFlags:
 	.bHddLetter			resb	1		; Hard Drive letter hotkey (upper case). Must be after .bFddLetter!
 	.bFlags				resb	1		; Must be just after .bHddLetter!  (dependency in Hotkeybar.asm)
Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm	(revision 595)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm	(revision 596)
@@ -31,5 +31,5 @@
 ;		AL, BX, CX, DX
 ;--------------------------------------------------------------------
-IdeCommand_ResetMasterAndSlaveController:
+IdeCommand_ResetMasterAndSlaveController:	; Unused entrypoint OK
 	; HSR0: Set_SRST
 ; Used to be:
@@ -81,5 +81,5 @@
 ;		AL, BX, CX, DX, SI, DI, ES
 ;--------------------------------------------------------------------
-IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH:
+IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH:		; Unused entrypoint OK
 	; Create fake DPT to be able to use Device.asm functions
 	call	FindDPT_ForNewDriveToDSDI
@@ -145,5 +145,5 @@
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
-IdeCommand_OutputWithParameters:
+IdeCommand_OutputWithParameters:	; Unused entrypoint OK
 	push	bx						; Store status register bits to poll
 
Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm	(revision 595)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm	(revision 596)
@@ -32,5 +32,5 @@
 ;		AX, BX, CX, DX
 ;--------------------------------------------------------------------
-IdeDPT_Finalize:
+IdeDPT_Finalize:	; Unused entrypoint OK
 
 %ifdef MODULE_POWER_MANAGEMENT
Index: trunk/XTIDE_Universal_BIOS/Src/Device/Idepack.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/Idepack.asm	(revision 595)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/Idepack.asm	(revision 596)
@@ -114,4 +114,5 @@
 	mov		[bp+IDEPACK.wLbaMiddleAndHigh], cx
 	pop		bx
+	; Fall to GetDeviceControlByteToIdepackAndStartTransfer
 
 GetDeviceControlByteToIdepackAndStartTransfer:
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm	(revision 595)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm	(revision 596)
@@ -339,5 +339,5 @@
 Int13h_CallPreviousInt13hHandler:
 	pushf						; Simulate INT by pushing flags
-	call far [RAMVARS.fpOldI13h]
+	call	FAR [RAMVARS.fpOldI13h]
 	ret
 
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Prepare.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Prepare.asm	(revision 595)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Prepare.asm	(revision 596)
@@ -132,12 +132,16 @@
 	ret		; Continue with transfer
 
+%ifdef MODULE_EBIOS
 InvalidDAP:
+Prepare_ReturnFromInt13hWithInvalidFunctionError:
+%endif
 InvalidNumberOfSectorsRequested:
-Prepare_ReturnFromInt13hWithInvalidFunctionError:
 	mov		ah, RET_HD_INVALID
 	SKIP2B	f
 CannotAlignPointerProperly:
 	mov		ah, RET_HD_BOUNDARY
+%ifdef MODULE_EBIOS
 ZeroSectorsRequestedSoNoErrors:
+%endif
 	jmp		Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
 
@@ -161,9 +165,9 @@
 %endif
 
+%ifdef MODULE_EBIOS
 g_rgbVerifyCommandLookup:
 	db		COMMAND_VERIFY_SECTORS
 	db		COMMAND_VERIFY_SECTORS_EXT
 	db		COMMAND_VERIFY_SECTORS
-%ifdef MODULE_EBIOS
 	db		COMMAND_VERIFY_SECTORS_EXT
 %endif
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13hMFMcompatibility.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13hMFMcompatibility.asm	(revision 595)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13hMFMcompatibility.asm	(revision 596)
@@ -1,6 +1,6 @@
 ; Project name	:	XTIDE Universal BIOS
 ; Description	:	Int 13h handler that is used by MODULE_MFM_COMPATIBILITY.
-;					It is placed between XTUB Int 13h hander and system INT 13h hander
-;					to hide XTUB from MFM controllers whose BIOS assumes they handler
+;					It is placed between XUB Int 13h handler and system INT 13h handler
+;					to hide XUB from MFM controllers whose BIOS assumes they handle
 ;					all hard drives on the system.
 
@@ -28,5 +28,5 @@
 ; Int 13h software interrupt handler for MFM compatibility.
 ;
-; Some MDM controllers require that BDA drive count is what they have set.
+; Some MFM controllers require that BDA drive count is what they have set.
 ; The purpose for this handler is to restore BDA drive count to what MFM controller
 ; expects and then call MFM controller INT 13h.
@@ -64,5 +64,5 @@
 
 	pushf	; Push flags to simulate INT
-	call far [bp-6]
+	call	FAR [bp-6]
 
 	; Now we can restore BDA drive count
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm	(revision 595)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm	(revision 596)
@@ -229,5 +229,5 @@
 	mov		gs, ax
 %endif
-	jnc		SHORT .romboot
+	jnc		SHORT .RomBoot
 
 ; jump to boot sector
@@ -237,4 +237,4 @@
 
 ; Boot by calling INT 18h (ROM Basic of ROM DOS)
-.romboot:
+.RomBoot:
 	int		BIOS_BOOT_FAILURE_INTERRUPT_18h	; Never returns
Index: trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/AdvAtaInit.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/AdvAtaInit.asm	(revision 595)
+++ trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/AdvAtaInit.asm	(revision 596)
@@ -37,7 +37,7 @@
 AdvAtaInit_DetectControllerForIdeBaseInBX:
 	; Detect if system has PCI bus. If it does, we can skip VLB detection. This is
-	; good thing since detecting Vision QD6850 is dangerous since Intel PIIX4 south bridge
+	; good thing since detecting Vision QD6580 is dangerous since Intel PIIX4 south bridge
 	; mirrors Interrupt Controller registers from Axh to Bxh. This can lead to faulty
-	; detection of QD6850 that will eventually crash the system when ports are written.
+	; detection of QD6580 that will eventually crash the system when ports are written.
 
 	; We should save the 32-bit registers but we don't since system BIOS has stored
Index: trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/Vision.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/Vision.asm	(revision 595)
+++ trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/Vision.asm	(revision 596)
@@ -194,6 +194,6 @@
 	; Calculate Recovery Time value for QD65xx IDE Timing Register
 	xchg	ax, cx
-	eMOVZX	cx, BYTE [cs:bx+.rgbToSubtractFromCycleTimeBasedOnPIOmode]
-	sub		ax, cx
+	mov		bl, [cs:bx+.rgbToSubtractFromCycleTimeBasedOnPIOmode]
+	sub		ax, bx
 	mov		bx, bp						; Active Time value now in BL
 	mov		bp, QD65xx_MAX_RECOVERY_TIME_CLOCKS | (QD65xx_MIN_RECOVERY_TIME_CLOCKS << 8)
Index: trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm	(revision 595)
+++ trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm	(revision 596)
@@ -99,8 +99,8 @@
 ; Primary reason is to support dynamic overlay feature in the future. Second reason
 ; is a hack to get Windows 95 load proper IDE drivers.
-; 
+;
 ; The Windows hack has two parts. First part is to try to alter CMOS address 12h as that
 ; is what Windows 95 driver reads to detect IDE drives. Altering is not possible on all
-; systems since CMOS has a checksum but it's location is not standardized. We will first
+; systems since CMOS has a checksum but its location is not standardized. We will first
 ; try to detect valid checksum. If it succeeds, then it is safe to assume this system
 ; has compatible CMOS and we can alter it.
@@ -117,5 +117,5 @@
 		call	CMOS_Verify10hTo2Dh				; Can we modify CMOS?
 		jnz		SHORT .ClearBdaDriveCount		; Unsupported BIOS, use plan B
-	
+
 		; Now we can alter CMOS location 12h
 		mov		dl, HARD_DISK_TYPES
Index: trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm	(revision 595)
+++ trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm	(revision 596)
@@ -65,7 +65,7 @@
 	mov		ax, [es:BIOS_DISK_INTERRUPT_13h*4]	; Load old INT 13h offset
 	mov		[RAMVARS.fpMFMint13h], ax			; Store old INT 13h offset
-	
+
 	mov		[RAMVARS.fpOldI13h+2], cs
-	mov		WORD [RAMVARS.fpOldI13h], Int13hMFMcompatibilityHandler	
+	mov		WORD [RAMVARS.fpOldI13h], Int13hMFMcompatibilityHandler
 %else
 	mov		ax, [es:BIOS_DISK_INTERRUPT_13h*4+2]; Load old INT 13h segment
@@ -252,7 +252,11 @@
 	xchg	cx, ax				; IRQ index to CL
 	in		al, dx				; Read Interrupt Mask Register
+%ifdef USE_NEC_V
+	eCLR1	al, cl				; Clear wanted bit
+%else
 	mov		ch, ~1				; Load bit mask to be rotated
 	rol		ch, cl				; Rotate mask to correct position for clearing
 	and		al, ch				; Clear wanted bit
+%endif
 	out		dx, al				; Write modified Interrupt Mask Register
 	pop		cx
Index: trunk/XTIDE_Universal_BIOS/Src/Menus/HotkeyBar.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Menus/HotkeyBar.asm	(revision 595)
+++ trunk/XTIDE_Universal_BIOS/Src/Menus/HotkeyBar.asm	(revision 596)
@@ -78,5 +78,5 @@
 	; Clear CH if floppy drive is selected for boot
 	mov		ch, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bFlags]
-	;and		ch, FLG_HOTKEY_HD_FIRST		; Needed if more flags are added
+;	and		ch, FLG_HOTKEY_HD_FIRST		; Needed if more flags are added
 	call	FormatDriveHotkeyString
 
@@ -96,6 +96,6 @@
 	call	BootVars_GetLetterForFirstHardDriveToAX
 	mov		ah, ANGLE_QUOTE_RIGHT
-	mov		cx, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bHddLetter]	; Letter to CL, flags to CH
-	;and		ch, FLG_HOTKEY_HD_FIRST		; Needed if more flags are added
+	mov		cx, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wHddLetterAndFlags]	; Letter to CL, flags to CH
+;	and		ch, FLG_HOTKEY_HD_FIRST		; Needed if more flags are added
 	xor		ch, FLG_HOTKEY_HD_FIRST		; Clear CH if HD is selected for boot, set otherwise
 	mov		di, g_szHDD
@@ -234,9 +234,9 @@
 
 GetSelectedHotkeyDescriptionAttributeToDX:
-	mov		si, ATTRIBUTE_CHARS.cHurryTimeout		; Selected hotkey
+	mov		si, ATTRIBUTE_CHARS.cHighlightedItem	; Selected hotkey
 	je		SHORT GetDescriptionAttributeToDX		; From compare with bScancode above and from FormatDriveHotkeyString
 
 GetNonSelectedHotkeyDescriptionAttributeToDX:
-	mov		si, ATTRIBUTE_CHARS.cHighlightedItem	; Unselected hotkey
+	mov		si, ATTRIBUTE_CHARS.cItem				; Unselected hotkey
 
 	; Display Library should not be called like this
Index: trunk/XTIDE_Universal_BIOS/makefile
===================================================================
--- trunk/XTIDE_Universal_BIOS/makefile	(revision 595)
+++ trunk/XTIDE_Universal_BIOS/makefile	(revision 596)
@@ -122,7 +122,4 @@
 DEFINES_386_LARGE = $(DEFINES_AT_LARGE) USE_386 MODULE_ADVANCED_ATA
 
-DEFINES_ALL_FEATURES = MODULE_8BIT_IDE MODULE_8BIT_IDE_ADVANCED MODULE_ADVANCED_ATA MODULE_EBIOS MODULE_BOOT_MENU MODULE_HOTKEYS MODULE_IRQ MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_STRINGS_COMPRESSED MODULE_POWER_MANAGEMENT MODULE_COMPATIBLE_TABLES
-DEFINES_ALL_FEATURES += ELIMINATE_CGA_SNOW RELOCATE_INT13H_STACK RESERVE_DIAGNOSTIC_CYLINDER MODULE_WIN95_CMOS_HACK MODULE_MFM_COMPATIBILITY
-
 
 ###################
@@ -146,5 +143,4 @@
 DEFS_386 = $(DEFINES_386:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_SMALL)
 DEFS_386_LARGE = $(DEFINES_386_LARGE:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_LARGE)
-DEFS_ALL_FEATURES = $(DEFINES_ALL_FEATURES:%=-D%)
 
 # Add -I in front of all header directories
@@ -249,8 +245,8 @@
 
 unused:
-	@echo "All Features"
-	@$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_ALL_FEATURES) $(DEFS_XT) $(DEFS_XT_PLUS) $(DEFS_AT) $(DEFS_XT_LARGE) $(DEFS_XTPLUS_LARGE) $(DEFS_AT_LARGE) $(DEFS_XT_TINY) $(DEFS_386_8K) -o"$(TARGET)_unused.asm" -l"$(TARGET)_unused.lst"
-	@$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_ALL_FEATURES) $(DEFS_XT) $(DEFS_XT_PLUS) $(DEFS_AT) $(DEFS_XT_LARGE) $(DEFS_XTPLUS_LARGE) $(DEFS_AT_LARGE) $(DEFS_XT_TINY) $(DEFS_386_8K) -o"$(TARGET)_unused.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
-	@perl ..\Tools\unused.pl $(TARGET)_unused.lst $(TARGET)_unused.asm
+	@echo "XT Tiny"
+	@$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_TINY) -o"$(TARGET)_unused_tiny.asm" -l"$(TARGET)_unused_tiny.lst"
+	@$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_TINY) -o"$(TARGET)_unused_tiny.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
+	@perl ..\Tools\unused.pl $(TARGET)_unused_tiny.lst $(TARGET)_unused_tiny.asm
 	@echo "XT Small"
 	@$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_unused_xt.asm" -l"$(TARGET)_unused_xt.lst"
@@ -261,4 +257,12 @@
 	@$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -o"$(TARGET)_unused_xtl.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
 	@perl ..\Tools\unused.pl $(TARGET)_unused_xtl.lst $(TARGET)_unused_xtl.asm
+	@echo "XT Plus Small"
+	@$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -o"$(TARGET)_unused_xtp.asm" -l"$(TARGET)_unused_xtp.lst"
+	@$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -o"$(TARGET)_unused_xtp.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
+	@perl ..\Tools\unused.pl $(TARGET)_unused_xtp.lst $(TARGET)_unused_xtp.asm
+	@echo "XT Plus Large"
+	@$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS_LARGE) -o"$(TARGET)_unused_xtpl.asm" -l"$(TARGET)_unused_xtpl.lst"
+	@$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS_LARGE) -o"$(TARGET)_unused_xtpl.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
+	@perl ..\Tools\unused.pl $(TARGET)_unused_xtpl.lst $(TARGET)_unused_xtpl.asm
 	@echo "AT Small"
 	@$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -o"$(TARGET)_unused_at.asm" -l"$(TARGET)_unused_at.lst"
@@ -269,4 +273,11 @@
 	@$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -o"$(TARGET)_unused_atl.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
 	@perl ..\Tools\unused.pl $(TARGET)_unused_atl.lst $(TARGET)_unused_atl.asm
-
-
+	@echo "386 Small"
+	@$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386) -o"$(TARGET)_unused_386.asm" -l"$(TARGET)_unused_386.lst"
+	@$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386) -o"$(TARGET)_unused_386.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
+	@perl ..\Tools\unused.pl $(TARGET)_unused_386.lst $(TARGET)_unused_386.asm
+	@echo "386 Large"
+	@$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386_LARGE) -o"$(TARGET)_unused_386l.asm" -l"$(TARGET)_unused_386l.lst"
+	@$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386_LARGE) -o"$(TARGET)_unused_386l.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
+	@perl ..\Tools\unused.pl $(TARGET)_unused_386l.lst $(TARGET)_unused_386l.asm
+
Index: trunk/XTIDE_Universal_BIOS_Configurator_v2/Inc/MenuStructs.inc
===================================================================
--- trunk/XTIDE_Universal_BIOS_Configurator_v2/Inc/MenuStructs.inc	(revision 595)
+++ trunk/XTIDE_Universal_BIOS_Configurator_v2/Inc/MenuStructs.inc	(revision 596)
@@ -38,21 +38,21 @@
 
 struc MENUPAGE
-	.fnEnter			resb	2	; Function to initialize MENUPAGE
-	.fnBack				resb	2	; Function to initialize previous MENUPAGE
-	.wMenuitems			resb	2	; Number of MENUITEM structs
-	.rgMenuitem:					; All MENUITEM structs in this MENUPAGE
+	.fnEnter				resb	2	; Function to initialize MENUPAGE
+	.fnBack					resb	2	; Function to initialize previous MENUPAGE
+	.wMenuitems				resb	2	; Number of MENUITEM structs
+	.rgMenuitem:						; All MENUITEM structs in this MENUPAGE
 endstruc
 
 struc MENUITEM
-	.fnActivate			resb	2	; Offset to item activation function
-	.fnFormatValue		resb	2	; Offset to item value formatting function
+	.fnActivate				resb	2	; Offset to item activation function
+	.fnFormatValue			resb	2	; Offset to item value formatting function
 
-	.szName				resb	2	; Offset to item name string
-	.szQuickInfo		resb	2	; Offset to item quick information string
-	.szHelp				resb	2	; Offset to item help string
+	.szName					resb	2	; Offset to item name string
+	.szQuickInfo			resb	2	; Offset to item quick information string
+	.szHelp					resb	2	; Offset to item help string
 
-	.bFlags				resb	1	; Item flags
-	.bType				resb	1	; Item type
-	.itemValue			resb	ITEM_VALUE_size		; ITEM_VALUE for automated item handling
+	.bFlags					resb	1	; Item flags
+	.bType					resb	1	; Item type
+	.itemValue				resb	ITEM_VALUE_size		; ITEM_VALUE for automated item handling
 endstruc
 
Index: trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/BiosFile.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/BiosFile.asm	(revision 595)
+++ trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/BiosFile.asm	(revision 596)
@@ -40,6 +40,6 @@
 	jc		SHORT .DisplayErrorMessage
 
-	mov		ax, FLG_CFGVARS_FILELOADED
-	call	Buffers_NewBiosWithSizeInDXCXandSourceInAXhasBeenLoadedForConfiguration
+	mov		al, FLG_CFGVARS_FILELOADED
+	call	Buffers_NewBiosWithSizeInDXCXandSourceInALhasBeenLoadedForConfiguration
 	call	FileIO_CloseUsingHandleFromBX
 	call	DisplayFileLoadedSuccessfully
Index: trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Buffers.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Buffers.asm	(revision 595)
+++ trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Buffers.asm	(revision 596)
@@ -109,5 +109,5 @@
 
 ;--------------------------------------------------------------------
-; Buffers_NewBiosWithSizeInDXCXandSourceInAXhasBeenLoadedForConfiguration
+; Buffers_NewBiosWithSizeInDXCXandSourceInALhasBeenLoadedForConfiguration
 ;	Parameters:
 ;		AL:		EEPROM source (FLG_CFGVARS_FILELOADED or FLG_CFGVARS_ROMLOADED)
@@ -119,5 +119,5 @@
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
-Buffers_NewBiosWithSizeInDXCXandSourceInAXhasBeenLoadedForConfiguration:
+Buffers_NewBiosWithSizeInDXCXandSourceInALhasBeenLoadedForConfiguration:
 	and		BYTE [cs:g_cfgVars+CFGVARS.wFlags], ~(FLG_CFGVARS_FILELOADED | FLG_CFGVARS_ROMLOADED | FLG_CFGVARS_UNSAVED)
 	or		[cs:g_cfgVars+CFGVARS.wFlags], al
Index: trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Flash.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Flash.asm	(revision 595)
+++ trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Flash.asm	(revision 596)
@@ -296,5 +296,5 @@
 
 ;--------------------------------------------------------------------
-; WaitUntilEepromPageWriteHasCompleted
+; .WaitUntilEepromPageWriteHasCompleted
 ;	Parameters:
 ;		SS:BP:	Ptr to FLASHVARS
Index: trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/MainMenu.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/MainMenu.asm	(revision 595)
+++ trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/MainMenu.asm	(revision 596)
@@ -258,5 +258,4 @@
 	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:
@@ -270,6 +269,6 @@
 	call	Buffers_SaveChangesIfFileLoaded
 	call	EEPROM_LoadXtideUniversalBiosFromRomToRamBufferAndReturnSizeInDXCX
-	mov		ax, FLG_CFGVARS_ROMLOADED
-	call	Buffers_NewBiosWithSizeInDXCXandSourceInAXhasBeenLoadedForConfiguration
+	mov		al, FLG_CFGVARS_ROMLOADED
+	call	Buffers_NewBiosWithSizeInDXCXandSourceInALhasBeenLoadedForConfiguration
 	mov		dx, g_szDlgMainLoadROM
 	call	Dialogs_DisplayNotificationFromCSDX
@@ -297,11 +296,15 @@
 ;		Nothing
 ;	Corrupts registers:
-;		AX, BX, DI, ES
+;		AX, BX, CX, SI, DI, ES
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
 LoadColorTheme:
 	call	Buffers_GetFileBufferToESDI
+	call	Buffers_IsXtideUniversalBiosSignatureInESDI
+	jnz		SHORT .Return
 .FromROM:
 	mov		ax, [es:ROMVARS.pColorTheme]
 	jmp		ReadColorTheme
-
+.Return:
+	ret
+
