Index: trunk/XTIDE_Universal_BIOS/Src/Menus/HotkeyBar.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Menus/HotkeyBar.asm	(revision 601)
+++ trunk/XTIDE_Universal_BIOS/Src/Menus/HotkeyBar.asm	(revision 603)
@@ -23,11 +23,10 @@
 
 ;--------------------------------------------------------------------
-; Handler for INT 1Ch System Timer Tick.
+; Handler for INT 1Ch User Timer Tick.
 ; Reads key presses and draws hotkey bar.
 ;
 ; HotkeyBar_TimerTickHandler
 ;	Parameters:
-;		DS:		RAMVARS segment
-;		ES:		BDA segment (zero)
+;		Nothing
 ;	Returns:
 ;		Nothing
@@ -38,7 +37,24 @@
 HotkeyBar_TimerTickHandler:
 	push	es
+%ifndef USE_186		; LOAD_BDA_SEGMENT_TO will corrupt AX on 8088/8086
+	push	ax
+%endif
+
+	;!!! Keep interrupts disabled so there won't be another
+	; timer tick call before we are ready
+
+	LOAD_BDA_SEGMENT_TO es, ax
+
+	; Call previous handler
+	pushf
+	call	FAR [es:BOOTVARS.hotkeyVars+HOTKEYVARS.fpPrevTimerHandler]
+
+	; Update Hotkeybar (process key input and draw) every fourth tick
+	test	BYTE [es:BDA.dwTimerTicks], 11b
+	jnz		SHORT .ReturnFromHandler
+
 	push	ds
 %ifdef USE_186
-	ePUSHA
+	pusha
 %else
 	push	di
@@ -46,27 +62,10 @@
 	push	dx
 	push	cx
-	push	ax
-%endif
-
-	;!!! Keep interrupts disabled so there won't be another
-	; timer tick call before we are ready
-
-	LOAD_BDA_SEGMENT_TO es, ax
+%endif
 	call	RamVars_GetSegmentToDS
-
-	; Call previous handler
-	pushf
-	call	FAR [es:BOOTVARS.hotkeyVars+HOTKEYVARS.fpPrevTimerHandler]
-
-	; Update Hotkeybar (process key input and draw) every fourth tick
-	test	BYTE [es:BDA.dwTimerTicks], 11b
-	jnz		SHORT .ReturnFromHandler
-	call	UpdateDuringDriveDetection
-
-.ReturnFromHandler:
+	call	HotkeyBar_UpdateDuringDriveDetection
 %ifdef USE_186
-	ePOPA
+	popa
 %else
-	pop		ax
 	pop		cx
 	pop		dx
@@ -75,4 +74,9 @@
 %endif
 	pop		ds
+
+.ReturnFromHandler:
+%ifndef USE_186
+	pop		ax
+%endif
 	pop		es
 	iret
@@ -91,5 +95,5 @@
 ;		AX, CX, DX, SI, DI
 ;--------------------------------------------------------------------
-UpdateDuringDriveDetection:
+HotkeyBar_UpdateDuringDriveDetection:
 	call	ScanHotkeysFromKeyBufferAndStoreToBootvars
 
@@ -113,10 +117,12 @@
 ;--------------------------------------------------------------------
 HotkeyBar_DrawToTopOfScreen:
-	; Store current screen coordinates to be restored
-	; when Hotkey Bar is rendered
-	call	DetectPrint_GetSoftwareCoordinatesToAX
+	; Store current screen coordinates to stack
+	; (to be restored when Hotkey Bar is rendered)
+	CALL_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX
 	push	ax
 
-	call	MoveCursorToScreenTopLeftCorner
+	; Move cursor to top left corner (0, 0)
+	xor		ax, ax
+	call	HotkeyBar_SetCursorCoordinatesFromAX
 	; Fall to .PrintFloppyDriveHotkeys
 
@@ -230,19 +236,5 @@
 ;--------------------------------------------------------------------
 .EndHotkeyBarRendering:
-	call	HotkeyBar_ClearRestOfTopRow
-	pop		ax
-	jmp		SHORT HotkeyBar_RestoreCursorCoordinatesFromAX
-
-
-;--------------------------------------------------------------------
-; HotkeyBar_ClearRestOfTopRow
-;	Parameters:
-;		Nothing
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		AX, CX, DI
-;--------------------------------------------------------------------
-HotkeyBar_ClearRestOfTopRow:
+	; Clear the rest of the top row
 	CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH
 	eMOVZX	cx, al
@@ -250,5 +242,22 @@
 	sub		cl, al
 	mov		al, ' '
-	JMP_DISPLAY_LIBRARY PrintRepeatedCharacterFromALwithCountInCX
+	CALL_DISPLAY_LIBRARY PrintRepeatedCharacterFromALwithCountInCX
+
+	; Restore the saved coordinates from stack
+	pop		ax
+	; Fall to HotkeyBar_SetCursorCoordinatesFromAX
+
+
+;--------------------------------------------------------------------
+; HotkeyBar_SetCursorCoordinatesFromAX
+;	Parameters:
+;		Nothing
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX, DI
+;--------------------------------------------------------------------
+HotkeyBar_SetCursorCoordinatesFromAX:
+	JMP_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
 
 
@@ -373,31 +382,4 @@
 
 ;--------------------------------------------------------------------
-; MoveCursorToScreenTopLeftCorner
-;	Parameters:
-;		Nothing
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		AX, DI
-;--------------------------------------------------------------------
-MoveCursorToScreenTopLeftCorner:
-	xor		ax, ax			; Top left corner (0, 0)
-	; Fall to HotkeyBar_RestoreCursorCoordinatesFromAX
-
-
-;--------------------------------------------------------------------
-; HotkeyBar_RestoreCursorCoordinatesFromAX
-;	Parameters:
-;		Nothing
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		AX, DI
-;--------------------------------------------------------------------
-HotkeyBar_RestoreCursorCoordinatesFromAX:
-	JMP_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
-
-
-;--------------------------------------------------------------------
 ; HotkeyBar_StoreDefaultDriveLettersToHotkeyVars
 ;	Parameters:
@@ -432,9 +414,9 @@
 
 	; Store system 1Ch Timer Tick handler and install our hotkeybar handler
-	mov		ax, [BIOS_SYSTEM_TIMER_TICK_INTERRUPT_1Ch*4]
+	mov		ax, [BIOS_USER_TIMER_TICK_INTERRUPT_1Ch*4]
 	mov		[BOOTVARS.hotkeyVars+HOTKEYVARS.fpPrevTimerHandler], ax
-	mov		ax, [BIOS_SYSTEM_TIMER_TICK_INTERRUPT_1Ch*4+2]
+	mov		ax, [BIOS_USER_TIMER_TICK_INTERRUPT_1Ch*4+2]
 	mov		[BOOTVARS.hotkeyVars+HOTKEYVARS.fpPrevTimerHandler+2], ax
-	mov		al, BIOS_SYSTEM_TIMER_TICK_INTERRUPT_1Ch
+	mov		al, BIOS_USER_TIMER_TICK_INTERRUPT_1Ch
 	mov		si, HotkeyBar_TimerTickHandler
 	call	Interrupts_InstallHandlerToVectorInALFromCSSI
