Prev: 45561 Up: Map Next: 45623
45568: Handler: User Input
Used by the routines at HandlerUnknownWord and GameLoop.
Read a command, tokenise it, and reject words the game does not know.
HandlerUserInput 45568 CALL SetDefaultScreenPosition Call SetDefaultScreenPosition to park the cursor on the default line.
45571 LD HL,44796 Point HL at the command buffer.
45574 LD A,32 Fill the command buffer with spaces.
45576 LD B,50
HandlerUserInput_Loop 45578 LD (HL),A Store A at the buffer pointer.
45579 INC HL Advance HL to the next byte.
45580 DJNZ HandlerUserInput_Loop Count down B and repeat from HandlerUserInput_Loop until the count is exhausted.
45582 CALL PrintInputPrompt Call PrintInputPrompt to print the input prompt.
45585 LD HL,44796 Point HL at the command buffer.
This entry point is used by the routine at HandlerUserPressedDELETE.
Handler_UserInput_ReadKey 45588 CALL GetUserInput Call GetUserInput to read the player's key.
45591 CP 12 Branch to HandlerUserPressedDELETE when the player pressed DELETE.
45593 JR Z,HandlerUserPressedDELETE
45595 CP 13 Branch to HandlerUserPressedENTER when the player pressed ENTER.
45597 JR Z,HandlerUserPressedENTER
45599 CP 32 Branch to Handler_UserInput_ReadKey unless the player pressed SPACE.
45601 JR C,Handler_UserInput_ReadKey
45603 EX DE,HL Move the buffer position into DE so it can be checked against the end of the command buffer.
45604 LD HL,44845 Ignore a space once the command fills the buffer.
45607 AND A
45608 SBC HL,DE
45610 EX DE,HL
45611 JR Z,Handler_UserInput_ReadKey
45613 LD (HL),A Store A at the buffer pointer.
45614 CALL SwitchToNormalScreenOutput Call SwitchToNormalScreenOutput to switch to the normal screen output.
45617 CALL PrintCharacter Call PrintCharacter to print the character.
45620 INC HL Advance HL to the next byte.
45621 JR Handler_UserInput_ReadKey Read the next key at Handler_UserInput_ReadKey.
Prev: 45561 Up: Map Next: 45623