Index: /trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc	(revision 546)
+++ /trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc	(revision 547)
@@ -129,5 +129,5 @@
 DEVICE_XTIDE_DEFAULT_PORTCTRL			EQU		(DEVICE_XTIDE_DEFAULT_PORT + XTIDE_CONTROL_BLOCK_OFFSET)
 ; Note XT-CF control port is SHL 1 relative to XTIDE, and coded that way hence no need for specific definition like...
-; DEVICE_XTCF_DEFAULT_PORTCTRL				EQU		(DEVICE_XTIDE_DEFAULT_PORT + XTCF_CONTROL_BLOCK_OFFSET)
+; DEVICE_XTCF_DEFAULT_PORTCTRL			EQU		(DEVICE_XTIDE_DEFAULT_PORT + XTCF_CONTROL_BLOCK_OFFSET)
 
 DEVICE_ATA_PRIMARY_PORT					EQU		1F0h
@@ -192,11 +192,9 @@
 FLG_DRVPARAMS_BLOCKMODE			EQU	(1<<4)	; Enable Block mode transfers
 FLG_DRVPARAMS_USERCHS			EQU	(1<<5)	; User specified P-CHS values
-	MAX_USER_CYLINDERS				EQU	16383
-	MAX_USER_HEADS					EQU	16
-	MAX_USER_SECTORS_PER_TRACK		EQU	63
-	MAX_USER_CHS_COUNT				EQU	(MAX_USER_CYLINDERS * MAX_USER_HEADS * MAX_USER_SECTORS_PER_TRACK)
+	MAX_PCHS_CYLINDERS				EQU	16383
+	MAX_PCHS_HEADS					EQU	16
+	MAX_PCHS_SECTORS_PER_TRACK		EQU	63
+	MAX_PCHS_TOTAL_SECTOR_COUNT		EQU	(MAX_PCHS_CYLINDERS * MAX_PCHS_HEADS * MAX_PCHS_SECTORS_PER_TRACK)	; 16,514,064
 FLG_DRVPARAMS_USERLBA			EQU	(1<<6)	; User specified LBA value
-	MIN_USER_LBA_COUNT				EQU	(MAX_USER_CHS_COUNT+1)	; Must be more than max CHS
-	MAX_USER_LBA_COUNT				EQU	((2^28)-1)				; LBA28 limit
 
 %endif ; ROMVARS_INC
Index: /trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialDPT.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialDPT.asm	(revision 546)
+++ /trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialDPT.asm	(revision 547)
@@ -48,6 +48,12 @@
 
 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
-	%if FLGH_DPT_SERIAL_DEVICE != 0x4 || FLGH_DPT_SERIAL_FLOPPY != 0x10 || FLGH_DPT_SERIAL_FLOPPY_TYPE_MASK != 0xe0 || FLGH_DPT_SERIAL_FLOPPY_TYPE_FIELD_POSITION != 5
-		%error "The serial server passes FLGH values into SerialDPT_Finalize directly.  If the flag positions are changed, corresponding changes will need to be made in the serial server, and likely a version check put in to deal with servers talking to incompatible clients"
-	%endif
+	%ifdef MODULE_SERIAL_FLOPPY
+		%if FLGH_DPT_SERIAL_DEVICE != 0x4 || FLGH_DPT_SERIAL_FLOPPY != 0x10 || FLGH_DPT_SERIAL_FLOPPY_TYPE_MASK != 0xe0 || FLGH_DPT_SERIAL_FLOPPY_TYPE_FIELD_POSITION != 5
+			%error "The serial server passes FLGH values into SerialDPT_Finalize directly.  If the flag positions are changed, corresponding changes will need to be made in the serial server, and likely a version check put in to deal with servers talking to incompatible clients"
+		%endif
+	%else
+		%if FLGH_DPT_SERIAL_DEVICE != 0x4
+			%error "The serial server passes FLGH values into SerialDPT_Finalize directly.  If the flag positions are changed, corresponding changes will need to be made in the serial server, and likely a version check put in to deal with servers talking to incompatible clients"
+		%endif
+	%endif ; MODULE_SERIAL_FLOPPY
 %endif
Index: /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH15h_HSize.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH15h_HSize.asm	(revision 546)
+++ /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH15h_HSize.asm	(revision 547)
@@ -23,4 +23,9 @@
 ;--------------------------------------------------------------------
 ; Int 13h function AH=15h, Read Disk Drive Size.
+;
+; It is unclear what is the total number of sectors to return.
+; Award BIOS from 1997 returns full capacity instead of L-CHS limit
+; like we do. I think it makes more sense if this function returns
+; L-CHS limit.
 ;
 ; AH15h_HandlerForReadDiskDriveSize
Index: /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Prepare.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Prepare.asm	(revision 546)
+++ /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Prepare.asm	(revision 547)
@@ -45,4 +45,10 @@
 
 	; Make sure that sector count is valid
+	mov		al, [es:si+DAP.wSectorCount]
+	test	al, al
+	jz		SHORT ZeroSectorsRequestedSoNoErrors
+	js		SHORT InvalidNumberOfSectorsRequested
+
+%if 0	; Slow version in the unlikely case that high byte needs to be checked.
 	mov		ax, [es:si+DAP.wSectorCount]
 	test	ax, ax
@@ -50,4 +56,5 @@
 	cmp		ax, BYTE 127
 	ja		SHORT InvalidNumberOfSectorsRequested
+%endif
 
 	; Get EBIOS command index to BX
@@ -55,5 +62,5 @@
 	call	Prepare_GetOldInt13hCommandIndexToBX
 	mov		al, [di+DPT.bFlagsLow]
-	eSHL_IM	al, 1					; Set CF if LBA48 supported
+	shl		al, 1					; Set CF if LBA48 supported
 	adc		bl, bh					; LBA48 EXT commands
 	ret
Index: /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm	(revision 546)
+++ /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm	(revision 547)
@@ -86,4 +86,8 @@
 
 %ifdef MODULE_HOTKEYS
+	; Last hard drive might have scrolled Hotkey Bar out of screen.
+	; We want to display it during wait.
+	call	HotkeyBar_UpdateDuringDriveDetection
+
 .WaitUntilTimeToCloseHotkeyBar:
 	call	TimerTicks_ReadFromBdaToAX
Index: /trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm	(revision 546)
+++ /trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm	(revision 547)
@@ -246,10 +246,7 @@
 
 	; Get boot drive letters
-	call	FloppyDrive_GetCountToAX
-	mov		ah, 'A'			; AH = First Floppy Drive letter (always 'A')
-	add		al, ah
-	MAX_U	al, 'C'			; AL = First Hard Drive letter ('C', 'D', or 'E')
+	call	BootVars_GetLetterForFirstHardDriveToAX
 	test	dl, dl
-	eCMOVNS	al, ah
+	eCMOVNS	al, DEFAULT_FLOPPY_DRIVE_LETTER
 	push	ax
 
Index: /trunk/XTIDE_Universal_BIOS/Src/Initialization/FloppyDrive.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Initialization/FloppyDrive.asm	(revision 546)
+++ /trunk/XTIDE_Universal_BIOS/Src/Initialization/FloppyDrive.asm	(revision 547)
@@ -158,5 +158,5 @@
 ;				Set if BIOS function not supported
 ;	Corrupts registers:
-;		AH, ES
+;		AH
 ;--------------------------------------------------------------------
 FloppyDrive_GetCountFromBIOS_or_BDA:
Index: /trunk/XTIDE_Universal_BIOS/Src/Menus/DriveXlate.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Menus/DriveXlate.asm	(revision 546)
+++ /trunk/XTIDE_Universal_BIOS/Src/Menus/DriveXlate.asm	(revision 547)
@@ -32,5 +32,5 @@
 ;--------------------------------------------------------------------
 DriveXlate_ConvertDriveLetterInDLtoDriveNumber:
-	call	DriveXlate_GetLetterForFirstHardDriveToAX
+	call	BootVars_GetLetterForFirstHardDriveToAX
 	cmp		dl, al
 	jb		SHORT .ConvertLetterInDLtoFloppyDriveNumber
@@ -68,5 +68,5 @@
 
 	; Store default hard drive to boot from
-	call	DriveXlate_GetLetterForFirstHardDriveToAX
+	call	BootVars_GetLetterForFirstHardDriveToAX
 	add		dl, al
 	stc
@@ -75,23 +75,4 @@
 .GetDefaultFloppyDrive:
 	sub		dl, 80h - DEFAULT_FLOPPY_DRIVE_LETTER	; Clears CF
-	ret
-
-
-;--------------------------------------------------------------------
-; Returns letter for first hard disk. Usually it will be 'C' but it
-; can be higher if more than two floppy drives are found.
-;
-; DriveXlate_GetLetterForFirstHardDriveToAX
-;	Parameters:
-;		DS:		RAMVARS segment
-;	Returns:
-;		AX:		Upper case letter for first hard disk
-;	Corrupts registers:
-;		Nothing
-;--------------------------------------------------------------------
-DriveXlate_GetLetterForFirstHardDriveToAX:
-	call	FloppyDrive_GetCountToAX
-	add		al, DEFAULT_FLOPPY_DRIVE_LETTER
-	MAX_U	al, DEFAULT_HARD_DRIVE_LETTER
 	ret
 
Index: /trunk/XTIDE_Universal_BIOS/Src/Menus/HotkeyBar.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Menus/HotkeyBar.asm	(revision 546)
+++ /trunk/XTIDE_Universal_BIOS/Src/Menus/HotkeyBar.asm	(revision 547)
@@ -90,5 +90,5 @@
 ;		AX, CX, DX, SI, DI
 ;--------------------------------------------------------------------
-	call	DriveXlate_GetLetterForFirstHardDriveToAX
+	call	BootVars_GetLetterForFirstHardDriveToAX
 	mov		ah, ANGLE_QUOTE_RIGHT
 	mov		cl, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bHddLetter]
@@ -397,5 +397,5 @@
 	; Determine if Floppy or Hard Drive hotkey
 	xchg	cx, ax
-	call	DriveXlate_GetLetterForFirstHardDriveToAX
+	call	BootVars_GetLetterForFirstHardDriveToAX
 	cmp		cl, al
 	jb		SHORT .StoreDriveLetter	; Store Floppy Drive letter
Index: /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AtaGeometry.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AtaGeometry.asm	(revision 546)
+++ /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AtaGeometry.asm	(revision 547)
@@ -176,5 +176,5 @@
 ;		BL:		Number of L-CHS heads (?...240)
 ;		CX:		Number of bits shifted (0...3)
-;		DL:		ADDRESSING_MODE_NORMAL or ADDRESSING_MODE_LARGE
+;		DX:		ADDRESSING_MODE_NORMAL or ADDRESSING_MODE_LARGE
 ;	Corrupts registers:
 ;		Nothing
@@ -218,17 +218,17 @@
 ; ConvertPCHfromAXBLtoEnhancedCHinAXBL:
 ;	Parameters:
-;		AX:		Number of P-CHS cylinders (1...8192)
+;		AX:		Number of P-CHS cylinders (1...8192, or up to 17475 if fell from above)
 ;		BL:		Number of P-CHS heads (1...16)
 ;	Returns:
 ;		AX:		Number of L-CHS cylinders (?...1024)
-;		BL:		Number of L-CHS heads (?...128)
+;		BL:		Number of L-CHS heads (?...128, or up to 240 if fell from above)
 ;		CX:		Number of bits shifted (0...3)
-;		DL:		TRANSLATEMODE_NORMAL or TRANSLATEMODE_LARGE
+;		DX:		TRANSLATEMODE_NORMAL or TRANSLATEMODE_LARGE
 ;	Corrupts registers:
 ;		Nothing
 ;--------------------------------------------------------------------
 ConvertPCHfromAXBLtoEnhancedCHinAXBL:
+	cwd					; Assume TRANSLATEMODE_NORMAL
 	xor		cx, cx		; No bits to shift initially
-	xor		dl, dl		; Assume TRANSLATEMODE_NORMAL
 .ShiftIfMoreThan1024Cylinder:
 	cmp		ax, MAX_LCHS_CYLINDERS
Index: /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/BootVars.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/BootVars.asm	(revision 546)
+++ /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/BootVars.asm	(revision 547)
@@ -59,6 +59,28 @@
 ;--------------------------------------------------------------------
 BootVars_StoreDefaultDriveLettersToHotkeyVars:
-	mov		WORD [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wFddAndHddLetters], DEFAULT_FLOPPY_DRIVE_LETTER | (DEFAULT_HARD_DRIVE_LETTER<<8)
+	call	BootVars_GetLetterForFirstHardDriveToAX
+	mov		ah, DEFAULT_FLOPPY_DRIVE_LETTER
+	xchg	al, ah
+	mov		[es:BOOTVARS.hotkeyVars+HOTKEYVARS.wFddAndHddLetters], ax
 	ret
 
 %endif ; MODULE_HOTKEYS
+
+
+;--------------------------------------------------------------------
+; Returns letter for first hard disk. Usually it will be 'C' but it
+; can be higher if more than two floppy drives are found.
+;
+; BootVars_GetLetterForFirstHardDriveToAX
+;	Parameters:
+;		DS:		RAMVARS segment
+;	Returns:
+;		AX:		Upper case letter for first hard disk
+;	Corrupts registers:
+;		Nothing
+;--------------------------------------------------------------------
+BootVars_GetLetterForFirstHardDriveToAX:
+	call	FloppyDrive_GetCountToAX
+	add		al, DEFAULT_FLOPPY_DRIVE_LETTER		; First Hard Drive letter comes after last floppy drive letter...
+	MAX_U	al, DEFAULT_HARD_DRIVE_LETTER		; ...but it can never be 'A' or 'B'
+	ret
Index: /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm	(revision 546)
+++ /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm	(revision 547)
@@ -109,5 +109,5 @@
 	; Store P-CHS and flags
 	call	AtaGeometry_GetPCHStoAXBLBHfromAtaInfoInESSI
-	dec		dx						; Set ZF if TRANSLATEMODE_LARGE, SF if TRANSLATEMODE_NORMAL
+	dec		dl						; Set ZF if TRANSLATEMODE_LARGE, SF if TRANSLATEMODE_NORMAL
 	js		SHORT .NothingToChange
 	jz		SHORT .LimitHeadsForLargeAddressingMode
Index: /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm	(revision 546)
+++ /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm	(revision 547)
@@ -197,18 +197,2 @@
 	ret
 %endif
-
-
-%if 0							; unused...
-;--------------------------------------------------------------------
-; RamVars_IsDriveDetectionInProgress
-;	Parameters:
-;		DS:		RAMVARS segment
-;	Returns:
-;		ZF:		Set if drive detection is in progress (ROM initialization)
-;	Corrupts registers:
-;		None
-;--------------------------------------------------------------------
-RamVars_IsDriveDetectionInProgress:
-	cmp		WORD [RAMVARS.wSignature], RAMVARS_DRV_DETECT_SIGNATURE
-	ret
-%endif
