Index: trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm	(revision 84)
+++ trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm	(revision 88)
@@ -1,12 +1,480 @@
-; File name		:	BootMenuPrint.asm
-; Project name	:	IDE BIOS
-; Created date	:	26.3.2010
-; Last update	:	14.1.2011
-; Author		:	Tomi Tilli,
-;				:	Krister Nordvall (optimizations)
+; Project name	:	XTIDE Universal BIOS
 ; Description	:	Functions for printing boot menu strings.
 
 ; Section containing code
 SECTION .text
+
+;--------------------------------------------------------------------
+; Prints Boot Menu title strings.
+;
+; BootMenuPrint_TitleStrings
+;	Parameters:
+;		Nothing
+;	Returns:
+;		CF:		Set since menu event handled
+;	Corrupts registers:
+;		AX, SI, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+BootMenuPrint_TitleStrings:
+	mov		si, ROMVARS.szTitle
+	call	PrintNullTerminatedStringFromCSSIandSetCF
+	call	BootMenuPrint_Newline
+	mov		si, ROMVARS.szVersion
+	jmp		PrintNullTerminatedStringFromCSSIandSetCF
+
+
+;--------------------------------------------------------------------
+; BootMenuPrint_Newline
+;	Parameters:
+;		Nothing
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+BootMenuPrint_Newline:
+	CALL_DISPLAY_LIBRARY PrintNewlineCharacters
+	ret
+
+
+;--------------------------------------------------------------------
+; Prints Floppy Drive hotkey string.
+;
+; BootMenuPrint_FloppyHotkeyString
+;	Parameters:
+;		BL:		Number of floppy drives in system
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX, SI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+BootMenuPrint_FloppyHotkeyString:
+	test	bl, bl					; Any floppy drives?
+	jz		SHORT NoFloppyDrivesOrHardDisksToPrint
+	push	bp
+
+	mov		bp, sp
+	mov		al, 'A'
+	push	ax						; 'A'
+	dec		ax
+	add		al, bl
+	push	ax						; Last floppy drive letter
+	ePUSH_T	ax, g_szFDD
+	ePUSH_T	ax, g_szHDD
+	jmp		SHORT PrintHotkeyString
+
+;--------------------------------------------------------------------
+; Prints Hard Disk hotkey string.
+;
+; BootMenuPrint_FloppyHotkeyString
+;	Parameters:
+;		BH:		Number of hard disks in system
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX, CX, SI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+BootMenuPrint_HardDiskHotkeyString:
+	test	bh, bh					; Any hard disks?
+	jz		SHORT NoFloppyDrivesOrHardDisksToPrint
+	push	bp
+
+	mov		bp, sp
+	call	BootMenu_GetLetterForFirstHardDisk
+	push	cx						; First hard disk letter
+	dec		cx
+	add		cl, bh
+	push	cx						; Last hard disk letter
+	ePUSH_T	ax, g_szHDD
+	ePUSH_T	ax, g_szFDD
+	; Fall to PrintHotkeyString
+
+ALIGN JUMP_ALIGN
+PrintHotkeyString:
+	mov		si, g_szBottomScrn
+	jmp		BootMenuPrint_FormatCSSIfromParamsInSSBP
+NoFloppyDrivesOrHardDisksToPrint:
+	ret
+
+;--------------------------------------------------------------------
+; BootMenuPrint_ClearScreen
+;	Parameters:
+;		Nothing
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+BootMenuPrint_ClearScreen:
+	push	di
+	mov		ax, ' ' | (MONO_NORMAL<<8)
+	CALL_DISPLAY_LIBRARY ClearScreenWithCharInALandAttrInAH
+	pop		di
+	ret
+
+
+;--------------------------------------------------------------------
+; Translates and prints drive number.
+;
+; BootMenuPrint_TranslatedDriveNumber
+;	Parameters:
+;		DL:		Untranslated drive number
+;		DS:		RAMVARS segment
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+BootMenuPrint_TranslatedDriveNumber:
+	push	dx
+	push	bx
+
+	call	DriveXlate_ToOrBack
+	eMOVZX	ax, dl		; Drive number to AL
+	CALL_DISPLAY_LIBRARY PrintWordFromAXwithBaseInBX
+	mov		al, ' '		; Print space
+	CALL_DISPLAY_LIBRARY PrintCharacterFromAL
+
+	pop		bx
+	pop		dx
+	ret
+
+
+;--------------------------------------------------------------------
+; BootMenuPrint_FloppyMenuitem
+;	Parameters:
+;		DL:		Untranslated Floppy Drive number
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX, DX, SI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+BootMenuPrint_FloppyMenuitem:
+	push	bp
+
+	mov		bp, sp
+	mov		si, g_szFDLetter
+	ePUSH_T	ax, g_szFloppyDrv
+	add		dl, 'A'
+	push	dx					; Drive letter
+	jmp		BootMenuPrint_FormatCSSIfromParamsInSSBP
+
+
+;--------------------------------------------------------------------
+; BootMenuPrint_HardDiskMenuitem
+;	Parameters:
+;		DL:		Untranslated Hard Disk number
+;		DS:		RAMVARS segment
+;	Returns:
+;		CF:		Set since menu event handled
+;	Corrupts registers:
+;		AX, BX, SI, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+BootMenuPrint_HardDiskMenuitem:
+	call	FindDPT_ForDriveNumber		; DS:DI to point DPT
+	jnc		SHORT .HardDiskMenuitemForForeignDrive
+	; Fall to .HardDiskMenuitemForOurDrive
+
+;--------------------------------------------------------------------
+; .HardDiskMenuitemForOurDrive
+;	Parameters:
+;		DL:		Untranslated Hard Disk number
+;		DS:		RAMVARS segment
+;	Returns:
+;		CF:		Set since menu event handled
+;	Corrupts registers:
+;		AX, BX, SI, DI
+;--------------------------------------------------------------------
+;ALIGN JUMP_ALIGN
+.HardDiskMenuitemForOurDrive:
+	call	BootInfo_GetOffsetToBX
+	lea		si, [bx+BOOTNFO.szDrvName]
+	xor		bx, bx			; BDA segment
+	CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromBXSI
+	stc
+	ret
+
+;--------------------------------------------------------------------
+; BootMenuPrint_HardDiskMenuitemForForeignDrive
+;	Parameters:
+;		DL:		Untranslated Hard Disk number
+;		DS:		RAMVARS segment
+;	Returns:
+;		CF:		Set since menu event handled
+;	Corrupts registers:
+;		AX, SI, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+.HardDiskMenuitemForForeignDrive:
+	mov		si, g_szforeignHD
+	jmp		PrintNullTerminatedStringFromCSSIandSetCF
+
+
+;--------------------------------------------------------------------
+; BootMenuPrint_FunctionMenuitem
+;	Parameters:
+;		DX:		Function ID
+;	Returns:
+;		CF:		Set if menu event was handled successfully
+;	Corrupts registers:
+;		AX, DX, SI, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+BootMenuPrint_FunctionMenuitem:
+	test	dx, dx					; ID_BOOTFUNC_ROMBOOT
+	jz		SHORT .PrintRomBootMenuitem
+	ret
+
+ALIGN JUMP_ALIGN
+.PrintRomBootMenuitem:
+	mov		si, g_szRomBoot
+	jmp		PrintNullTerminatedStringFromCSSIandSetCF
+
+
+;--------------------------------------------------------------------
+; BootMenuPrint_FloppyMenuitemInformation
+;	Parameters:
+;		DL:		Untranslated Floppy Drive number
+;		DS:		RAMVARS segment
+;	Returns:
+;		CF:		Set since menu event was handled successfully
+;	Corrupts registers:
+;		AX, BX, CX, DX, SI, DI, ES
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+BootMenuPrint_FloppyMenuitemInformation:
+	call	BootMenuPrint_ClearInformationArea
+	call	FloppyDrive_GetType			; Get Floppy Drive type to BX
+	test	bx, bx						; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD)
+	jz		SHORT .PrintXTFloppyType
+	cmp		bl, FLOPPY_TYPE_35_ED
+	ja		SHORT .PrintUnknownFloppyType
+	jmp		SHORT .PrintKnownFloppyType
+
+;--------------------------------------------------------------------
+; .PrintXTFloppyType
+;	Parameters:
+;		Nothing
+;	Returns:
+;		CF:		Set since menu event was handled successfully
+;	Corrupts registers:
+;		AX, SI, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+.PrintXTFloppyType:
+	push	bp
+	mov		si, g_szFddSizeOr
+	jmp		SHORT .FormatXTorUnknownTypeFloppyDrive
+
+;--------------------------------------------------------------------
+; .PrintUnknownFloppyType
+;	Parameters:
+;		Nothing
+;	Returns:
+;		CF:		Set since menu event was handled successfully
+;	Corrupts registers:
+;		AX, SI, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+.PrintUnknownFloppyType:
+	push	bp
+	mov		si, g_szFddUnknown
+.FormatXTorUnknownTypeFloppyDrive:
+	mov		bp, sp
+	ePUSH_T	ax, g_szCapacity
+	jmp		BootMenuPrint_FormatCSSIfromParamsInSSBP
+
+;--------------------------------------------------------------------
+; .PrintKnownFloppyType
+;	Parameters:
+;		BX:		Floppy drive type
+;	Returns:
+;		CF:		Set since menu event was handled successfully
+;	Corrupts registers:
+;		AX, BX, SI, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+.PrintKnownFloppyType:
+	push	bp
+
+	mov		bp, sp
+	mov		si, g_szFddSize
+	ePUSH_T	ax, g_szCapacity
+	dec		bx						; Cannot be 0 (FLOPPY_TYPE_525_OR_35_DD)
+	shl		bx, 1					; Shift for WORD lookup
+	mov		ax, [cs:bx+.rgwPhysicalSize]
+	push	ax						; '5' or '3'
+	mov		al, ah
+	push	ax						; '1/4' or '1/2'
+	push	WORD [cs:bx+.rgwCapacity]
+	jmp		SHORT BootMenuPrint_FormatCSSIfromParamsInSSBP
+
+ALIGN WORD_ALIGN
+.rgwCapacity:
+	dw		360
+	dw		1200
+	dw		720
+	dw		1440
+	dw		2880
+	dw		2880
+.rgwPhysicalSize:
+	db		'5', 172	; 1, FLOPPY_TYPE_525_DD
+	db		'5', 172	; 2, FLOPPY_TYPE_525_HD
+	db		'3', 171	; 3, FLOPPY_TYPE_35_DD
+	db		'3', 171	; 4, FLOPPY_TYPE_35_HD
+	db		'3', 171	; 5, 3.5" ED on some BIOSes
+	db		'3', 171	; 6, FLOPPY_TYPE_35_ED
+
+
+;--------------------------------------------------------------------
+; Prints Hard Disk Menuitem information strings.
+;
+; BootMenuPrint_HardDiskMenuitemInformation
+;	Parameters:
+;		DL:		Untranslated Hard Disk number
+;		DS:		RAMVARS segment
+;	Returns:
+;		CF:		Set since menu event was handled successfully
+;	Corrupts registers:
+;		BX, CX, DX, SI, DI, ES
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+BootMenuPrint_HardDiskMenuitemInformation:
+	call	FindDPT_ForDriveNumber		; DS:DI to point DPT
+	jnc		SHORT .HardDiskMenuitemInfoForForeignDrive
+	call	.HardDiskMenuitemInfoSizeForOurDrive
+	jmp		BootMenuPrintCfg_ForOurDrive
+
+;--------------------------------------------------------------------
+; .HardDiskMenuitemInfoForForeignDrive
+;	Parameters:
+;		DL:		Untranslated Hard Disk number
+;		DS:		RAMVARS segment
+;	Returns:
+;		CF:		Set since menu event was handled successfully
+;	Corrupts registers:
+;		AX, BX, CX, DX, SI, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+.HardDiskMenuitemInfoForForeignDrive:
+	push	bp
+	mov		bp, sp
+	ePUSH_T	ax, g_szCapacity
+
+	call	DriveXlate_ToOrBack
+	call	HCapacity_GetSectorCountFromForeignAH08h
+	call	ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
+
+	mov		si, g_szSizeSingle
+	jmp		SHORT BootMenuPrint_FormatCSSIfromParamsInSSBP
+
+;--------------------------------------------------------------------
+; .HardDiskMenuitemInfoSizeForOurDrive
+;	Parameters:
+;		DL:		Untranslated Hard Disk number
+;		DS:DI:	Ptr to DPT
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX, BX, CX, DX, SI, ES
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+.HardDiskMenuitemInfoSizeForOurDrive:
+	push	bp
+	mov		bp, sp
+	ePUSH_T	ax, g_szCapacity
+
+	; Get and push L-CHS size
+	call	HCapacity_GetSectorCountFromOurAH08h
+	call	ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
+
+	; Get and push total LBA size
+	call	BootInfo_GetTotalSectorCount
+	call	ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
+
+	mov		si, g_szSizeDual
+	; Fall to BootMenuPrint_FormatCSSIfromParamsInSSBP
+
+
+;--------------------------------------------------------------------
+; BootMenuPrint_FormatCSSIfromParamsInSSBP
+;	Parameters:
+;		CS:SI:	Ptr to string to format
+;		SS:BP:	Ptr to format parameters
+;	Returns:
+;		BP:		Popped from stack
+;	Corrupts registers:
+;		AX
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+BootMenuPrint_FormatCSSIfromParamsInSSBP:
+	push	di
+	CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
+	stc				; Successfull return from menu event
+	pop		di
+	pop		bp
+	ret
+
+
+;--------------------------------------------------------------------
+; ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
+;	Parameters:
+;		BX:DX:AX:	Sector count
+;	Returns:
+;		Size in stack
+;	Corrupts registers:
+;		AX, BX, CX, DX, SI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+ConvertSectorCountInBXDXAXtoSizeAndPushForFormat:
+	pop		si		; Pop return address
+	call	Size_ConvertSectorCountInBXDXAXtoKiB
+	mov		cx, BYTE_MULTIPLES.kiB
+	call	Size_GetSizeToAXAndCharToDLfromBXDXAXwithMagnitudeInCX
+	push	ax		; Size in magnitude
+	push	cx		; Tenths
+	push	dx		; Magnitude character
+	jmp		si
+
+
+;--------------------------------------------------------------------
+; PrintNullTerminatedStringFromCSSIandSetCF
+;	Parameters:
+;		CS:SI:	Ptr to NULL terminated string to print
+;	Returns:
+;		CF:		Set since menu event was handled successfully
+;	Corrupts registers:
+;		AX, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+PrintNullTerminatedStringFromCSSIandSetCF:
+	CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
+	stc
+	ret
+
+
+;--------------------------------------------------------------------
+; BootMenuPrint_ClearInformationArea
+;	Parameters:
+;		Nothing
+;	Returns:
+;		CF:		Set
+;	Corrupts registers:
+;		AX, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+BootMenuPrint_ClearInformationArea:
+	CALL_MENU_LIBRARY ClearInformationArea
+	stc
+	ret
+
 
 ;--------------------------------------------------------------------
@@ -70,493 +538,7 @@
 ALIGN JUMP_ALIGN
 BootMenuPrint_SetCursorPosition:
-	push	bx
-	call	MenuCrsr_SetCursor
-	pop		bx
-	ret
-
-
-;--------------------------------------------------------------------
-; Prints Floppy Drive hotkey string.
-;
-; BootMenuPrint_FloppyHotkeyString
-;	Parameters:
-;		BL:		Number of floppy drives in system
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		AX, CX, DX, SI
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-BootMenuPrint_FloppyHotkeyString:
-	test	bl, bl					; Any floppy drives?
-	jz		.Return
-	ePUSH_T	ax, g_szHDD
-	ePUSH_T	ax, g_szFDD
-	mov		ax, 'A'-1
-	add		al, bl					; Last Floppy Drive letter
-	push	ax
-	ePUSH_T	ax, 'A'
-	jmp		SHORT BootMenuPrint_HotkeyString
-.Return:
-	ret
-
-;--------------------------------------------------------------------
-; Prints Floppy Drive or Hard Disk hotkey string when
-; parameters are pushed to stack.
-;
-; BootMenuPrint_HotkeyString
-;	Parameters:
-;		Stack:	String formatting parameters
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		AX, CX, DX, SI
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-BootMenuPrint_HotkeyString:
-	mov		si, g_szBottomScrn
-	mov		dh, 8					; 8 bytes pushed to stack
-	jmp		PrintString_JumpToFormat
-
-
-;--------------------------------------------------------------------
-; Prints Hard Disk hotkey string.
-;
-; BootMenuPrint_FloppyHotkeyString
-;	Parameters:
-;		BH:		Number of hard disks in system
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		AX, CX, DX, SI
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-BootMenuPrint_HardDiskHotkeyString:
-	test	bh, bh					; Any hard disks?
-	jz		.Return
-	ePUSH_T	ax, g_szFDD
-	ePUSH_T	ax, g_szHDD
-	call	BootMenu_GetLetterForFirstHardDisk
-	eMOVZX	ax, bh					; Hard disk count to AX
-	add		ax, cx					; One past last hard disk letter
-	dec		ax						; Last hard disk letter
-	push	ax
-	push	cx
-	jmp		SHORT BootMenuPrint_HotkeyString
-.Return:
-	ret
-
-
-;--------------------------------------------------------------------
-; Clears screen.
-;
-; BootMenuPrint_ClearScreen
-;	Parameters:
-;		Nothing
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		AX, BX, DX
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-BootMenuPrint_ClearScreen:
-	push	cx
-	call	MenuDraw_ClrScr
-	pop		cx
-	ret
-
-
-;--------------------------------------------------------------------
-; Translates and prints drive number.
-;
-; BootMenuPrint_TranslatedDriveNumber
-;	Parameters:
-;		DL:		Untranslated drive number
-;		DS:		RAMVARS segment
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		AX, DI
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-BootMenuPrint_TranslatedDriveNumber:
-	push	dx
-	call	DriveXlate_ToOrBack
-	mov		al, dl						; Drive number to AL
-	call	Print_IntHexB
-	mov		dl, ' '
-	PRINT_CHAR							; Print space
-	pop		dx
-	ret
-
-
-;--------------------------------------------------------------------
-; Prints Floppy Drive Menuitem string.
-;
-; BootMenuPrint_FloppyMenuitem
-;	Parameters:
-;		DL:		Untranslated Floppy Drive number
-;	Returns:
-;		AX:		1 if drive number was valid
-;				0 if drive number was invalid
-;	Corrupts registers:
-;		CX, DX, SI
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-BootMenuPrint_FloppyMenuitem:
-	ePUSH_T	ax, BootMenuPrint_HardDiskPrinted	; Return address
-	add		dl, 'A'				; Number to letter
-	push	dx
-	ePUSH_T	ax, g_szFloppyDrv
-	mov		si, g_szFDLetter
-	mov		dh, 4				; 4 bytes pushed to stack
-	jmp		PrintString_JumpToFormat
-
-
-;--------------------------------------------------------------------
-; Prints Hard Disk Menuitem string.
-;
-; BootMenuPrint_HardDiskMenuitem
-;	Parameters:
-;		DL:		Untranslated Hard Disk number
-;		DS:		RAMVARS segment
-;	Returns:
-;		AX:		1 if drive number was valid
-;				0 if drive number was invalid
-;	Corrupts registers:
-;		CX, DX, SI, ES
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-BootMenuPrint_HardDiskMenuitem:
-	ePUSH_T	ax, BootMenuPrint_HardDiskPrinted
-	call	FindDPT_ForDriveNumber		; DS:DI to point DPT
-	jnc		SHORT BootMenuPrint_HardDiskMenuitemForForeignDrive
-	jmp		SHORT BootMenuPrint_HardDiskMenuitemForOurDrive
-ALIGN JUMP_ALIGN
-BootMenuPrint_HardDiskPrinted:
-	mov		ax, 1
-	ret
-
-;--------------------------------------------------------------------
-; Prints Hard Disk Menuitem string for drive that is handled by
-; some another BIOS.
-;
-; BootMenuPrint_HardDiskMenuitemForForeignDrive
-;	Parameters:
-;		DL:		Untranslated Hard Disk number
-;		DS:		RAMVARS segment
-;	Returns:
-;		AX:		1 if drive number was valid
-;				0 if drive number was invalid
-;	Corrupts registers:
-;		CX, DX, SI
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-BootMenuPrint_HardDiskMenuitemForForeignDrive:
-	mov		si, g_szforeignHD
-	jmp		PrintString_FromCS
-
-;--------------------------------------------------------------------
-; Prints Hard Disk Menuitem string for drive that is handled by our BIOS.
-;
-; BootMenuPrint_HardDiskMenuitemForOurDrive
-;	Parameters:
-;		DL:		Untranslated Hard Disk number
-;		DS:		RAMVARS segment
-;	Returns:
-;		AX:		1 if drive number was valid
-;				0 if drive number was invalid
-;	Corrupts registers:
-;		CX, DX, SI, ES
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-BootMenuPrint_HardDiskMenuitemForOurDrive:
-	call	BootInfo_GetOffsetToBX
-	LOAD_BDA_SEGMENT_TO	es, ax
-	lea		si, [bx+BOOTNFO.szDrvName]
-	jmp		PrintString_FromES
-
-
-;--------------------------------------------------------------------
-; Prints Function Menuitem string.
-;
-; BootMenuPrint_FunctionMenuitem
-;	Parameters:
-;		DX:		Function ID
-;	Returns:
-;		AX:		1 if function ID was valid
-;				0 if function ID was invalid
-;	Corrupts registers:
-;		DX, SI
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-BootMenuPrint_FunctionMenuitem:
-	test	dx, dx					; ID_BOOTFUNC_ROMBOOT
-	jz		SHORT .PrintRomBootMenuitem
-	xor		ax, ax					; Event not processed
-	ret
-
-ALIGN JUMP_ALIGN
-.PrintRomBootMenuitem:
-	mov		si, g_szRomBoot
-	; Fall to .PrintAndReturn
-
-ALIGN JUMP_ALIGN
-.PrintAndReturn:
-	call	PrintString_FromCS
-	mov		ax, 1					; Event processed
-	ret
-
-
-;--------------------------------------------------------------------
-; Prints Floppy Drive Menuitem information strings.
-;
-; BootMenuPrint_FloppyMenuitemInformation
-;	Parameters:
-;		DL:		Untranslated Floppy Drive number
-;		DS:		RAMVARS segment
-;	Returns:
-;		AX:		1 if drive number was valid
-;				0 if drive number was invalid
-;	Corrupts registers:
-;		BX, CX, DX, SI, DI, ES
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-BootMenuPrint_FloppyMenuitemInformation:
-	call	FloppyDrive_GetType						; Get Floppy Drive type to BX
-	ePUSH_T	ax, BootMenuPrint_ClearThreeInfoLines	; New return address
-	test	bx, bx									; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD)
-	jz		SHORT BootMenuPrint_PrintXTFloppyType
-	cmp		bl, FLOPPY_TYPE_35_ED
-	ja		SHORT BootMenuPrint_PrintUnknownFloppyType
-	jmp		SHORT BootMenuPrint_PrintKnownFloppyType
-
-;--------------------------------------------------------------------
-; Prints Menuitem information string for two possible XT floppy drives.
-;
-; BootMenuPrint_PrintXTFloppyType
-;	Parameters:
-;		Nothing
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		CX, DX, SI
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-BootMenuPrint_PrintXTFloppyType:
-	mov		si, g_szFddSizeOr
-	jmp		SHORT BootMenuPrint_FormatUnknownFloppyType
-
-;--------------------------------------------------------------------
-; Prints Menuitem information string for unknown floppy drive type.
-;
-; BootMenuPrint_PrintUnknownFloppyType
-;	Parameters:
-;		Nothing
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		CX, DX, SI
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-BootMenuPrint_PrintUnknownFloppyType:
-	mov		si, g_szFddUnknown
-BootMenuPrint_FormatUnknownFloppyType:
-	ePUSH_T	ax, g_szCapacity
-	mov		dh, 2					; 2 bytes pushed to stack
-	jmp		PrintString_JumpToFormat
-
-;--------------------------------------------------------------------
-; Prints Menuitem information string for known floppy drive type.
-;
-; BootMenuPrint_PrintKnownFloppyType
-;	Parameters:
-;		BX:		Floppy drive type
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		CX, DX, SI
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-BootMenuPrint_PrintKnownFloppyType:
-	dec		bx						; Cannot be 0 (FLOPPY_TYPE_525_OR_35_DD)
-	shl		bx, 1					; Shift for WORD lookup
-	push	WORD [cs:bx+.rgwCapacity]
-	mov		ax, [cs:bx+.rgwPhysicalSize]
-	push	ax						; '1/4' or '1/2'
-	mov		al, ah
-	push	ax						; '5' or '3'
-	ePUSH_T	ax, g_szCapacity
-	mov		si, g_szFddSize
-	mov		dh, 8					; 8 bytes pushed to stack
-	jmp		PrintString_JumpToFormat
-ALIGN WORD_ALIGN
-.rgwCapacity:
-	dw		360
-	dw		1200
-	dw		720
-	dw		1440
-	dw		2880
-	dw		2880
-.rgwPhysicalSize:
-	db		172, '5'	; 1, FLOPPY_TYPE_525_DD
-	db		172, '5'	; 2, FLOPPY_TYPE_525_HD
-	db		171, '3'	; 3, FLOPPY_TYPE_35_DD
-	db		171, '3'	; 4, FLOPPY_TYPE_35_HD
-	db		171, '3'	; 5, 3.5" ED on some BIOSes
-	db		171, '3'	; 6, FLOPPY_TYPE_35_ED
-
-
-;--------------------------------------------------------------------
-; Clears remaining characters from current information line
-; and clears following lines.
-;
-; BootMenuPrint_ClearThreeInfoLines
-; BootMenuPrint_ClearTwoInfoLines
-; BootMenuPrint_ClearOneInfoLine
-;	Parameters:
-;		Nothing
-;	Returns:
-;		AX:		1
-;	Corrupts registers:
-;		BX, DX
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-BootMenuPrint_ClearThreeInfoLines:
-	call	MenuDraw_NewlineStrClrLn
-ALIGN JUMP_ALIGN
-BootMenuPrint_ClearTwoInfoLines:
-	call	MenuDraw_NewlineStrClrLn
-ALIGN JUMP_ALIGN
-BootMenuPrint_ClearOneInfoLine:
-	call	MenuDraw_NewlineStrClrLn
-	mov		ax, 1
-	ret
-
-
-;--------------------------------------------------------------------
-; Prints Hard Disk Menuitem information strings.
-;
-; BootMenuPrint_HardDiskMenuitemInformation
-;	Parameters:
-;		DL:		Untranslated Hard Disk number
-;		DS:		RAMVARS segment
-;	Returns:
-;		AX:		1 if drive number was valid
-;				0 if drive number was invalid
-;	Corrupts registers:
-;		BX, CX, DX, SI, DI, ES
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-BootMenuPrint_HardDiskMenuitemInformation:
-	ePUSH_T	ax, BootMenuPrint_HardDiskPrinted
-	call	FindDPT_ForDriveNumber		; DS:DI to point DPT
-	jnc		SHORT BootMenuPrint_HardDiskMenuitemInfoForForeignDrive
-	call	BootMenuPrint_HardDiskMenuitemInfoSizeForOurDrive
-	jmp		BootMenuPrintCfg_ForOurDrive
-
-;--------------------------------------------------------------------
-; Prints Hard Disk Menuitem information strings for drive that
-; is handled by some other BIOS.
-;
-; BootMenuPrint_HardDiskMenuitemInfoForForeignDrive
-;	Parameters:
-;		DL:		Untranslated Hard Disk number
-;		DS:		RAMVARS segment
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		AX, BX, CX, DX, SI, DI
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-BootMenuPrint_HardDiskMenuitemInfoForForeignDrive:
-	call	DriveXlate_ToOrBack
-	call	HCapacity_GetSectorCountFromForeignAH08h
-	call	HCapacity_ConvertSectorCountToSize
-	ePUSH_T	dx, BootMenuPrint_ClearThreeInfoLines	; Return address
-	push	cx							; Magnitude character
-	push	si							; Tenths
-	push	ax							; Size in magnitude
-	ePUSH_T	ax, g_szCapacity			; "Capacity"
-	mov		si, g_szSizeSingle
-	mov		dh, 8						; 8 bytes pushed to stack
-	jmp		PrintString_JumpToFormat
-
-;--------------------------------------------------------------------
-; Prints Hard Disk Menuitem information size string for drive that
-; is handled by our BIOS.
-;
-; BootMenuPrint_HardDiskMenuitemInfoSizeForOurDrive
-;	Parameters:
-;		DL:		Untranslated Hard Disk number
-;		DS:DI:	Ptr to DPT
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		AX, BX, CX, DX, SI, ES
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-BootMenuPrint_HardDiskMenuitemInfoSizeForOurDrive:
-	ePUSH_T	ax, BootMenuPrint_ClearOneInfoLine	; Return address
-
-	; Get and push total LBA size
-	call	BootInfo_GetTotalSectorCount
-	call	HCapacity_ConvertSectorCountToSize
-	push	cx								; Magnitude character
-	push	si								; Tenths
-	push	ax								; Size in magnitude
-
-	; Get and push L-CHS size
-	mov		dl, [di+DPT.bDrvNum]			; Restore drive number
-	call	HCapacity_GetSectorCountFromOurAH08h
-	call	HCapacity_ConvertSectorCountToSize
-	push	cx								; Magnitude character
-	push	si								; Tenths
-	push	ax								; Size in magnitude
-
-	ePUSH_T	ax, g_szCapacity				; "Capacity"
-	mov		si, g_szSizeDual
-	mov		dh, 14							; 14 bytes pushed to stack
-	jmp		PrintString_JumpToFormat
-
-
-;--------------------------------------------------------------------
-; Prints Function Menuitem information strings.
-;
-; BootMenuPrint_HardDiskMenuitemInformation
-;	Parameters:
-;		DX:		Function ID
-;		DS:		RAMVARS segment
-;	Returns:
-;		AX:		1 if function ID was valid
-;				0 if function ID was valid
-;	Corrupts registers:
-;		BX, DX
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-BootMenuPrint_FunctionMenuitemInformation:
-	jmp		SHORT BootMenuPrint_ClearThreeInfoLines
-
-
-;--------------------------------------------------------------------
-; Prints Boot Menu title strings.
-;
-; BootMenuPrint_TitleStrings
-;	Parameters:
-;		Nothing
-;	Returns:
-;		AX:		Was printing successfull
-;	Corrupts registers:
-;		BX, DX, SI
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-BootMenuPrint_TitleStrings:
-	mov		si, ROMVARS.szTitle
-	call	PrintString_FromCS
-	call	BootMenuPrint_ClearOneInfoLine
-	mov		si, ROMVARS.szVersion
-	call	PrintString_FromCS
-	call	BootMenuPrint_ClearOneInfoLine
-	mov		si, g_szTitleLn3
-	call	PrintString_FromCS
-	jmp		SHORT BootMenuPrint_ClearOneInfoLine
+	push	di
+	mov		ax, dx
+	CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
+	pop		di
+	ret
