Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm	(revision 555)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm	(revision 556)
@@ -79,9 +79,10 @@
 
 ;--------------------------------------------------------------------
-; Int 13h (Hard Drive) to Int 40h (Floppy Drive)
-; We must not call previous INT 13h for floppy drives since it
-; does not work on Windows 98 (when using HSFLOP.PDR driver) for some reason.
-;
-; DirectCallToFloppyHandler40h
+; Int 13h software interrupt handler.
+; Jumps to specific function defined in AH.
+;
+; Note to developers: Do not make recursive INT 13h calls!
+;
+; Int13h_DiskFunctionsHandler
 ;	Parameters:
 ;		AH:		Bios function
@@ -91,39 +92,9 @@
 ;		Depends on function
 ;--------------------------------------------------------------------
-DirectCallToFloppyHandler40h:
-; With serial floppy support, we handle all traffic for function 08h,
-; as we need to wrap both hard disk and floppy drive counts.
-%ifdef MODULE_SERIAL_FLOPPY
-	cmp		ah, GET_DRIVE_PARAMETERS	; 08h
-	je		SHORT WeHandleTheFloppyFunction
-%endif
-
-	int		BIOS_DISKETTE_INTERRUPT_40h
-	retf	2			; Skip FLAGS from stack
-
-
-;--------------------------------------------------------------------
-; Int 13h software interrupt handler.
-; Jumps to specific function defined in AH.
-;
-; Note to developers: Do not make recursive INT 13h calls!
-;
-; Int13h_DiskFunctionsHandler
-;	Parameters:
-;		AH:		Bios function
-;		DL:		Drive number
-;		Other:	Depends on function
-;	Returns:
-;		Depends on function
-;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
 Int13h_DiskFunctionsHandler:
-	test	dl, dl						; Floppy Drive?
-	jns		SHORT DirectCallToFloppyHandler40h
-WeHandleTheFloppyFunction:
-
 %ifndef RELOCATE_INT13H_STACK
 	sti									; Enable interrupts
-%endif	
+%endif
 	cld									; String instructions to increment pointers
 	CREATE_FRAME_INTPACK_TO_SSBP	SIZE_OF_IDEPACK_WITHOUT_INTPACK
@@ -167,6 +138,11 @@
 	jz		SHORT .OurFunction			; We handle all function 0h requests (resets)
 
-; We handle all traffic for function 08h, as we need to wrap both hard disk and floppy drive counts.
-	cmp		ah, GET_DRIVE_PARAMETERS	; 08h
+%ifndef MODULE_SERIAL_FLOPPY
+; Without floppy support, we handle only hard disk traffic for function 08h.
+	test	dl, dl
+	jns		SHORT Int13h_DirectCallToAnotherBios
+%endif
+; With floppy support, we handle all traffic for function 08h, as we need to wrap both hard disk and floppy drive counts.
+	cmp		ah, GET_DRIVE_PARAMETERS
 	je		SHORT .OurFunction
 	; Fall to Int13h_DirectCallToAnotherBios
@@ -198,5 +174,11 @@
 	push	bp
 	mov		bp, [bp+IDEPACK.intpack+INTPACK.bp]
-	int		BIOS_DISK_INTERRUPT_13h	; Can safely do as much recursion as it wants
+
+	test	dl, dl
+	js		SHORT .CallHardDiskHandler
+	int		BIOS_DISKETTE_INTERRUPT_40h	; Windows 98 requires we call INT 40h for floppy drives (reason unknown)
+	SKIP2B	bp							; Skip INT 13h
+.CallHardDiskHandler:
+	int		BIOS_DISK_INTERRUPT_13h		; Can safely do as much recursion as it wants
 
 	; Store returned values to INTPACK
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm	(revision 555)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm	(revision 556)
@@ -31,5 +31,7 @@
 	sti											; Enable interrupts
 	cld											; String instructions to increment pointers
+%ifndef USE_AT
 	call	Int13hBiosInit_RestoreSystemHandler	; Needed if initialization was started on INT 13h instead on 19h
+%endif
 	LOAD_BDA_SEGMENT_TO	es, ax					; Load BDA segment (zero) to ES
 	; Fall to .PrepareBootLoaderStack
@@ -114,5 +116,4 @@
 	mov		dl, 80h		; Reset all hard drives and floppy drives
 	int		BIOS_DISK_INTERRUPT_13h
-	;call	ResetHardDisksHandledByOurBIOS.ErrorCodeNotUsed	; Our drives only
 	; Fall to SelectDriveToBootFrom
 
Index: trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm	(revision 555)
+++ trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm	(revision 556)
@@ -37,10 +37,10 @@
 	push	ds
 
-%ifndef USE_186
-	push	ax
-	LOAD_BDA_SEGMENT_TO	ds, ax
-%else
+%ifdef USE_AT
 	push	BYTE 0
 	pop		ds
+%else
+	push	ax							; We use AX to install very late init handler
+	LOAD_BDA_SEGMENT_TO	ds, ax
 %endif
 
@@ -53,4 +53,7 @@
 	mov		[BIOS_BOOT_LOADER_INTERRUPT_19h*4+2], cs
 
+	; Very late initialization for XT builds only
+%ifndef USE_AT
+	push	es
 	; Install special INT 13h hander that initializes XTIDE Universal BIOS
 	; when our INT 19h is not called
@@ -60,7 +63,9 @@
 	mov		WORD [BIOS_DISK_INTERRUPT_13h*4], Int13hBiosInit_Handler
 	mov		[BIOS_DISK_INTERRUPT_13h*4+2], cs
+	pop		es
+%endif
 
 .SkipRomInitialization:
-%ifndef USE_186
+%ifndef USE_AT
 	pop		ax
 %endif
Index: trunk/XTIDE_Universal_BIOS/Src/Main.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Main.asm	(revision 555)
+++ trunk/XTIDE_Universal_BIOS/Src/Main.asm	(revision 556)
@@ -145,4 +145,5 @@
 
 %ifdef MODULE_8BIT_IDE_ADVANCED
+	at	ROMVARS.ideVars1+IDEVARS.wBasePort,				dw	DEVICE_XTIDE_DEFAULT_PORT		; Controller Command Block base port
 	at	ROMVARS.ideVars1+IDEVARS.bDevice,				db	DEVICE_8BIT_XTCF_PIO8
 %endif
@@ -257,5 +258,7 @@
 
 	; INT 13h Hard Disk BIOS functions
+%ifndef USE_AT
 	%include "Int13hBiosInit.asm"
+%endif
 	%include "Int13h.asm"			; For Int 13h, Disk functions
 	%include "AH0h_HReset.asm"
Index: trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm	(revision 555)
+++ trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm	(revision 556)
@@ -77,7 +77,7 @@
 	mov		WORD [RAMVARS.wDrvDetectSignature], RAMVARS_DRV_DETECT_SIGNATURE
 	mov		WORD [RAMVARS.wSignature], RAMVARS_RAM_SIGNATURE
-;; There used to be a DriveXlate_Reset call here.  It isn't necessary, as we reset
-;; when entering the boot menu and also before transferring control at boot time and
-;; for ROM boots (in int19h.asm).
+%ifdef MODULE_DRIVEXLATE
+	call	DriveXlate_Reset
+%endif
 
 	pop		es
