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.
Handler_UserInput 45568 CALL SetDefaultScreenPosition Call SetDefaultScreenPosition to park the cursor on the default line.
45571 LD HL,44796 Point HL at CommandBuffer.
45574 LD A,32 Fill the command buffer with spaces.
45576 LD B,50
Handler_UserInput_Loop 45578 LD (HL),A Store A at the buffer pointer.
45579 INC HL Advance HL to the next byte.
45580 DJNZ Handler_UserInput_Loop Count down B and repeat from Handler_UserInput_Loop until the count is exhausted.
45582 CALL PrintInputPrompt Call PrintInputPrompt to print the input prompt.
45585 LD HL,44796 Point HL at CommandBuffer.
This entry point is used by the routine at UserInput_Delete.
UserInput_Loop 45588 CALL GetUserInput Call GetUserInput to read the player's key.
45591 CP 12 Branch to UserInput_Delete when the player pressed DELETE.
45593 JR Z,UserInput_Delete
45595 CP 13 Branch to UserInput_Enter when the player pressed ENTER.
45597 JR Z,UserInput_Enter
45599 CP 32 Branch to UserInput_Loop unless the player pressed SPACE.
45601 JR C,UserInput_Loop
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,UserInput_Loop
45613 LD (HL),A Store A at the buffer pointer.
45614 CALL SwitchNormalScreenOutput Call SwitchNormalScreenOutput 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 UserInput_Loop Read the next key at UserInput_Loop.
Prev: 45561 Up: Map Next: 45623