Index: /trunk/XTIDE_Universal_BIOS/Inc/Controllers/Vision.inc
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Inc/Controllers/Vision.inc	(revision 539)
+++ /trunk/XTIDE_Universal_BIOS/Inc/Controllers/Vision.inc	(revision 540)
@@ -27,6 +27,6 @@
 ; Possible base addresses for QD6500 and QD6580
 QD65XX_BASE_PORT					EQU		30h
-QD65XX_ALTERNATIVE_BASE_PORT		EQU		0B0h
-
+QD65XX_ALTERNATIVE_BASE_PORT		EQU		0B0h	; This is the default setting but Intel PIIX4 South Bridge
+													; (and likely other PCI chisets as well) mirror PIC registers here
 
 ; Vision Register offsets from QD chip base port
Index: /trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc	(revision 539)
+++ /trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc	(revision 540)
@@ -66,7 +66,4 @@
 %ifdef MODULE_SERIAL
 	FLGH_DPT_SERIAL_DEVICE				EQU	(1<<2)	; Bit 2, Serial Port Device
-%endif
-%ifdef MODULE_IRQ
-	FLGH_DPT_INTERRUPT_IN_SERVICE		EQU	(1<<3)	; Bit 3, Set when waiting for IRQ
 %endif
 %ifdef MODULE_FEATURE_SETS
Index: /trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm	(revision 539)
+++ /trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm	(revision 540)
@@ -140,8 +140,7 @@
 
 	; Clear Task Flag and set Interrupt In-Service Flag
-	or		BYTE [di+DPT.bFlagsHigh], FLGH_DPT_INTERRUPT_IN_SERVICE
 	push	ds
-	LOAD_BDA_SEGMENT_TO	ds, dx, !	; Also zero DX
-	mov		[BDA.bHDTaskFlg], dl
+	LOAD_BDA_SEGMENT_TO	ds, dx
+	mov		BYTE [BDA.bHDTaskFlg], 1	; Will be adjusted to zero later
 	pop		ds
 .DoNotSetInterruptInServiceFlag:
Index: /trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIrq.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIrq.asm	(revision 539)
+++ /trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIrq.asm	(revision 540)
@@ -33,15 +33,14 @@
 IdeIrq_WaitForIRQ:
 	push	ds
-
 	LOAD_BDA_SEGMENT_TO	ds, ax, !		; Zero AX
 	mov		ah, OS_HOOK_DEVICE_BUSY		; Hard disk busy (AX=9000h)
 	cli									; Disable interrupts
-	cmp		al, [BDA.bHDTaskFlg]		; Task flag already set?
-	jc		SHORT .ReturnFromWaitNotify	;  If so, skip OS notification
+	dec		BYTE [BDA.bHDTaskFlg]		; Clear to zero if still waiting for IRQ
+	pop		ds
+	jnz		SHORT .ReturnFromWaitNotify	; IRQ already! (CompactFlash was faster than CPU)	
 	int		BIOS_SYSTEM_INTERRUPT_15h	; OS hook, device busy
 
 .ReturnFromWaitNotify:
 	sti									; Enable interrupts
-	pop		ds
 	ret
 
@@ -61,65 +60,34 @@
 ALIGN JUMP_ALIGN
 IdeIrq_InterruptServiceRoutineForIrqs2to7:
-	push	di
 	push	ax
-	call	AcknowledgeIdeInterruptAndSetTaskFlag
+	mov		al, COMMAND_END_OF_INTERRUPT
 
-	mov		al, COMMAND_END_OF_INTERRUPT
+%ifdef USE_AT
 	jmp		SHORT AcknowledgeMasterInterruptController
-
 
 ALIGN JUMP_ALIGN
 IdeIrq_InterruptServiceRoutineForIrqs8to15:
-	push	di
 	push	ax
-	call	AcknowledgeIdeInterruptAndSetTaskFlag
-
 	mov		al, COMMAND_END_OF_INTERRUPT
 	out		SLAVE_8259_COMMAND_out, al	; Acknowledge Slave 8259
+	JMP_DELAY
 AcknowledgeMasterInterruptController:
+%endif ; USE_AT
+
 	out		MASTER_8259_COMMAND_out, al	; Acknowledge Master 8259
 
+	; Set Task Flag
+	push	ds
+	LOAD_BDA_SEGMENT_TO	ds, ax, !		; Clear AL and CF for INT 15h
+	dec		BYTE [BDA.bHDTaskFlg]		; Set task flag (or clear if IRQ occurred before call to INT 15h AH=90h)
+	sti									; Enable interrupts
+	pop		ds
+
 	; Issue Int 15h, function AX=9100h (Interrupt ready)
-	clc									; Must be called with CF clear
-	mov		ax, OS_HOOK_DEVICE_POST<<8	; Interrupt ready, device 0 (HD)
+	jz		SHORT .DoNotPostSinceIrqOccurredBeforeWait
+	mov		ah, OS_HOOK_DEVICE_POST		; Interrupt ready, device 0 (HD)
 	int		BIOS_SYSTEM_INTERRUPT_15h
+.DoNotPostSinceIrqOccurredBeforeWait:
 
 	pop		ax
-	pop		di
 	iret
-
-
-;--------------------------------------------------------------------
-; AcknowledgeIdeInterruptAndSetTaskFlag
-;	Parameters:
-;		Nothing
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		AX
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-AcknowledgeIdeInterruptAndSetTaskFlag:
-	push	ds
-	push	si
-	push	dx
-	push	bx
-
-	; Reading Status Register acknowledges IDE interrupt
-	call	RamVars_GetSegmentToDS
-	mov		bl, FLGH_DPT_INTERRUPT_IN_SERVICE
-	call	FindDPT_ToDSDIforFlagsHighInBL
-	INPUT_TO_AL_FROM_IDE_REGISTER STATUS_REGISTER_in
-
-	; Clear Interrupt In-Service Flag from DPT
-	and		BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_INTERRUPT_IN_SERVICE
-
-	; Set Task Flag
-	LOAD_BDA_SEGMENT_TO	ds, ax
-	mov		BYTE [BDA.bHDTaskFlg], 0FFh		; Set task flag
-
-	pop		bx
-	pop		dx
-	pop		si
-	pop		ds
-	ret
Index: /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm	(revision 539)
+++ /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm	(revision 540)
@@ -392,5 +392,5 @@
 	dw	UnsupportedFunction							; 12h, Controller RAM Diagnostic (XT)
 	dw	UnsupportedFunction							; 13h, Drive Diagnostic (XT)
-	dw	UnsupportedFunction							; 14h, Controller Internal Diagnostic (All)
+	dw	AH10h_HandlerForCheckDriveReady				; 14h, Controller Internal Diagnostic (All)
 	dw	AH15h_HandlerForReadDiskDriveSize			; 15h, Read Disk Drive Size (AT+)
 	dw	UnsupportedFunction							; 16h,
Index: /trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm	(revision 539)
+++ /trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm	(revision 540)
@@ -119,4 +119,5 @@
 	test	al, al
 	jz		SHORT .Return	; IRQ not used
+%ifdef USE_AT
 	cmp		al, 8
 	jb		SHORT .InstallLowIrqHandler
@@ -137,4 +138,5 @@
 	mov		si, IdeIrq_InterruptServiceRoutineForIrqs8to15
 	jmp		SHORT Interrupts_InstallHandlerToVectorInALFromCSSI
+%endif ; USE_AT
 
 ;--------------------------------------------------------------------
