Prev: 691F Up: Map Next: 6973
6938: Highlight Menu Item
Used by the routines at Handle_Menu and Read_Menu_Key.
Moves the highlight until FRAMES wraps, then returns *Menu_Highlight.
Input
A Initial selection
Output
A Highlighted selection
Set the timeout, then apply the initial selection.
Highlight_Menu_Item 6938 EX AF,AF' Stash the selection in AF'.
6939 LD A,$C8 Write C8 to *FRAMES.
693B LD ($5C78),A
693E EX AF,AF' Restore the selection from AF'.
693F JR Test_Menu_Choice Jump to Test_Menu_Choice.
Scan for a new choice.
Highlight_Menu_Loop 6941 CALL Scan_Menu_Keys Call Scan_Menu_Keys.
6944 CP $FF Jump to Check_Highlight_Timeout if no key is pressed.
6946 JR Z,Check_Highlight_Timeout
Leave the highlight if the choice is unchanged.
Test_Menu_Choice 6948 LD B,A Jump to Check_Highlight_Timeout if the choice matches *Menu_Highlight.
6949 LD A,($E1F0)
694C CP B
694D JR Z,Check_Highlight_Timeout
Unhighlight the old row, and highlight the new one.
694F LD A,B Stash the new choice in AF'.
6950 EX AF,AF'
6951 LD A,($E1F0) Fetch *Menu_Highlight.
6954 CALL Menu_Attribute_Address Call Menu_Attribute_Address.
6957 CALL Fill_Menu_Attributes Call Fill_Menu_Attributes.
695A EX AF,AF' Restore the new choice from AF'.
695B LD ($E1F0),A Write the choice to *Menu_Highlight.
695E CALL Menu_Attribute_Address Call Menu_Attribute_Address.
6961 CALL Fill_Menu_Highlight Call Fill_Menu_Highlight.
6964 LD A,$C8 Write C8 to *FRAMES.
6966 LD ($5C78),A
Loop until the frame counter wraps.
Check_Highlight_Timeout 6969 LD A,($5C78) Jump to Highlight_Menu_Loop until *FRAMES wraps.
696C INC A
696D JR NZ,Highlight_Menu_Loop
Return the highlighted selection.
696F LD A,($E1F0) Fetch *Menu_Highlight.
6972 RET Return.
Prev: 691F Up: Map Next: 6973