Prev: 28118 Up: Map Next: 28299
28239: Input: Map A Cursor Key
Used by the routine at ReadTheInputLine.
Turns a cursor key into the matching direction letter and plants ENTER after it.
Input_MapACursorKey 28239 CP 9 Jump to Input_MapACursorKey_TurnTheRightKeyIntoE if the key is right.
28241 JR Z,Input_MapACursorKey_TurnTheRightKeyIntoE
28243 CP 8 Jump to Input_MapACursorKey_TurnTheLeftKeyIntoW if the key is left.
28245 JR Z,Input_MapACursorKey_TurnTheLeftKeyIntoW
28247 CP 10 Jump to Input_MapACursorKey_TurnTheDownKeyIntoS if the key is down.
28249 JR Z,Input_MapACursorKey_TurnTheDownKeyIntoS
28251 CP 91 Return if the key is not up. The up cursor is 91.
28253 RET NZ
28254 LD A,78 Turn the cursor key into the letter N.
Input_MapACursorKey_StoreTheDirectionLetter 28256 LD (HL),A Store it at 28665 and step on.
28257 INC HL
Print the character in A.
28258 CALL Print_Character Call Print_Character to print one character.
28261 DEC B One fewer byte of the line is free.
28262 LD A,13 Set the line being typed to ENTER.
28264 LD (HL),A
28265 INC HL Step to the next byte of the input buffer.
28266 DEC B One fewer byte of the line is free.
28267 OR 1 Clear the zero flag. The direction letter is followed by ENTER.
28269 RET Return.
Input_MapACursorKey_TurnTheDownKeyIntoS 28270 LD A,83 Turn the cursor key into the letter S.
28272 JR Input_MapACursorKey_StoreTheDirectionLetter Jump back to Input_MapACursorKey_StoreTheDirectionLetter to store the letter S.
Input_MapACursorKey_TurnTheRightKeyIntoE 28274 LD A,69 Turn the cursor key into the letter E.
28276 JR Input_MapACursorKey_StoreTheDirectionLetter Jump back to Input_MapACursorKey_StoreTheDirectionLetter to store the letter E.
Input_MapACursorKey_TurnTheLeftKeyIntoW 28278 LD A,87 Turn the cursor key into the letter W.
28280 JR Input_MapACursorKey_StoreTheDirectionLetter Jump back to Input_MapACursorKey_StoreTheDirectionLetter to store the letter W.
This entry point is used by the routine at ReadTheInputLine.
Test the fresh-game flag.
Input_MapACursorKey_ReadAnotherKeyWhenTheFlagIsSet 28282 LD A,(46874) Jump to ReadTheInputLine_WaitForAKey if *46874 is not zero.
28285 AND A
28286 JP NZ,ReadTheInputLine_WaitForAKey
Print character 8.
28289 LD A,8 Print a backspace.
28291 CALL Print_Character
Print the character in A.
28294 CALL Print_Character Call Print_Character to print one character.
28297 XOR A Return zero.
28298 RET Return.
View the equivalent code in;
Prev: 28118 Up: Map Next: 28299