Index: trunk/XTIDE_Universal_BIOS/Inc/ModuleDependency.inc
===================================================================
--- trunk/XTIDE_Universal_BIOS/Inc/ModuleDependency.inc	(revision 521)
+++ trunk/XTIDE_Universal_BIOS/Inc/ModuleDependency.inc	(revision 522)
@@ -17,4 +17,10 @@
 ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 ;
+
+; Allow RELOCATE_INT13H_STACK only for AT builds
+%ifndef USE_AT
+	%undef RELOCATE_INT13H_STACK
+%endif
+
 
 %ifdef MODULE_SERIAL_FLOPPY
Index: trunk/XTIDE_Universal_BIOS/Inc/RamVars.inc
===================================================================
--- trunk/XTIDE_Universal_BIOS/Inc/RamVars.inc	(revision 521)
+++ trunk/XTIDE_Universal_BIOS/Inc/RamVars.inc	(revision 522)
@@ -37,9 +37,10 @@
 struc RAMVARS
 %ifdef RELOCATE_INT13H_STACK
+						resb	256	; Size of our stack
+	.rgbTopOfStack:
 	.fpInt13hEntryStack	resb	4
 	.dwStackChangeDSDI:
 	.wStackChangeDI		resb	2
 	.wStackChangeDS		resb	2
-	.wNewStackOffset	resb	2
 %endif
 	.wDrvDetectSignature:			; Signature when BIOS is in drive detection mode
Index: trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm	(revision 521)
+++ trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm	(revision 522)
@@ -50,5 +50,5 @@
 	mov		di, ds		; We do not want to overwrite DS and DI in stack
 	mov		ss, di
-	mov		sp, [RAMVARS.wNewStackOffset]
+	mov		sp, RAMVARS.rgbTopOfStack
 	lds		di, [RAMVARS.dwStackChangeDSDI]
 
Index: trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm	(revision 521)
+++ trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm	(revision 522)
@@ -80,8 +80,8 @@
 
 	mov		al, BIOS_DISK_INTERRUPT_13h			; INT 13h interrupt vector offset
+%ifdef RELOCATE_INT13H_STACK
+	mov		si, Int13h_DiskFunctionsHandlerWithStackChange
+%else
 	mov		si, Int13h_DiskFunctionsHandler
-%ifdef RELOCATE_INT13H_STACK
-	test	BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE
-	eCMOVNZ	si, Int13h_DiskFunctionsHandlerWithStackChange
 %endif
 
Index: trunk/XTIDE_Universal_BIOS/Src/Main.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Main.asm	(revision 521)
+++ trunk/XTIDE_Universal_BIOS/Src/Main.asm	(revision 522)
@@ -46,5 +46,5 @@
 	; Included .inc files
 	%include "AssemblyLibrary.inc"	; Assembly Library. Must be included first!
-	%include "ModuleDependency.inc"	; Dependency checks for optional modules
+	%include "ModuleDependency.inc"	; Dependency checks for optional modules. Must be included second!
 	%include "Version.inc"
 	%include "ATA_ID.inc"			; For ATA Drive Information structs
Index: trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm	(revision 521)
+++ trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm	(revision 522)
@@ -116,5 +116,5 @@
 
 	mul		dl
-	add		ax, BYTE RAMVARS_size		; Clears CF (will not overflow)
+	add		ax, RAMVARS_size			; Clears CF (will not overflow)
 
 	pop		dx
Index: trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm	(revision 521)
+++ trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm	(revision 522)
@@ -77,22 +77,4 @@
 	mov		WORD [RAMVARS.wDrvDetectSignature], RAMVARS_DRV_DETECT_SIGNATURE
 	mov		WORD [RAMVARS.wSignature], RAMVARS_RAM_SIGNATURE
-	; Fall to .InitializeInt13hStackChangeVariables
-
-;--------------------------------------------------------------------
-; .InitializeInt13hStackChangeVariables
-;	Parameters:
-;		DS:		RAMVARS segment
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		AX
-;--------------------------------------------------------------------
-%ifdef RELOCATE_INT13H_STACK
-.InitializeInt13hStackChangeVariables:
-	eMOVZX	ax, BYTE [cs:ROMVARS.bStealSize]
-	eSHL_IM	ax, 10			; kiB to Bytes = Top of stack offset
-	mov		[RAMVARS.wNewStackOffset], ax
-%endif
-
 ;; 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
Index: trunk/XTIDE_Universal_BIOS/makefile
===================================================================
--- trunk/XTIDE_Universal_BIOS/makefile	(revision 521)
+++ trunk/XTIDE_Universal_BIOS/makefile	(revision 522)
@@ -30,5 +30,5 @@
 # Not modules but these affect the assembly:                                                       #
 # ELIMINATE_CGA_SNOW          Prevents CGA snowing at the cost of a few bytes                      #
-# RELOCATE_INT13H_STACK       Relocates INT 13h stack to top of stolen conventional memory         #
+# RELOCATE_INT13H_STACK **    Relocates INT 13h stack to beginning of stolen conventional memory   #
 # RESERVE_DIAGNOSTIC_CYLINDER Reserve one L-CHS cylinder for compatibility with old BIOSes         #
 # USE_186                     Use instructions supported by 80188/80186 and V20/V30 and later      #
@@ -38,4 +38,5 @@
 # USE_UNDOC_INTEL             Optimizations for Intel CPU:s - do NOT use on NEC V20/V30/Sony CPU:s #
 #                                                                                                  #
+# ** AT Builds only (when USE_AT is defined)                                                       #
 ####################################################################################################
 
