Prev: B1F9 Up: Map Next: B237
B200: 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 B200 CALL SetDefaultScreenPosition Call SetDefaultScreenPosition to park the cursor on the default line.
B203 LD HL,$AEFC Point HL at CommandBuffer.
B206 LD A,$20 Fill the command buffer with spaces.
B208 LD B,$32
Handler_UserInput_Loop B20A LD (HL),A Store A at the buffer pointer.
B20B INC HL Advance HL to the next byte.
B20C DJNZ Handler_UserInput_Loop Count down B and repeat from Handler_UserInput_Loop until the count is exhausted.
B20E CALL PrintInputPrompt Call PrintInputPrompt to print the input prompt.
B211 LD HL,$AEFC Point HL at CommandBuffer.
This entry point is used by the routine at UserInput_Delete.
UserInput_Loop B214 CALL GetUserInput Call GetUserInput to read the player's key.
B217 CP $0C Branch to UserInput_Delete when the player pressed DELETE.
B219 JR Z,UserInput_Delete
B21B CP $0D Branch to UserInput_Enter when the player pressed ENTER.
B21D JR Z,UserInput_Enter
B21F CP $20 Branch to UserInput_Loop unless the player pressed SPACE.
B221 JR C,UserInput_Loop
B223 EX DE,HL Move the buffer position into DE so it can be checked against the end of the command buffer.
B224 LD HL,$AF2D Ignore a space once the command fills the buffer.
B227 AND A
B228 SBC HL,DE
B22A EX DE,HL
B22B JR Z,UserInput_Loop
B22D LD (HL),A Store A at the buffer pointer.
B22E CALL SwitchNormalScreenOutput Call SwitchNormalScreenOutput to switch to the normal screen output.
B231 CALL PrintCharacter Call PrintCharacter to print the character.
B234 INC HL Advance HL to the next byte.
B235 JR UserInput_Loop Read the next key at UserInput_Loop.
Prev: B1F9 Up: Map Next: B237