Index: trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm	(revision 254)
+++ trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm	(revision 258)
@@ -43,4 +43,5 @@
 
 %ifdef MODULE_SERIAL
+;----------------------------------------------------------------------
 ;
 ; if serial drive detected, do not scan (avoids duplicate drives and isn't needed - we already have a connection)
@@ -57,5 +58,44 @@
 %endif
 
-.done:
+.done:	
+%ifdef MODULE_SERIAL_FLOPPY
+;----------------------------------------------------------------------
+;
+; Add in any emulated serial floppy drives.
+;
+	mov		al, [RAMVARS.xlateVars+XLATEVARS.bFlopCreateCnt]
+	dec		al
+	mov		cl, al
+	js		.NoFloppies						; if no drives are present, we store 0ffh
+
+	call	FloppyDrive_GetCountFromBIOS_or_BDA
+
+	push	ax
+
+	add		al, cl							; Add our drives to existing drive count
+	cmp		al, 3							; For BDA, max out at 4 drives (ours is zero based)
+	jl		.MaxBDAFloppiesExceeded
+	mov		al, 3							
+.MaxBDAFloppiesExceeded:
+	eROR_IM	al, 2							; move to bits 6-7
+	inc		ax								; low order bit, indicating floppy drive exists
+
+	mov		ah, [es:BDA.wEquipment]			; Load Equipment WORD low byte	
+	and		ah, 03eh						; Mask off drive number and drives present bit
+	or		al, ah							; Or in new values
+	mov		[es:BDA.wEquipment], al			; and store
+
+	mov		al, 1eh							; BDA pointer to Floppy DPT
+	mov		si, AH8h_FloppyDPT
+	call	Interrupts_InstallHandlerToVectorInALFromCSSI
+
+	pop		ax
+
+	shr		cl, 1							; number of drives, 1 or 2 only, to CF flag (clear=1, set=2)
+	rcl		al, 1							; starting drive number in upper 7 bits, number of drives in low bit
+.NoFloppies:	
+	mov		[RAMVARS.xlateVars+XLATEVARS.bFlopCntAndFirst], al
+%endif
+		
 	ret
 
Index: trunk/XTIDE_Universal_BIOS/Src/Initialization/FloppyDrive.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Initialization/FloppyDrive.asm	(revision 254)
+++ trunk/XTIDE_Universal_BIOS/Src/Initialization/FloppyDrive.asm	(revision 258)
@@ -120,26 +120,31 @@
 ; Returns number of Floppy Drives in system.
 ;
-; FloppyDrive_GetCountToCX
-;	Parameters:
-;		Nothing
-;	Returns:
-;		CX:		Number of Floppy Drives
-;	Corrupts registers:
-;		Nothing
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-FloppyDrive_GetCountToCX:
+; FloppyDrive_GetCountToAX
+;	Parameters:
+;		DS:		RAMVARS Segment
+;	Returns:
+;		AX:		Number of Floppy Drives
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+FloppyDrive_GetCountToAX:		
+%ifdef MODULE_SERIAL_FLOPPY
+	call	RamVars_UnpackFlopCntAndFirstToAL
+	adc		al,1						; adds in the drive count bit, and adds 1 for count vs. 0-index, 
+										; but still won't impact SF
+	jns		.UseInternalNumber			; need to clear CH on the way out, and add in additional drive numbers
+
+%endif
+	call	FloppyDrive_GetCountFromBIOS_or_BDA
+		
+.UseInternalNumber:	
+	mov		ah, [cs:ROMVARS.bMinFddCnt]
+	MAX_U	al, ah
+	cbw
+		
+	ret
+
+ALIGN JUMP_ALIGN		
+FloppyDrive_GetCountFromBIOS_or_BDA:
 	push	es
-%ifdef USE_AT
-	call	GetCountFromBIOS
-%else
-	call	GetCountFromBDA
-%endif
-	mov		ch, [cs:ROMVARS.bMinFddCnt]
-	MAX_U	cl, ch
-	pop		es
-	xor		ch, ch
-	ret
-
 
 ;--------------------------------------------------------------------
@@ -160,22 +165,18 @@
 %ifdef USE_AT
 ALIGN JUMP_ALIGN
-GetCountFromBIOS:
+.GetCountFromBIOS:
 	push	di
 	push	dx
 	push	bx
-	push	ax
 
 	mov		ah, 08h					; Get Drive Parameters
 	cwd								; Floppy Drive 00h
 	int		BIOS_DISKETTE_INTERRUPT_40h
-	mov		cl, dl					; Number of Floppy Drives to CL
-
-	pop		ax
+	mov		al, dl					; Number of Floppy Drives to AL
+
 	pop		bx
 	pop		dx
 	pop		di
-	ret
-%endif
-
+%endif
 
 ;--------------------------------------------------------------------
@@ -193,11 +194,14 @@
 %ifndef USE_AT
 ALIGN JUMP_ALIGN
-GetCountFromBDA:
-	LOAD_BDA_SEGMENT_TO	es, cx
-	mov		cl, [es:BDA.wEquipment]			; Load Equipment WORD low byte
-	mov		ch, cl							; Copy it to CH
-	and		cx, 0C001h						; Leave bits 15..14 and 0
-	eROL_IM	ch, 2							; EW low byte bits 7..6 to 1..0
-	add		cl, ch							; CL = Floppy Drive count
-	ret
-%endif
+.GetCountFromBDA:
+	LOAD_BDA_SEGMENT_TO	es, ax
+	mov		al, [es:BDA.wEquipment]			; Load Equipment WORD low byte
+	mov		ah, al							; Copy it to CH
+	and		ax, 0C001h						; Leave bits 15..14 and 0
+	eROL_IM	ah, 2							; EW low byte bits 7..6 to 1..0
+	add		al, ah							; CL = Floppy Drive count
+%endif
+
+	pop		es
+	ret
+		
Index: trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm	(revision 254)
+++ trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm	(revision 258)
@@ -29,7 +29,7 @@
 
 	; Install INT 19h handler (boot loader) where drives are detected
-	mov		bx, BIOS_BOOT_LOADER_INTERRUPT_19h
+	mov		al, BIOS_BOOT_LOADER_INTERRUPT_19h
 	mov		si, Int19h_BootLoaderHandler
-	call	Interrupts_InstallHandlerToVectorInBXFromCSSI
+	call	Interrupts_InstallHandlerToVectorInALFromCSSI
 
 .SkipRomInitialization:
@@ -73,5 +73,5 @@
 	mov		dl, 80h
 	call	RamVars_IsDriveHandledByThisBIOS
-	jnc		SHORT .FindForDrive81h	; Store nothing if not our drive
+	jc		SHORT .FindForDrive81h	; Store nothing if not our drive
 	call	FindDPT_ForDriveNumber	; DPT to DS:DI
 	mov		[es:HD0_DPT_POINTER_41h*4], di
@@ -80,5 +80,5 @@
 	inc		dx
 	call	RamVars_IsDriveHandledByThisBIOS
-	jnc		SHORT .ResetDetectedDrives
+	jc		SHORT .ResetDetectedDrives
 	call	FindDPT_ForDriveNumber
 	mov		[es:HD1_DPT_POINTER_46h*4], di
Index: trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm	(revision 254)
+++ trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm	(revision 258)
@@ -34,8 +34,4 @@
 	mov		ax, [es:BIOS_DISK_INTERRUPT_13h*4]	; Load old INT 13h offset
 	mov		[RAMVARS.fpOldI13h], ax				; Store old INT 13h offset
-
-	mov		bx, BIOS_DISK_INTERRUPT_13h			; INT 13h interrupt vector offset
-	mov		si, Int13h_DiskFunctionsHandler		; Interrupt handler offset
-	call	Interrupts_InstallHandlerToVectorInBXFromCSSI
 
 	; Only store INT 13h handler to 40h if 40h is not already installed.
@@ -47,4 +43,8 @@
 	mov		[es:BIOS_DISKETTE_INTERRUPT_40h*4+2], dx	; Store old INT 13h segment
 .Int40hAlreadyInstalled:
+
+	mov		al, BIOS_DISK_INTERRUPT_13h			; INT 13h interrupt vector offset
+	mov		si, Int13h_DiskFunctionsHandler		; Interrupt handler offset
+	call	Interrupts_InstallHandlerToVectorInALFromCSSI
 	; Fall to .InitializeHardwareIrqHandlers
 
@@ -56,5 +56,5 @@
 ;		Nothing
 ;	Corrupts registers:
-;		BX, CX, DX, SI, DI
+;		BX, CX, DX, SI, DI, AX
 ;--------------------------------------------------------------------
 .InitializeHardwareIrqHandlers:
@@ -62,5 +62,5 @@
 	mov		di, ROMVARS.ideVars0			; CS:SI points to first IDEVARS
 .IdeControllerLoop:
-	eMOVZX	bx, BYTE [cs:di+IDEVARS.bIRQ]
+	mov		al, BYTE [cs:di+IDEVARS.bIRQ]
 	add		di, BYTE IDEVARS_size			; Increment to next controller
 	call	.InstallLowOrHighIrqHandler
@@ -72,5 +72,5 @@
 ; .InstallLowOrHighIrqHandler
 ;	Parameters:
-;		BX:		IRQ number, 0 if IRQ disabled
+;		AL:		IRQ number, 0 if IRQ disabled
 ;		ES:		BDA and Interrupt Vector segment (zero)
 ;	Returns:
@@ -80,7 +80,7 @@
 ;--------------------------------------------------------------------
 .InstallLowOrHighIrqHandler:
-	test	bl, bl
+	test	al, al
 	jz		SHORT .Return	; IRQ not used
-	cmp		bl, 8
+	cmp		al, 8
 	jb		SHORT .InstallLowIrqHandler
 	; Fall to .InstallHighIrqHandler
@@ -94,31 +94,31 @@
 ;		Nothing
 ;	Corrupts registers:
-;		BX, SI
+;		AL, BX, SI
 ;--------------------------------------------------------------------
 .InstallHighIrqHandler:
-	add		bx, BYTE HARDWARE_IRQ_8_INTERRUPT_70h - 8	; Interrupt vector number
+	add		al, BYTE HARDWARE_IRQ_8_INTERRUPT_70h - 8	; Interrupt vector number
 	mov		si, IdeIrq_InterruptServiceRoutineForIrqs8to15
-	jmp		SHORT Interrupts_InstallHandlerToVectorInBXFromCSSI
+	jmp		SHORT Interrupts_InstallHandlerToVectorInALFromCSSI
 
 ;--------------------------------------------------------------------
 ; .InstallLowIrqHandler
 ;	Parameters:
-;		BX:		IRQ number (0...7)
-;		ES:		BDA and Interrupt Vector segment (zero)
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		BX, SI
+;		AL:		IRQ number (0...7)
+;		ES:		BDA and Interrupt Vector segment (zero)
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AL, BX, SI
 ;--------------------------------------------------------------------
 .InstallLowIrqHandler:
-	add		bx, BYTE HARDWARE_IRQ_0_INTERRUPT_08h		; Interrupt vector number
+	add		al, BYTE HARDWARE_IRQ_0_INTERRUPT_08h		; Interrupt vector number
 	mov		si, IdeIrq_InterruptServiceRoutineForIrqs2to7
-	; Fall to Interrupts_InstallHandlerToVectorInBXFromCSSI
-
-
-;--------------------------------------------------------------------
-; Interrupts_InstallHandlerToVectorInBXFromCSSI
-;	Parameters:
-;		BX:		Interrupt vector number (for example 13h)
+	; Fall to Interrupts_InstallHandlerToVectorInALFromCSSI
+
+
+;--------------------------------------------------------------------
+; Interrupts_InstallHandlerToVectorInALFromCSSI
+;	Parameters:
+;		AL:		Interrupt vector number (for example 13h)
 ;		ES:		BDA and Interrupt Vector segment (zero)
 ;		CS:SI:	Ptr to interrupt handler
@@ -126,8 +126,10 @@
 ;		Nothing
 ;	Corrupts registers:
-;		BX
-;--------------------------------------------------------------------
-Interrupts_InstallHandlerToVectorInBXFromCSSI:
-	eSHL_IM	bx, 2					; Shift for DWORD offset
+;		AX, BX
+;--------------------------------------------------------------------
+Interrupts_InstallHandlerToVectorInALFromCSSI:
+	mov		bl, 4					; Shift for DWORD offset, MUL smaller than other alternatives
+	mul		bl
+	xchg	ax, bx
 	mov		[es:bx], si				; Store offset
 	mov		[es:bx+2], cs			; Store segment
