Index: trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenu.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenu.asm	(revision 123)
+++ trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenu.asm	(revision 124)
@@ -49,17 +49,17 @@
 ; Returns number of menuitems in Boot Menu.
 ;
-; BootMenu_GetMenuitemCountToCX
+; BootMenu_GetMenuitemCountToAX
 ;	Parameters:
 ;		DS:		RAMVARS segment
 ;	Returns:
-;		CX:		Number of boot menu items
+;		AX:		Number of boot menu items
 ;	Corrupts registers:
-;		AX
+;		CX
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
-BootMenu_GetMenuitemCountToCX:
+BootMenu_GetMenuitemCountToAX:
 	call	RamVars_GetHardDiskCountFromBDAtoCX
 	xchg	ax, cx
-	call	FloppyDrive_GetCount
+	call	FloppyDrive_GetCountToCX
 	add		ax, cx
 	ret
@@ -67,17 +67,18 @@
 
 ;--------------------------------------------------------------------
-; BootMenu_GetHeightToALwithItemCountInCL
+; BootMenu_GetHeightToAHwithItemCountInAL
 ;	Parameters:
-;		CL:		Number of menuitems
+;		AL:		Number of menuitems
 ;	Returns:
 ;		AH:		Boot menu height
 ;	Corrupts registers:
-;		AL, CL, DI
+;		AL, CX, DI
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
-BootMenu_GetHeightToAHwithItemCountInCL:
+BootMenu_GetHeightToAHwithItemCountInAL:
+	xchg	cx, ax
 	add		cl, BOOT_MENU_HEIGHT_WITHOUT_ITEMS
 	CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH
-	sub		ah, MENU_SCREEN_BOTTOM_LINES*2
+	sub		ah, MENU_SCREEN_BOTTOM_LINES*2	; Leave space for bottom info
 	MIN_U	ah, cl
 	ret
@@ -104,5 +105,5 @@
 .StartFromHardDiskLetter:
 	sub		al, cl						; Hard Disk index
-	call	FloppyDrive_GetCount
+	call	FloppyDrive_GetCountToCX
 	add		cx, ax						; Menuitem index
 	ret
@@ -122,5 +123,5 @@
 ALIGN JUMP_ALIGN
 BootMenu_GetLetterForFirstHardDiskToCL:
-	call	FloppyDrive_GetCount
+	call	FloppyDrive_GetCountToCX
 	add		cl, 'A'
 	MAX_U	cl, 'C'
@@ -141,5 +142,5 @@
 BootMenu_ConvertMenuitemFromCXtoDriveInDX:
 	mov		dx, cx					; Copy menuitem index to DX
-	call	FloppyDrive_GetCount
+	call	FloppyDrive_GetCountToCX
 	cmp		dx, cx					; Floppy drive?
 	jb		SHORT .ReturnFloppyDriveInDX
@@ -151,27 +152,20 @@
 
 ;--------------------------------------------------------------------
-; Converts Floppy or Hard Disk Drive number to menuitem index.
-; This function does not check does the drive really exists.
-;
-; BootMenu_ConvertDriveToMenuitem
+; BootMenu_GetMenuitemToDXforDriveInDL
 ;	Parameters:
 ;		DL:		Drive number
 ;	Returns:
-;		CX:		Menuitem index (assuming drive is available)
+;		DX:		Menuitem index (assuming drive is available)
 ;	Corrupts registers:
-;		AX
+;		Nothing
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
-BootMenu_ConvertDriveToMenuitem:
-	test	dl, 80h					; Floppy drive?
-	jz		SHORT .ReturnFloppyMenuitem
-	call	FloppyDrive_GetCount
-	mov		ax, 7Fh					; Load mask to clear floppy bit
-	and		ax, dx					; AX = Hard Disk index
-	add		cx, ax					; Add hard disk index to floppy drive count
-	ret
-ALIGN JUMP_ALIGN
-.ReturnFloppyMenuitem:
-	eMOVZX	cx, dl					; Drive number and item index are equal
+BootMenu_GetMenuitemToDXforDriveInDL:
+	xor		dh, dh						; Drive number now in DX
+	test	dl, 80h
+	jz		SHORT .ReturnItemIndexInDX	; Return if floppy drive (HD bit not set)
+	call	FloppyDrive_GetCountToCX
+	add		dx, cx
+.ReturnItemIndexInDX:
 	ret
 
@@ -198,6 +192,6 @@
 	jmp		SHORT .CompareDriveNumberToDriveCount
 .IsFloppyDriveIsInSystem:
-	call	FloppyDrive_GetCount				; Floppy Drive count to CX
+	call	FloppyDrive_GetCountToCX
 .CompareDriveNumberToDriveCount:
-	cmp		dl, cl
+	cmp		dl, cl								; Set CF when DL is smaller
 	ret
Index: trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuEvent.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuEvent.asm	(revision 123)
+++ trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuEvent.asm	(revision 124)
@@ -8,5 +8,4 @@
 	.HardDisk			resb	2
 	.FloppyDrive		resb	2
-	.SpecialFunction	resb	2
 endstruc
 
@@ -29,5 +28,4 @@
 	jmp		[bx+.rgfnEventSpecificHandlers]
 .EventNotHandled:
-.IdleProcessing:
 	clc
 	ret
@@ -35,13 +33,13 @@
 ALIGN WORD_ALIGN
 .rgfnEventSpecificHandlers:
-	dw		.InitializeMenuinitFromDSSI
-	dw		.EventCompleted
-	dw		.IdleProcessing
-	dw		.ItemHighlightedFromCX
-	dw		.ItemSelectedFromCX
-	dw		.KeyStrokeInAX
-	dw		BootMenuPrint_TitleStrings
-	dw		.RefreshInformation
-	dw		.RefreshItemFromCX
+	dw		.InitializeMenuinitFromDSSI	; MENUEVENT.InitializeMenuinitFromDSSI
+	dw		.EventCompleted				; MENUEVENT.ExitMenu
+	dw		.EventNotHandled			; MENUEVENT.IdleProcessing
+	dw		.ItemHighlightedFromCX		; MENUEVENT.ItemHighlightedFromCX
+	dw		.ItemSelectedFromCX			; MENUEVENT.ItemSelectedFromCX
+	dw		.KeyStrokeInAX				; MENUEVENT.KeyStrokeInAX
+	dw		BootMenuPrint_TitleStrings	; MENUEVENT.RefreshTitle
+	dw		.RefreshInformation			; MENUEVENT.RefreshInformation
+	dw		.RefreshItemFromCX			; MENUEVENT.RefreshItemFromCX
 
 
@@ -55,11 +53,11 @@
 	call	RamVars_GetSegmentToDS
 	call	.GetDefaultMenuitemToDX
-	call	BootMenu_GetMenuitemCountToCX
+	call	BootMenu_GetMenuitemCountToAX
 	pop		ds
-	mov		[si+MENUINIT.wItems], cx
+	mov		[si+MENUINIT.wItems], ax
 	mov		[si+MENUINIT.wHighlightedItem], dx
 	mov		WORD [si+MENUINIT.wTitleAndInfoLines], BOOT_MENU_TITLE_AND_INFO_LINES
 	mov		BYTE [si+MENUINIT.bWidth], BOOT_MENU_WIDTH
-	call	BootMenu_GetHeightToAHwithItemCountInCL
+	call	BootMenu_GetHeightToAHwithItemCountInAL
 	mov		[si+MENUINIT.bHeight], ah
 	stc
@@ -72,7 +70,5 @@
 	jnc		SHORT .DoNotSetDefaultMenuitem
 	call	DriveXlate_SetDriveToSwap
-	call	BootMenu_ConvertDriveToMenuitem
-	mov		dx, cx
-	ret
+	jmp		BootMenu_GetMenuitemToDXforDriveInDL
 ALIGN JUMP_ALIGN
 .DoNotSetDefaultMenuitem:
Index: trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm	(revision 123)
+++ trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm	(revision 124)
@@ -362,5 +362,5 @@
 ALIGN JUMP_ALIGN
 BootMenuPrint_TheBottomOfScreen:
-	call	FloppyDrive_GetCount
+	call	FloppyDrive_GetCountToCX
 	mov		bl, cl					; Floppy Drive count to BL
 	call	RamVars_GetHardDiskCountFromBDAtoCX
Index: trunk/XTIDE_Universal_BIOS/Src/Initialization/FloppyDrive.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Initialization/FloppyDrive.asm	(revision 123)
+++ trunk/XTIDE_Universal_BIOS/Src/Initialization/FloppyDrive.asm	(revision 124)
@@ -120,5 +120,5 @@
 ; Returns number of Floppy Drives in system.
 ;
-; FloppyDrive_GetCount
+; FloppyDrive_GetCountToCX
 ;	Parameters:
 ;		Nothing
@@ -129,10 +129,10 @@
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
-FloppyDrive_GetCount:
+FloppyDrive_GetCountToCX:
 	push	es
 %ifdef USE_AT
-	call	FloppyDrive_GetCountFromBIOS
+	call	GetCountFromBIOS
 %else
-	call	FloppyDrive_GetCountFromBDA
+	call	GetCountFromBDA
 %endif
 	MAX_U	cl, [cs:ROMVARS.bMinFddCnt]
@@ -147,5 +147,5 @@
 ; if this function fails.
 ;
-; FloppyDrive_GetCountFromBIOS
+; GetCountFromBIOS
 ;	Parameters:
 ;		Nothing
@@ -159,5 +159,5 @@
 %ifdef USE_AT
 ALIGN JUMP_ALIGN
-FloppyDrive_GetCountFromBIOS:
+GetCountFromBIOS:
 	push	di
 	push	dx
@@ -182,5 +182,5 @@
 ; This function should be used only if FloppyDrive_GetCountFromBIOS fails.
 ;
-; FloppyDrive_GetCountFromBDA
+; GetCountFromBDA
 ;	Parameters:
 ;		Nothing
@@ -192,5 +192,5 @@
 %ifndef USE_AT
 ALIGN JUMP_ALIGN
-FloppyDrive_GetCountFromBDA:
+GetCountFromBDA:
 	LOAD_BDA_SEGMENT_TO	es, cx
 	mov		cl, [es:BDA.wEquipment]			; Load Equipment WORD low byte
