Index: trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm	(revision 96)
+++ trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm	(revision 97)
@@ -45,9 +45,11 @@
 DetectDrives_WithIDEVARS:
 	push	cx
-	call	DetectPrint_StartingMasterDetect	; Print detection string
+	mov		ax, g_szMaster
+	call	DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP
 	call	DetectDrives_DetectMasterDrive		; Detect and create DPT + BOOTNFO
 	call	DetectPrint_DriveNameOrNotFound		; Print found or not found string
 
-	call	DetectPrint_StartingSlaveDetect
+	mov		ax, g_szSlave
+	call	DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP
 	call	DetectDrives_DetectSlaveDrive
 	call	DetectPrint_DriveNameOrNotFound
Index: trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm	(revision 96)
+++ trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm	(revision 97)
@@ -16,10 +16,8 @@
 ;		AX, SI
 ;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
 DetectPrint_RomFoundAtSegment:
 	push	bp
-
+	mov		bp, sp
 	mov		si, g_szRomAt
-	mov		bp, sp
 	ePUSH_T	ax, ROMVARS.szTitle			; Bios title string
 	push	cs							; BIOS segment
@@ -28,28 +26,5 @@
 
 ;--------------------------------------------------------------------
-; Displays IDE drive detection string for specific device.
-;
-; DetectPrint_StartingMasterDetect
-; DetectPrint_StartingSlaveDetect
-;	Parameters:
-;		CS:BP:	Ptr to IDEVARS
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		AX, SI
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-DetectPrint_StartingMasterDetect:
-	mov		ax, g_szMaster
-	jmp		SHORT DetectPrint_StartingDriveDetect
-ALIGN JUMP_ALIGN
-DetectPrint_StartingSlaveDetect:
-	mov		ax, g_szSlave
-	; Fall to DetectPrint_StartingDriveDetect
-
-;--------------------------------------------------------------------
-; Displays IDE drive detection string.
-;
-; DetectPrint_StartingDriveDetect
+; DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP
 ;	Parameters:
 ;		CS:AX:	Ptr to "Master" or "Slave" string
@@ -60,8 +35,6 @@
 ;		AX, SI
 ;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-DetectPrint_StartingDriveDetect:
+DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP:
 	push	bp
-
 	mov		si, [cs:bp+IDEVARS.wPort]
 	mov		bp, sp
@@ -86,5 +59,4 @@
 ;		AX, SI
 ;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
 DetectPrint_DriveNameOrNotFound:
 	push	di
@@ -101,5 +73,4 @@
 	ret
 
-ALIGN JUMP_ALIGN
 .PrintDriveNotFound:
 	mov		si, g_szNotFound
Index: trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm	(revision 96)
+++ trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm	(revision 97)
@@ -17,5 +17,4 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
 Initialize_FromMainBiosRomSearch:
 	pushf
@@ -53,5 +52,4 @@
 ;		Nothing
 ;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
 Initialize_ShouldSkip:
 	sti										; Enable interrupts
@@ -67,22 +65,41 @@
 ;		ES:		BDA Segment
 ;	Returns:
-;		Nothing
+;		DS:		RAMVARS segment
 ;	Corrupts registers:
-;		All, including segments
+;		All
 ;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
 Initialize_AndDetectDrives:
 	call	DetectPrint_RomFoundAtSegment
 	call	RamVars_Initialize
-	call	RamVars_GetSegmentToDS
 	call	Interrupts_InitializeInterruptVectors
 	call	DetectDrives_FromAllIDEControllers
-	call	CompatibleDPT_CreateForDrives80hAnd81h
+	; Fall to .StoreDptPointersToBDA
+
+;--------------------------------------------------------------------
+; .StoreDptPointersToBDA
+;	Parameters:
+;		DS:		RAMVARS segment
+;		ES:		BDA and interrupt vector segment (zero)
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		DX, DI
+;--------------------------------------------------------------------
+.StoreDptPointersToBDA:
+	mov		dl, 80h
+	call	FindDPT_ForDriveNumber	; DPT to DS:DI
+	jnc		SHORT .FindForDrive81h	; Store nothing if not our drive
+	mov		[es:INTV_HD0DPT*4], di
+	mov		[es:INTV_HD0DPT*4+2], ds
+.FindForDrive81h:
+	inc		dx
+	call	FindDPT_ForDriveNumber
+	jnc		SHORT .ResetDetectedDrives
+	mov		[es:INTV_HD1DPT*4], di
+	mov		[es:INTV_HD1DPT*4+2], ds
 	; Fall to .ResetDetectedDrives
 
 ;--------------------------------------------------------------------
-; Resets all hard disks.
-;
-; Initialize_ResetDetectedDrives
+; .ResetDetectedDrives
 ;	Parameters:
 ;		DS:		RAMVARS segment
@@ -92,5 +109,4 @@
 ;		AX, BX, CX, DX, DI
 ;--------------------------------------------------------------------
-;ALIGN JUMP_ALIGN
 .ResetDetectedDrives:
 	jmp		AH0h_ResetHardDisksHandledByOurBIOS
Index: trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm	(revision 96)
+++ trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm	(revision 97)
@@ -15,14 +15,9 @@
 ;		All except segments
 ;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
 Interrupts_InitializeInterruptVectors:
-	call	Interrupts_InitializeInt13hAnd40h
-	call	Interrupts_InitializeInt19h
-	jmp		SHORT Interrupts_InitializeHardwareIrqHandlers
-	; Maybe all this should be inlined?
-
-
-;--------------------------------------------------------------------
-; Interrupts_Int13hAnd40h
+	; Fall to .InitializeInt13hAnd40h
+
+;--------------------------------------------------------------------
+; .InitializeInt13hAnd40h
 ;	Parameters:
 ;		DS:		RAMVARS segment
@@ -33,6 +28,5 @@
 ;		AX, BX, CX, DX, SI, DI
 ;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-Interrupts_InitializeInt13hAnd40h:
+.InitializeInt13hAnd40h:
 	mov		ax, [es:INTV_DISK_FUNC*4]			; Load old INT 13h offset
 	mov		dx, [es:INTV_DISK_FUNC*4+2]			; Load old INT 13h segment
@@ -47,13 +41,11 @@
 	; 40h from 13h. That system locks to infinite loop if we copy 13h to 40h.
 	call	FloppyDrive_IsInt40hInstalled
-	jc		SHORT .Return
-	mov		[es:INTV_FLOPPY_FUNC*4], ax		; Store offset
-	mov		[es:INTV_FLOPPY_FUNC*4+2], dx	; Store segment
-.Return:
-	ret
-
-
-;--------------------------------------------------------------------
-; Interrupts_InitializeInt19h
+	jc		SHORT .InitializeInt19h
+	mov		[es:INTV_FLOPPY_FUNC*4], ax		; Store old INT 13h offset
+	mov		[es:INTV_FLOPPY_FUNC*4+2], dx	; Store old INT 13h segment
+	; Fall to .InitializeInt19h
+
+;--------------------------------------------------------------------
+; .InitializeInt19h
 ;	Parameters:
 ;		DS:		RAMVARS segment
@@ -64,13 +56,12 @@
 ;		BX, SI
 ;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-Interrupts_InitializeInt19h:
+.InitializeInt19h:
 	mov		bx, INTV_BOOTSTRAP
 	mov		si, Int19hMenu_BootLoader
-	jmp		Interrupts_InstallHandlerToVectorInBXFromCSSI
-
-
-;--------------------------------------------------------------------
-; Interrupts_InitializeHardwareIrqHandlers
+	call	Interrupts_InstallHandlerToVectorInBXFromCSSI
+	; Fall to .InitializeHardwareIrqHandlers
+
+;--------------------------------------------------------------------
+; .InitializeHardwareIrqHandlers
 ;	Parameters:
 ;		ES:		BDA and Interrupt Vector segment (zero)
@@ -80,9 +71,7 @@
 ;		BX, CX, DX, SI, DI
 ;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-Interrupts_InitializeHardwareIrqHandlers:
+.InitializeHardwareIrqHandlers:
 	call	RamVars_GetIdeControllerCountToCX
 	mov		di, ROMVARS.ideVars0			; CS:SI points to first IDEVARS
-ALIGN JUMP_ALIGN
 .IdeControllerLoop:
 	eMOVZX	bx, BYTE [cs:di+IDEVARS.bIRQ]
@@ -103,5 +92,4 @@
 ;		BX, SI
 ;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
 .InstallLowOrHighIrqHandler:
 	test	bl, bl
@@ -121,6 +109,5 @@
 ;		BX, SI
 ;--------------------------------------------------------------------
-;ALIGN JUMP_ALIGN
-;.InstallHighIrqHandler:
+.InstallHighIrqHandler:
 	add		bx, BYTE INTV_IRQ8 - 8			; Interrupt vector number
 	mov		si, HIRQ_InterruptServiceRoutineForIrqs8to15
@@ -137,5 +124,4 @@
 ;		BX, SI
 ;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
 .InstallLowIrqHandler:
 	add		bx, BYTE INTV_IRQ0				; Interrupt vector number
@@ -155,5 +141,4 @@
 ;		BX
 ;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
 Interrupts_InstallHandlerToVectorInBXFromCSSI:
 	eSHL_IM	bx, 2					; Shift for DWORD offset
@@ -172,5 +157,4 @@
 ;		AX, BX, DX
 ;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
 Interrupts_UnmaskInterruptControllerForDriveInDSDI:
 	eMOVZX	bx, BYTE [di+DPT.bIdeOff]
@@ -191,6 +175,5 @@
 ;		AX, DX
 ;--------------------------------------------------------------------
-;ALIGN JUMP_ALIGN
-;.UnmaskHighIrqController:
+.UnmaskHighIrqController:
 	sub		al, 8				; Slave interrupt number
 	mov		dx, PORT_8259SL_IMR	; Load Slave Mask Register address
@@ -208,5 +191,4 @@
 ;		AX, DX
 ;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
 .UnmaskLowIrqController:
 	mov		dx, PORT_8259MA_IMR	; Load Mask Register address
@@ -223,5 +205,4 @@
 ;		AX
 ;--------------------------------------------------------------------
-;ALIGN JUMP_ALIGN
 .ClearBitFrom8259MaskRegister:
 	push	cx
