Prev: 24830 Up: Map Next: 25202
25151: Move Marker
Used by the routine at ShowTitleMenu.
Moves the marker of one player, in the title menu, towards the control method option that is chosen. When the marker has reached the option, the key of the player ("1" or "2") chooses the next option. The marker moves down by one pixel at a time and up by four pixels at a time.
Input
IX The record of the marker (see MarkerRecords)
E The bit of the key of the player: 1 for "1" and 2 for "2"
MoveMarker 25151 LD A,(IX+2) Fetch the number of the chosen option from the record of the marker and keep it in B.
25154 LD B,A
25155 LD HL,25211 Point HL at the table of the vertical positions of the options at OptionPositions.
25158 CALL AddToAddress Add the number of the option to find its position.
25161 LD C,(HL) Fetch the position of the option into C.
25162 LD A,C Copy it into A.
25163 SUB (IX+1) Subtract the current position of the marker.
25166 JR NZ,MoveMarker_Step Jump to MoveMarker_Step if the marker has not reached the option.
25168 LD A,247 Read from the keyboard;
Port Number Bit
0 1 2 3 4
247 1 2 3 4 5
25170 CALL ReadKeyboard
25173 AND E Test the bit of the key of the player.
25174 JR Z,MoveMarker_Step Jump to MoveMarker_Step if the key is not being pressed.
25176 LD A,B Fetch the number of the chosen option again.
25177 INC A Move onto the next option.
25178 AND %00000011 Keep the number in the range 0-3.
25180 LD (IX+2),A Store the new number of the option in the record of the marker.
25183 LD HL,25211 Point HL at OptionPositions.
25186 CALL AddToAddress Add the number of the option to find its position.
25189 LD C,(HL) Fetch the position of the new option into C.
MoveMarker_Step 25190 LD A,C Copy the position of the option into A.
25191 SUB (IX+1) Subtract the current position of the marker.
25194 RET Z Return if the marker is at the option.
25195 RLA Rotate the sign of the difference into the carry flag.
25196 JR C,MoveMarkerUp Jump to MoveMarkerUp if the option is above the marker.
25198 INC (IX+1) Move the marker down by one pixel.
25201 RET Return.
Prev: 24830 Up: Map Next: 25202