Index: trunk/XTIDE_Universal_BIOS/Inc/ModuleDependency.inc
===================================================================
--- trunk/XTIDE_Universal_BIOS/Inc/ModuleDependency.inc	(revision 397)
+++ trunk/XTIDE_Universal_BIOS/Inc/ModuleDependency.inc	(revision 398)
@@ -26,7 +26,17 @@
 %endif
 
+%ifdef MODULE_SERIAL_FLOPPY
+	%ifndef MODULE_SERIAL
+		%define MODULE_SERIAL
+	%endif
+%endif
+
 
 
 ; Include module specific .INC files
+%ifdef MODULE_ADVANCED_ATA
+	%include "Vision.inc"			; For QDI Vision QD65xx VLB IDE Controllers
+%endif
+
 %ifdef MODULE_EBIOS
 	%include "EBIOS.inc"			; Equates for EBIOS functions
@@ -40,7 +50,8 @@
 %endif
 
-%ifdef MODULE_ADVANCED_ATA
-	%include "Vision.inc"			; For QDI Vision QD65xx VLB IDE Controllers
+%ifdef MODULE_IRQ
+	%include "IntController.inc"
 %endif
+
 
 
@@ -70,4 +81,10 @@
 %endif
 
+%ifdef MODULE_IRQ
+	MAIN_FLG_MODULE_IRQ		EQU	FLG_ROMVARS_MODULE_IRQ
+%else
+	MAIN_FLG_MODULE_IRQ		EQU	0
+%endif
+
 %ifdef MODULE_JRIDE
 	MAIN_FLG_MODULE_JRIDE	EQU	FLG_ROMVARS_MODULE_JRIDE
@@ -94,3 +111,3 @@
 %endif
 
-MASK_ROMVARS_INCLUDED_MODULES	EQU	MAIN_FLG_MODULE_ADVANCED_ATA | MAIN_FLG_MODULE_BOOT_MENU | MAIN_FLG_MODULE_EBIOS | MAIN_FLG_MODULE_HOTKEYS | MAIN_FLG_MODULE_JRIDE | MAIN_FLG_MODULE_SERIAL | MAIN_FLG_MODULE_SERIAL_FLOPPY | MAIN_FLG_MODULE_STRINGS_COMPRESSED
+MASK_ROMVARS_INCLUDED_MODULES	EQU	MAIN_FLG_MODULE_ADVANCED_ATA | MAIN_FLG_MODULE_BOOT_MENU | MAIN_FLG_MODULE_EBIOS | MAIN_FLG_MODULE_HOTKEYS | MAIN_FLG_MODULE_IRQ | MAIN_FLG_MODULE_JRIDE | MAIN_FLG_MODULE_SERIAL | MAIN_FLG_MODULE_SERIAL_FLOPPY | MAIN_FLG_MODULE_STRINGS_COMPRESSED
Index: trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc
===================================================================
--- trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc	(revision 397)
+++ trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc	(revision 398)
@@ -70,8 +70,9 @@
 												; (Conveniently, this is 8, a fact we exploit when testing the bit)
 
-FLG_ROMVARS_MODULE_ADVANCED_ATA			EQU	(1<<8)	; Here in case the configuration needs to know functionality is present
-FLG_ROMVARS_MODULE_BOOT_MENU			EQU	(1<<9)	; Here in case the configuration needs to know functionality is present
-FLG_ROMVARS_MODULE_EBIOS				EQU	(1<<10)	; Here in case the configuration needs to know functionality is present
-FLG_ROMVARS_MODULE_HOTKEYS				EQU	(1<<11)	; Here in case the configuration needs to know functionality is present
+FLG_ROMVARS_MODULE_ADVANCED_ATA			EQU	(1<<7)	; Here in case the configuration needs to know functionality is present
+FLG_ROMVARS_MODULE_BOOT_MENU			EQU	(1<<8)	; Here in case the configuration needs to know functionality is present
+FLG_ROMVARS_MODULE_EBIOS				EQU	(1<<9)	; Here in case the configuration needs to know functionality is present
+FLG_ROMVARS_MODULE_HOTKEYS				EQU	(1<<10)	; Here in case the configuration needs to know functionality is present
+FLG_ROMVARS_MODULE_IRQ					EQU	(1<<11)	; Here in case the configuration needs to know functionality is present
 FLG_ROMVARS_MODULE_JRIDE				EQU (1<<12)	; Here in case the configuration needs to know functionality is present
 FLG_ROMVARS_MODULE_SERIAL				EQU (1<<13)	; Here in case the configuration needs to know functionality is present
@@ -118,9 +119,18 @@
 ;
 DEVICE_XTIDE_DEFAULT_PORT				EQU		300h
-DEVICE_XTIDE_DEFAULT_PORTCTRL			EQU		308h
-DEVICE_ATA_DEFAULT_PORT					EQU		1F0h
-DEVICE_ATA_DEFAULT_PORTCTRL				EQU		3F0h
-DEVICE_ATA_DEFAULT_SECONDARY_PORT		EQU		170h
-DEVICE_ATA_DEFAULT_SECONDARY_PORTCTRL	EQU		370h
+DEVICE_XTIDE_DEFAULT_PORTCTRL			EQU		DEVICE_XTIDE_DEFAULT_PORT + 8h
+
+DEVICE_ATA_PRIMARY_PORT					EQU		1F0h
+DEVICE_ATA_PRIMARY_PORTCTRL				EQU		DEVICE_ATA_PRIMARY_PORT + 200h
+
+DEVICE_ATA_SECONDARY_PORT				EQU		170h
+DEVICE_ATA_SECONDARY_PORTCTRL			EQU		DEVICE_ATA_SECONDARY_PORT + 200h
+
+DEVICE_ATA_TERTIARY_PORT				EQU		1E8h
+DEVICE_ATA_TERTIARY_PORTCTRL			EQU		DEVICE_ATA_TERTIARY_PORT + 200h
+
+DEVICE_ATA_QUATERNARY_PORT				EQU		168h
+DEVICE_ATA_QUATERNARY_PORTCTRL			EQU		DEVICE_ATA_QUATERNARY_PORT + 200h
+
 
 ; Device types for IDEVARS.bDevice
Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeWait.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeWait.asm	(revision 397)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeWait.asm	(revision 398)
@@ -55,5 +55,7 @@
 IDEDEVICE%+Wait_IRQorStatusFlagInBLwithTimeoutInBH:
 %ifdef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS		; JR-IDE/ISA does not support IRQ
-	call	IdeIrq_WaitForIRQ
+	%ifdef MODULE_IRQ
+		call	IdeIrq_WaitForIRQ
+	%endif
 %endif
 	; Always fall to IdeWait_PollStatusFlagInBLwithTimeoutInBH for error processing
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm	(revision 397)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm	(revision 398)
@@ -62,5 +62,7 @@
 	push	di
 
+%ifdef MODULE_IRQ
 	call	Interrupts_UnmaskInterruptControllerForDriveInDSDI
+%endif
 	call	Device_ResetMasterAndSlaveController
 	;jc		SHORT .ReturnError					; CF would be set if slave drive present without master
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm	(revision 397)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm	(revision 398)
@@ -104,19 +104,16 @@
 .DoNotDisplayBootMenu:
 %endif
-%endif
 
 	; Check if ROM boot (INT 18h) wanted
-%ifdef MODULE_HOTKEYS
 	cmp		BYTE [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode], ROM_BOOT_HOTKEY_SCANCODE
 	je		SHORT JumpToBootSector_or_RomBoot	; CF clear so ROM boot
-%endif
-
-	; Try to boot from Primary boot drive (00h by default)
-%ifdef MODULE_HOTKEYS
+
+	; Get Primary boot drive number to DL
 	call	HotkeyBar_GetPrimaryBootDriveNumberToDL
 %else
-	mov		dl, [cs:ROMVARS.bBootDrv]
-	and		dl, 80h		; Only 00h and 80h allowed when not using MODULE_HOTKEYS
-%endif
+	call	GetPrimaryBootDriveToDLwhenNotUsingModuleHotkeys
+%endif	; MODULE_HOTKEYS
+
+	; Try to boot from Primary boot drive (00h by default)
 	call	TryToBootFromPrimaryOrSecondaryBootDevice
 	jc		SHORT JumpToBootSector_or_RomBoot
@@ -126,6 +123,5 @@
 	call	HotkeyBar_GetSecondaryBootDriveNumberToDL
 %else
-	mov		dl, [cs:ROMVARS.bBootDrv]
-	and		dl, 80h
+	call	GetPrimaryBootDriveToDLwhenNotUsingModuleHotkeys
 	xor		dl, 80h
 %endif
@@ -203,2 +199,19 @@
 	jmp		BootSector_TryToLoadFromDriveDL
 %endif
+
+
+;--------------------------------------------------------------------
+; GetPrimaryBootDriveToDLwhenNotUsingModuleHotkeys
+;	Parameters
+;		Nothing
+;	Returns:
+;		DL:		Drive to boot from (00h or 80h)
+;	Corrupts registers:
+;		Nothing
+;--------------------------------------------------------------------
+%ifndef MODULE_HOTKEYS
+GetPrimaryBootDriveToDLwhenNotUsingModuleHotkeys:
+	mov		dl, [cs:ROMVARS.bBootDrv]
+	and		dl, 80h		; Only 00h and 80h allowed when not using MODULE_HOTKEYS
+	ret
+%endif
Index: trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/Vision.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/Vision.asm	(revision 397)
+++ trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/Vision.asm	(revision 398)
@@ -91,5 +91,5 @@
 	; QD6580 always have Primary IDE at 1F0h
 	; Secondary IDE at 170h can be enabled or disabled
-	cmp		bx, DEVICE_ATA_DEFAULT_PORT
+	cmp		bx, DEVICE_ATA_PRIMARY_PORT
 	je		SHORT .ReturnResultInZF
 
@@ -108,9 +108,9 @@
 	test	al, FLG_QDCONFIG_PRIMARY_IDE
 	jz		SHORT .CompareBXtoSecondaryIDE
-	cmp		bx, DEVICE_ATA_DEFAULT_PORT
+	cmp		bx, DEVICE_ATA_PRIMARY_PORT
 	ret
 
 .CompareBXtoSecondaryIDE:
-	cmp		bx, DEVICE_ATA_DEFAULT_SECONDARY_PORT
+	cmp		bx, DEVICE_ATA_SECONDARY_PORT
 .ReturnResultInZF:
 	ret
@@ -180,5 +180,5 @@
 	; QD6580 always has Primary channel at 1F0h. Secondary channel at 170h can be Enabled or Disabled.
 	call	AccessDPT_GetIdeBasePortToBX
-	cmp		bx, DEVICE_ATA_DEFAULT_PORT
+	cmp		bx, DEVICE_ATA_PRIMARY_PORT
 	je		SHORT .CalculateTimingTicksForQD6580	; Primary Channel so no need to modify DX
 	times 2 inc dx									; Secondary Channel IDE Timing Register
Index: trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm	(revision 397)
+++ trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm	(revision 398)
@@ -67,4 +67,7 @@
 	mov		al, BIOS_BOOT_LOADER_INTERRUPT_19h	; INT 19h interrupt vector offset
 	mov		si, Int19hReset_Handler				; INT 19h handler to reboot the system
+%ifndef MODULE_IRQ
+	; Fall to Interrupts_InstallHandlerToVectorInALFromCSSI
+%else
 	call	Interrupts_InstallHandlerToVectorInALFromCSSI
 	; Fall to .InitializeHardwareIrqHandlers
@@ -136,4 +139,5 @@
 	mov		si, IdeIrq_InterruptServiceRoutineForIrqs2to7
 	; Fall to Interrupts_InstallHandlerToVectorInALFromCSSI
+%endif ; MODULE_IRQ
 
 
@@ -158,4 +162,5 @@
 
 
+%ifdef MODULE_IRQ
 ;--------------------------------------------------------------------
 ; Interrupts_UnmaskInterruptControllerForDriveInDSDI
@@ -227,2 +232,4 @@
 .Return:
 	ret
+
+%endif ; MODULE_IRQ
Index: trunk/XTIDE_Universal_BIOS/Src/Main.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Main.asm	(revision 397)
+++ trunk/XTIDE_Universal_BIOS/Src/Main.asm	(revision 398)
@@ -46,7 +46,6 @@
 	; Included .inc files
 	%include "AssemblyLibrary.inc"	; Assembly Library. Must be included first!
+	%include "ModuleDependency.inc"	; Dependency checks for optional modules
 	%include "Version.inc"
-	%include "ModuleDependency.inc"	; Dependency checks for optional modules
-	%include "IntController.inc"	; For Interrupt Controller equates
 	%include "ATA_ID.inc"			; For ATA Drive Information structs
 	%include "IdeRegisters.inc"		; For ATA Registers, flags and commands
@@ -89,6 +88,6 @@
 	at	ROMVARS.bIdleTimeout,	db	0						; Standby timer disabled by default
 
-	at	ROMVARS.ideVars0+IDEVARS.wPort,			dw	DEVICE_ATA_DEFAULT_PORT 		; Controller Command Block base port
-	at	ROMVARS.ideVars0+IDEVARS.wPortCtrl,		dw	DEVICE_ATA_DEFAULT_PORTCTRL 	; Controller Control Block base port
+	at	ROMVARS.ideVars0+IDEVARS.wPort,			dw	DEVICE_ATA_PRIMARY_PORT 		; Controller Command Block base port
+	at	ROMVARS.ideVars0+IDEVARS.wPortCtrl,		dw	DEVICE_ATA_PRIMARY_PORTCTRL 	; Controller Control Block base port
 	at	ROMVARS.ideVars0+IDEVARS.bDevice,		db	DEVICE_16BIT_ATA
 	at	ROMVARS.ideVars0+IDEVARS.bIRQ,			db	0
@@ -96,6 +95,6 @@
 	at	ROMVARS.ideVars0+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,	db	DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE
 
-	at	ROMVARS.ideVars1+IDEVARS.wPort,			dw	DEVICE_ATA_DEFAULT_SECONDARY_PORT
-	at	ROMVARS.ideVars1+IDEVARS.wPortCtrl,		dw	DEVICE_ATA_DEFAULT_SECONDARY_PORTCTRL
+	at	ROMVARS.ideVars1+IDEVARS.wPort,			dw	DEVICE_ATA_SECONDARY_PORT
+	at	ROMVARS.ideVars1+IDEVARS.wPortCtrl,		dw	DEVICE_ATA_SECONDARY_PORTCTRL
 	at	ROMVARS.ideVars1+IDEVARS.bDevice,		db	DEVICE_16BIT_ATA
 	at	ROMVARS.ideVars1+IDEVARS.bIRQ,			db	0
@@ -103,6 +102,6 @@
 	at	ROMVARS.ideVars1+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,	db	DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE
 
-	at	ROMVARS.ideVars2+IDEVARS.wPort,			dw	1E8h
-	at	ROMVARS.ideVars2+IDEVARS.wPortCtrl,		dw	3E8h
+	at	ROMVARS.ideVars2+IDEVARS.wPort,			dw	DEVICE_ATA_TERTIARY_PORT
+	at	ROMVARS.ideVars2+IDEVARS.wPortCtrl,		dw	DEVICE_ATA_TERTIARY_PORTCTRL
 	at	ROMVARS.ideVars2+IDEVARS.bDevice,		db	DEVICE_16BIT_ATA
 	at	ROMVARS.ideVars2+IDEVARS.bIRQ,			db	0
@@ -110,6 +109,6 @@
 	at	ROMVARS.ideVars2+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,	db	DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE
 
-	at	ROMVARS.ideVars3+IDEVARS.wPort,			dw	168h
-	at	ROMVARS.ideVars3+IDEVARS.wPortCtrl,		dw	368h
+	at	ROMVARS.ideVars3+IDEVARS.wPort,			dw	DEVICE_ATA_QUATERNARY_PORT
+	at	ROMVARS.ideVars3+IDEVARS.wPortCtrl,		dw	DEVICE_ATA_QUATERNARY_PORTCTRL
 	at	ROMVARS.ideVars3+IDEVARS.bDevice,		db	DEVICE_16BIT_ATA
 	at	ROMVARS.ideVars3+IDEVARS.bIRQ,			db	0
@@ -232,5 +231,7 @@
 	%include "IdeDPT.asm"
 	%include "IdeIO.asm"
+%ifdef MODULE_IRQ
 	%include "IdeIrq.asm"
+%endif
 %undef IDEDEVICE
 %undef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS
Index: trunk/XTIDE_Universal_BIOS/makefile
===================================================================
--- trunk/XTIDE_Universal_BIOS/makefile	(revision 397)
+++ trunk/XTIDE_Universal_BIOS/makefile	(revision 398)
@@ -19,4 +19,5 @@
 # MODULE_EBIOS              Enhanced functions for accessing drives over 8.4 GB                  #
 # MODULE_HOTKEYS            Hotkey Bar to boot from any drive                                    #
+# MODULE_IRQ				IDE IRQ support                                                      #
 # MODULE_JRIDE              Support for JR-IDE/ISA                                               #
 # MODULE_SERIAL             Virtual hard disks using serial port                                 #
@@ -95,5 +96,5 @@
 DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_JRIDE MODULE_SERIAL MODULE_SERIAL_FLOPPY
 DEFINES_XTPLUS = $(DEFINES_COMMON) $(DEFINES_XT) USE_186
-DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_ADVANCED_ATA
+DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 MODULE_IRQ MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_ADVANCED_ATA
 
 DEFINES_XT_LARGE = $(DEFINES_XT) $(DEFINES_COMMON_LARGE)
