![]() |
Routines |
| Prev: BF69 | Up: Map | Next: BFAA |
|
Used by the routines at Handler_UnknownWord and GameLoop.
Read a line of text, then turn it into vocabulary tokens.
|
||||
|
Reset the cursor to the top of the text window.
|
||||
| Handler_UserInput | BF73 | CALL SetDefaultScreenPosition | Call SetDefaultScreenPosition to park the cursor at the top of the text. | |
|
Clear the command buffer.
|
||||
| BF76 | LD HL,$BB04 | Start at the command buffer (CommandBuffer). | ||
| BF79 | LD A,$20 | Prepare a space (20) and a counter of 32 bytes. | ||
| BF7B | LD B,$32 | |||
| EmptyCommandBuffer_Loop | BF7D | LD (HL),A | Write spaces through the whole command buffer. | |
| BF7E | INC HL | |||
| BF7F | DJNZ EmptyCommandBuffer_Loop | |||
|
Print the ">" prompt.
|
||||
| BF81 | CALL PrintInputPrompt | Call PrintInputPrompt. | ||
|
Collect keypresses.
|
||||
| BF84 | LD HL,$BB04 | Start again at the beginning of the command. | ||
|
This entry point is used by the routine at UserInput_Delete.
Wait for the next key.
|
||||
| UserInput_Loop | BF87 | CALL GetUserInput | Call GetUserInput. | |
|
DELETE rubs out a character. ENTER finishes the line. Any other control key is ignored.
|
||||
| BF8A | CP $0C | Jump to UserInput_Delete if DELETE was pressed. | ||
| BF8C | JR Z,UserInput_Delete | |||
| BF8E | CP $0D | Jump to UserInput_Enter if ENTER was pressed. | ||
| BF90 | JR Z,UserInput_Enter | |||
| BF92 | CP $20 | Jump back to UserInput_Loop when the key is below SPACE. | ||
| BF94 | JR C,UserInput_Loop | |||
|
Is the command buffer full?
|
||||
| BF96 | EX DE,HL | Jump back to UserInput_Loop once the pointer has reached the sentinel at BB35. | ||
| BF97 | LD HL,$BB35 | |||
| BF9A | AND A | |||
| BF9B | SBC HL,DE | |||
| BF9D | EX DE,HL | |||
| BF9E | JR Z,UserInput_Loop | |||
|
The key is valid, so store it and print it.
|
||||
| BFA0 | LD (HL),A | Write the key into the command buffer. | ||
| BFA1 | CALL SwitchNormalScreenOutput | Call SwitchNormalScreenOutput to select the screen channel. | ||
| BFA4 | CALL PrintCharacter | Call PrintCharacter to echo the key. | ||
| BFA7 | INC HL | Advance to the next space in the buffer. | ||
| BFA8 | JR UserInput_Loop | Jump back to UserInput_Loop for the next key. | ||
|
View the equivalent code in;
|
||||
| Prev: BF69 | Up: Map | Next: BFAA |