Prev: 9171 Up: Map Next: 91B2
918B: In-Game: Move Cursor
Used by the routine at InGameControls.
Input
A Keypress
InGame_MoveCursor 918B PUSH AF Stash the keypress on the stack.
918C LD B,$78 B=INK: BLACK, PAPER: WHITE (BRIGHT) .
918E CALL InGame_UpdateCursorPosition Call InGame_UpdateCursorPosition.
9191 POP AF Restore the keypress from the stack.
9192 CP $04 Jump to Handler_MoveCursorRight if "right" was pressed.
9194 LD A,($91D8)
9197 JR Z,Handler_MoveCursorRight
Else "left" was pressed, so check if there's a slot on the left still to move to.
9199 OR A Jump to InGame_MoveCursorLeft if *InGame_HighlightedOption is not zero.
919A JR NZ,InGame_MoveCursorLeft
The cursor IS at the first position, 00 so reset it to the last position +01.
919C LD A,$03 A=03.
Process the "left" action.
InGame_MoveCursorLeft 919E DEC A Decrease A by one.
919F JR InGame_WriteCursorPosition Jump to InGame_WriteCursorPosition.
Handle moving the cursor right.
Handler_MoveCursorRight 91A1 CP $02 Jump to InGame_MoveCursorRight if the cursor still has slots to the right it can move to, and is not in the last position.
91A3 JR NZ,InGame_MoveCursorRight
The cursor IS at the last position, 02 so reset it to the starting position -01.
91A5 LD A,$FF A=FF.
Process the "right" action.
InGame_MoveCursorRight 91A7 INC A Increment the cursor position by one.
The cursor position has changed, left or right, both actions follow the same flow.
InGame_WriteCursorPosition 91A8 LD ($91D8),A Write A to *InGame_HighlightedOption.
91AB LD B,$68 B=INK: BLACK, PAPER: CYAN (BRIGHT) .
91AD CALL InGame_UpdateCursorPosition Call InGame_UpdateCursorPosition.
91B0 JR InGameControls_Loop Jump to InGameControls_Loop.
Prev: 9171 Up: Map Next: 91B2