Index: /trunk/XTIDE_Universal_BIOS/Inc/BootVars.inc
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Inc/BootVars.inc	(revision 242)
+++ /trunk/XTIDE_Universal_BIOS/Inc/BootVars.inc	(revision 243)
@@ -56,5 +56,5 @@
 ; STORE_POST_STACK_POINTER
 ;	Parameters:
-;		DS:		BDA and Interrupt Vector segment (zero)
+;		ES:		BDA and Interrupt Vector segment (zero)
 ;	Returns:
 ;		Nothing
@@ -63,6 +63,6 @@
 ;--------------------------------------------------------------------
 %macro STORE_POST_STACK_POINTER 0
-	mov		[BOOTVARS.dwPostStack], sp
-	mov		[BOOTVARS.dwPostStack+2], ss
+	mov		[es:BOOTVARS.dwPostStack], sp
+	mov		[es:BOOTVARS.dwPostStack+2], ss
 %endmacro
 
@@ -102,26 +102,26 @@
 ; Restores SS and SP to initial boot loader values.
 ;
-; Before doing any changes, see the note regarding
-; LOAD_BDA_SEGMENT_TO in BootVars_SwitchToBootMenuStack
+; Note! Must return with AX=0 and CF preserved.
+; See Int19hMenu_JumpToBootSector_or_RomBoot.
 ;
 ; SWITCH_BACK_TO_POST_STACK
 ;	Parameters:
-;		Nothing
+;		AX:		BDA and Interrupt Vector segment (zero)
 ;	Returns:
 ;		SS:SP:	Ptr to POST stack
 ;	Corrupts registers:
-;		Nothing
+;		Nothing (not even FLAGS)
 ;--------------------------------------------------------------------
 %macro SWITCH_BACK_TO_POST_STACK 0
 %ifndef USE_386
-	cli									; Disable interrupts
-	LOAD_BDA_SEGMENT_TO	ss, sp
+	cli
+	mov		ss, ax
 	mov		sp, [ss:BOOTVARS.dwPostStack]
 	mov		ss, [ss:BOOTVARS.dwPostStack+2]
-	sti									; Enable interrupts
+	sti
 %else
-	LOAD_BDA_SEGMENT_TO	ss, sp
+	mov		ss, ax
 	lss		sp, [ss:BOOTVARS.dwPostStack]
-%endif
+%endif	
 %endmacro
 
Index: /trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc	(revision 242)
+++ /trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc	(revision 243)
@@ -17,4 +17,5 @@
 	.wFlags				resb	2	; Word for ROM flags
 	.wDisplayMode		resb	2	; Display mode for boot menu
+	.wfDisplayBootMenu:				; Zero = no Boot Menu, non-zero = Boot Menu timeout
 	.wBootTimeout		resb	2	; Boot Menu selection timeout in system timer ticks
 	.bIdeCnt			resb	1	; Number of available IDE controllers
@@ -39,4 +40,5 @@
 												; by holding down the ALT key at the end of drive detection.
 												; (Conveniently, this is 8, a fact we exploit when testing the bit)
+FLG_ROMVARS_MODULE_JRIDE			EQU	(1<<5)	; Here in case the configuration needs to know functionality is present
 FLG_ROMVARS_MODULE_SERIAL			EQU (1<<6)	; Here in case the configuration needs to know functionality is present
 FLG_ROMVARS_MODULE_EBIOS			EQU (1<<7)	; Here in case the configuration needs to know functionality is present
Index: /trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenu.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenu.asm	(revision 242)
+++ /trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenu.asm	(revision 243)
@@ -8,5 +8,5 @@
 ; Displays Boot Menu and returns Drive or Function number.
 ;
-; BootMenu_DisplayAndReturnSelection
+; BootMenu_DisplayAndReturnSelectionInDX
 ;	Parameters:
 ;		DS:		RAMVARS segment
@@ -17,5 +17,5 @@
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
-BootMenu_DisplayAndReturnSelection:
+BootMenu_DisplayAndReturnSelectionInDX:
 	call	DriveXlate_Reset
 	call	BootMenuPrint_TheBottomOfScreen
@@ -23,5 +23,5 @@
 	call	BootMenuPrint_ClearScreen
 	call	BootMenu_GetDriveToDXforMenuitemInCX
-	jnc		BootMenu_DisplayAndReturnSelection
+	jnc		BootMenu_DisplayAndReturnSelectionInDX
 	ret
 
Index: /trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm	(revision 242)
+++ /trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm	(revision 243)
@@ -426,10 +426,2 @@
 	db		2880  / FloppyTypes.rgbCapacityMultiplier    ;  type 5
 	db		2880  / FloppyTypes.rgbCapacityMultiplier    ;  type 6
-
-
-
-
-		
-
-
-		
Index: /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm	(revision 243)
+++ /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm	(revision 243)
@@ -0,0 +1,131 @@
+; Project name	:	XTIDE Universal BIOS
+; Description	:	Int 19h Handler (Boot Loader).
+
+; Section containing code
+SECTION .text
+
+;--------------------------------------------------------------------
+; Int19h_BootLoaderHandler
+;	Parameters:
+;		Nothing
+;	Returns:
+;		Never returns (loads operating system)
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+Int19h_BootLoaderHandler:
+	LOAD_BDA_SEGMENT_TO	es, ax
+	call	Initialize_AndDetectDrives		; Installs new boot menu loader
+	; Fall to .PrepareStackAndSelectDriveFromBootMenu
+
+;--------------------------------------------------------------------
+; .PrepareStackAndSelectDriveFromBootMenu
+;	Parameters:
+;		ES:		BDA and interrupt vector segment (zero)
+;	Returns:
+;		Never returns (loads operating system)
+;--------------------------------------------------------------------
+.PrepareStackAndSelectDriveFromBootMenu:
+	STORE_POST_STACK_POINTER
+	SWITCH_TO_BOOT_MENU_STACK
+	; Fall to .InitializeDisplay
+
+;--------------------------------------------------------------------
+; .InitializeDisplay
+;	Parameters:
+;		Nothing
+;	Returns:
+;		Never returns (loads operating system)
+;--------------------------------------------------------------------
+.InitializeDisplay:
+	; Change display mode if necessary
+	mov		ax, [cs:ROMVARS.wDisplayMode]	; AH 00h = Set Video Mode
+	cmp		al, DEFAULT_TEXT_MODE
+	je		SHORT .InitializeDisplayLibrary
+	int		BIOS_VIDEO_INTERRUPT_10h
+.InitializeDisplayLibrary:
+	call	BootMenuPrint_InitializeDisplayContext
+	; Fall to .SelectDriveToBootFrom
+
+;--------------------------------------------------------------------
+; .SelectDriveToBootFrom
+;	Parameters:
+;		Nothing
+;	Returns:
+;		Never returns (loads operating system)
+;--------------------------------------------------------------------
+.SelectDriveToBootFrom:
+	call	RamVars_GetSegmentToDS
+	cmp		WORD [cs:ROMVARS.wfDisplayBootMenu], BYTE 0
+	jne		SHORT ProcessBootMenuSelectionsUntilBootableDriveSelected	; Display boot menu
+	; Fall to BootFromDriveAthenTryDriveC
+
+;--------------------------------------------------------------------
+; BootFromDriveAthenTryDriveC
+;	Parameters:
+;		DS:		RAMVARS segment
+;	Returns:
+;		Never returns (loads operating system)
+;--------------------------------------------------------------------
+BootFromDriveAthenTryDriveC:
+	xor		dx, dx				; DL = 00h = Floppy Drive A
+	call	BootSector_TryToLoadFromDriveDL
+	jc		SHORT Int19hMenu_JumpToBootSector_or_RomBoot
+	mov		dl, 80h				; DL = 80h = First Hard Drive (usually C)
+	call	BootSector_TryToLoadFromDriveDL
+	jmp		SHORT Int19hMenu_JumpToBootSector_or_RomBoot	; ROM Boot if error
+
+
+;--------------------------------------------------------------------
+; ProcessBootMenuSelectionsUntilBootableDriveSelected
+;	Parameters:
+;		DS:		RAMVARS segment
+;	Returns:
+;		Never returns
+;--------------------------------------------------------------------
+ProcessBootMenuSelectionsUntilBootableDriveSelected:
+	call	BootMenu_DisplayAndReturnSelectionInDX
+	call	DriveXlate_ToOrBack											; Translate drive number
+	call	BootSector_TryToLoadFromDriveDL
+	jnc		SHORT ProcessBootMenuSelectionsUntilBootableDriveSelected	; Boot failure, show menu again
+	; Fall to Int19hMenu_JumpToBootSector_or_RomBoot
+	; (CF is set or we wouldn't be here, see "jnc" immediately above)
+
+;--------------------------------------------------------------------
+; Int19hMenu_JumpToBootSector_or_RomBoot
+;
+; Switches back to the POST stack, clears the DS and ES registers,
+; and either jumps to the MBR (Master Boot Record) that was just read,
+; or calls the ROM's boot routine on interrupt 18.
+;
+;	Parameters:
+;		DL:		Drive to boot from (translated, 00h or 80h)
+;       CF:     Set for Boot Sector Boot 
+;               Clear for Rom Boot
+;	   	ES:BX:	(if CF set) Ptr to boot sector
+;
+;	Returns:
+;		Never returns
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+Int19hMenu_JumpToBootSector_or_RomBoot:
+	mov		cx, es		; Preserve MBR segment (can't push because of stack change)
+	mov		ax, 0		; NOTE: can't use XOR (LOAD_BDA_SEGMENT_TO) as it impacts CF
+	SWITCH_BACK_TO_POST_STACK
+
+; clear segment registers before boot sector or rom call
+	mov		ds, ax		
+	mov		es, ax
+%ifdef USE_386
+	mov		fs, ax
+	mov		gs, ax
+%endif
+	jnc		SHORT .romboot
+
+; jump to boot sector
+	push	cx			; sgment address for MBR
+	push	bx			; offset address for MBR
+	retf				; NOTE:	DL is set to the drive number
+
+; Boot by calling INT 18h (ROM Basic of ROM DOS)
+.romboot:
+	int		BIOS_BOOT_FAILURE_INTERRUPT_18h	; Never returns		
Index: unk/XTIDE_Universal_BIOS/Src/Handlers/Int19hMenu.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19hMenu.asm	(revision 242)
+++ 	(revision )
@@ -1,116 +1,0 @@
-; Project name	:	XTIDE Universal BIOS
-; Description	:	Int 19h BIOS functions for Boot Menu.
-
-; Section containing code
-SECTION .text
-
-;--------------------------------------------------------------------
-; Boot Menu Loader.
-;
-; Int19hMenu_BootLoader
-;	Parameters:
-;		Nothing
-;	Returns:
-;		Jumps to Int19hMenu_Display, then never returns
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-Int19hMenu_BootLoader:
-	; Store POST stack pointer
-	LOAD_BDA_SEGMENT_TO	ds, ax
-	STORE_POST_STACK_POINTER
-	SWITCH_TO_BOOT_MENU_STACK
-	call	RamVars_GetSegmentToDS
-	; Fall to .InitializeDisplayForBootMenu
-
-;--------------------------------------------------------------------
-; .InitializeDisplayForBootMenu
-;	Parameters:
-;		Nothing
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		AX, DI
-;--------------------------------------------------------------------
-.InitializeDisplayForBootMenu:
-	; Change display mode if necessary
-	mov		ax, [cs:ROMVARS.wDisplayMode]	; AH 00h = Set Video Mode
-	cmp		al, DEFAULT_TEXT_MODE
-	je		SHORT .InitializeDisplayLibrary
-	int		BIOS_VIDEO_INTERRUPT_10h
-.InitializeDisplayLibrary:	
-	call	BootMenuPrint_InitializeDisplayContext
-	; Fall to .ProcessMenuSelectionsUntilBootable
-
-;--------------------------------------------------------------------
-; .ProcessMenuSelectionsUntilBootable
-;	Parameters:
-;		DS:		RAMVARS segment
-;	Returns:
-;		Never returns
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-.ProcessMenuSelectionsUntilBootable:
-	call	BootMenu_DisplayAndReturnSelection
-	call	DriveXlate_ToOrBack							; Translate drive number
-	call	BootSector_TryToLoadFromDriveDL
-	jnc		SHORT .ProcessMenuSelectionsUntilBootable	; Boot failure, show menu again
-	; Fall to Int19hMenu_JumpToBootSector_or_RomBoot
-	; (CF is set or we wouldn't be here, see "jnc" immediately above)
-
-;--------------------------------------------------------------------
-; Int19hMenu_JumpToBootSector_or_RomBoot
-;
-; Switches back to the POST stack, clears the DS and ES registers,
-; and either jumps to the MBR (Master Boot Record) that was just read,
-; or calls the ROM's boot routine on interrupt 18.
-;
-;	Parameters:
-;		DL:		Drive to boot from (translated, 00h or 80h)
-;       CF:     Set for Boot Sector Boot 
-;               Clear for Rom Boot
-;	   	ES:BX:	(if CF set) Ptr to boot sector
-;
-;	Returns:
-;		Never returns
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-Int19hMenu_JumpToBootSector_or_RomBoot:
-		mov		cx,es		; preserve MBR segment
-;
-; inline of SWITCH_BACK_TO_POST_STACK macro, so that we can preserve CF
-; and reuse zero value in ax for clearing segment registers
-;
-		mov		ax,0		; NOTE: can't use XOR as it impacts CF
-%ifndef USE_386
-		cli
-		mov		ss,ax
-		mov		sp,[ss:BOOTVARS.dwPostStack]
-		mov		ss,[ss:BOOTVARS.dwPostStack+2]
-		sti
-%else
-		mov		ss,ax
-		lss		sp,[ss:BOOTVARS.dwPostStack]
-%endif	
-;
-; end inline of SWITCH_BACK_TO_POST_STACK
-;
-
-; clear segment registers before boot sector or rom call
-; (old ClearSegmentsForBoot routine)
-;
-		mov		ds,ax		
-		mov		es,ax
-
-		jnc		.romboot
-
-; jump to boot sector
-; (old JumpToBootSector routine)
-;
-		push	cx			; sgment address for MBR
-		push	bx			; offset address for MBR
-		retf				; NOTE:	DL is set to the drive number
-
-; (old Int19hMenu_RomBoot routine)
-;
-.romboot:		
-		int		BIOS_BOOT_FAILURE_INTERRUPT_18h	; Never returns		
Index: /trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm	(revision 242)
+++ /trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm	(revision 243)
@@ -30,5 +30,5 @@
 	; Install INT 19h handler (boot loader) where drives are detected
 	mov		bx, BIOS_BOOT_LOADER_INTERRUPT_19h
-	mov		si, HandlerForLateInitialization
+	mov		si, Int19h_BootLoaderHandler
 	call	Interrupts_InstallHandlerToVectorInBXFromCSSI
 
@@ -39,17 +39,4 @@
 	popf
 	retf
-
-
-;--------------------------------------------------------------------
-; HandlerForLateInitialization
-;	Parameters:
-;		Nothing
-;	Returns:
-;		Never returns
-;--------------------------------------------------------------------
-HandlerForLateInitialization:
-	LOAD_BDA_SEGMENT_TO	es, ax
-	call	Initialize_AndDetectDrives		; Installs new boot menu loader
-	int		BIOS_BOOT_LOADER_INTERRUPT_19h	; Display boot menu
 
 
@@ -103,8 +90,9 @@
 ;	Parameters:
 ;		DS:		RAMVARS segment
+;		ES:		BDA and interrupt vector segment (zero)
 ;	Returns:
 ;		Nothing
 ;	Corrupts registers:
-;		All
+;		All, except DS and ES
 ;--------------------------------------------------------------------
 .ResetDetectedDrives:
Index: /trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm	(revision 242)
+++ /trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm	(revision 243)
@@ -43,23 +43,8 @@
 	; 40h from 13h. That system locks to infinite loop if we copy 13h to 40h.
 	call	FloppyDrive_IsInt40hInstalled
-	jc		SHORT .InitializeInt19h
+	jc		SHORT .Int40hAlreadyInstalled
 	mov		[es:BIOS_DISKETTE_INTERRUPT_40h*4], ax		; Store old INT 13h offset
 	mov		[es:BIOS_DISKETTE_INTERRUPT_40h*4+2], dx	; Store old INT 13h segment
-	; Fall to .InitializeInt19h
-
-;--------------------------------------------------------------------
-; .InitializeInt19h
-;	Parameters:
-;		DS:		RAMVARS segment
-;		ES:		BDA and Interrupt Vector segment (zero)
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		BX, SI
-;--------------------------------------------------------------------
-.InitializeInt19h:
-	mov		bx, BIOS_BOOT_LOADER_INTERRUPT_19h
-	mov		si, Int19hMenu_BootLoader
-	call	Interrupts_InstallHandlerToVectorInBXFromCSSI
+.Int40hAlreadyInstalled:
 	; Fall to .InitializeHardwareIrqHandlers
 
Index: /trunk/XTIDE_Universal_BIOS/Src/Main.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Main.asm	(revision 242)
+++ /trunk/XTIDE_Universal_BIOS/Src/Main.asm	(revision 243)
@@ -70,9 +70,16 @@
 %endif
 
+%ifdef MODULE_JRIDE
+	MAIN_FLG_MODULE_JRIDE	equ	FLG_ROMVARS_MODULE_JRIDE
+%else
+	MAIN_FLG_MODULE_JRIDE	equ	0
+%endif
+
+
 ;---------------------------;
 ; AT Build default settings ;
 ;---------------------------;
 %ifdef USE_AT
-	at	ROMVARS.wFlags,			dw	FLG_ROMVARS_FULLMODE | FLG_ROMVARS_DRVXLAT | MAIN_FLG_MODULE_SERIAL | MAIN_FLG_MODULE_EBIOS
+	at	ROMVARS.wFlags,			dw	FLG_ROMVARS_FULLMODE | FLG_ROMVARS_DRVXLAT | MAIN_FLG_MODULE_SERIAL | MAIN_FLG_MODULE_EBIOS | MAIN_FLG_MODULE_JRIDE
 	at	ROMVARS.wDisplayMode,	dw	DEFAULT_TEXT_MODE
 	at	ROMVARS.wBootTimeout,	dw	30 * TICKS_PER_SECOND	; Boot Menu selection timeout
@@ -117,5 +124,5 @@
 ; XT and XT+ Build default settings ;
 ;-----------------------------------;
-	at	ROMVARS.wFlags,			dw	FLG_ROMVARS_DRVXLAT | MAIN_FLG_MODULE_SERIAL | MAIN_FLG_MODULE_EBIOS
+	at	ROMVARS.wFlags,			dw	FLG_ROMVARS_DRVXLAT | MAIN_FLG_MODULE_SERIAL | MAIN_FLG_MODULE_EBIOS | MAIN_FLG_MODULE_JRIDE
 	at	ROMVARS.wDisplayMode,	dw	DEFAULT_TEXT_MODE
 	at	ROMVARS.wBootTimeout,	dw	30 * TICKS_PER_SECOND	; Boot Menu selection timeout
@@ -178,5 +185,5 @@
 
 	; Boot loader
-	%include "Int19hMenu.asm"		; For Int 19h, Boot Loader for Boot Menu
+	%include "Int19h.asm"			; For Int 19h, Boot Loader
 
 	; For all device types
