![]() |
Routines |
| Prev: 6DCC | Up: Map | Next: 6E4F |
|
Used by the routine at TurnReadAndTokeniseTheCommand.
Reads one line into the input buffer. Cursor keys become the compass letters, and a quote or full stop ends a word.
|
||||
| ReadTheInputLine | 6DD6 | LD HL,$0BB8 | Store 0BB8 in *B714. | |
| 6DD9 | LD ($B714),HL | |||
|
Update the action countdown.
|
||||
| 6DDC | LD A,$01 | Write 01 to *WaitCountdown and *B6FA. | ||
| 6DDE | LD ($B701),A | |||
| 6DE1 | LD ($B6FA),A | |||
|
Print the ">" prompt.
|
||||
| 6DE4 | LD A,$3E | Print '>'. | ||
| 6DE6 | CALL Print_Character | |||
|
Print a space.
|
||||
| 6DE9 | LD A,$20 | Print a space. | ||
| 6DEB | CALL Print_Character | |||
| 6DEE | LD HL,$6FF9 | Point at the input buffer. | ||
| 6DF1 | LD B,$80 | Start the free-space count at 80. | ||
| ReadTheInputLine_Loop | 6DF3 | LD C,$00 | No characters have been rubbed out yet. | |
|
This entry point is used by the routine at Input_MapACursorKey.
Read the next key.
|
||||
| ReadTheInputLine_WaitForAKey | 6DF5 | CALL Input_WaitForAKey | Call Input_WaitForAKey to wait for a key. | |
| 6DF8 | BIT 7,B | Jump to ReadTheInputLine_TestTheRubOutKey if bit 7 of the free-space count in B is clear. | ||
| 6DFA | JR Z,ReadTheInputLine_TestTheRubOutKey | |||
| 6DFC | CP $40 | Jump to Input_MapACursorKey_ReadAnotherKeyWhenTheFlagIsSet when the character is 40. | ||
| 6DFE | JP Z,Input_MapACursorKey_ReadAnotherKeyWhenTheFlagIsSet | |||
| ReadTheInputLine_TestTheRubOutKey | 6E01 | BIT 0,C | Call Input_MapACursorKey if bit 0 of C (set once a character has been rubbed out) is clear. | |
| 6E03 | CALL Z,Input_MapACursorKey | |||
| 6E06 | LD C,$01 | Set the rubbed-out flag and jump to ReadTheInputLine_TestForABackspace unless the key is 18. | ||
| 6E08 | CP $18 | |||
| 6E0A | JR NZ,ReadTheInputLine_TestForABackspace | |||
|
Rub out the whole line.
|
||||
| 6E0C | CALL Input_RubOutCharacters | Call Input_RubOutCharacters to rub out characters. | ||
| 6E0F | JR ReadTheInputLine_Loop | Jump back to ReadTheInputLine_Loop to read the next character. | ||
| ReadTheInputLine_TestForABackspace | 6E11 | CP $08 | Jump to ReadTheInputLine_TestForALetter unless the key is 08. | |
| 6E13 | JR NZ,ReadTheInputLine_TestForALetter | |||
| 6E15 | BIT 7,B | Jump back to ReadTheInputLine_WaitForAKey if bit 7 of the free-space count in B is set. | ||
| 6E17 | JR NZ,ReadTheInputLine_WaitForAKey | |||
|
Print character 08.
|
||||
| 6E19 | LD A,$08 | Print a backspace. | ||
| 6E1B | CALL Print_Character | |||
| 6E1E | INC B | One more byte of the line is free. | ||
| 6E1F | DEC HL | Step back one byte through 6FF9. | ||
| 6E20 | JR ReadTheInputLine_WaitForAKey | Jump back to ReadTheInputLine_WaitForAKey to read the next key. | ||
| ReadTheInputLine_TestForALetter | 6E22 | CP $40 | Jump to ReadTheInputLine_RememberTheAcceptedKey if the key is not below 40. | |
| 6E24 | JR NC,ReadTheInputLine_RememberTheAcceptedKey | |||
| 6E26 | CP $22 | Jump to ReadTheInputLine_RememberTheAcceptedKey if the key is a quote. | ||
| 6E28 | JR Z,ReadTheInputLine_RememberTheAcceptedKey | |||
| 6E2A | CP $20 | Jump to ReadTheInputLine_RememberTheAcceptedKey if the key is a space. | ||
| 6E2C | JR Z,ReadTheInputLine_RememberTheAcceptedKey | |||
| 6E2E | CP $0D | Jump to ReadTheInputLine_RememberTheAcceptedKey if the key is ENTER. | ||
| 6E30 | JR Z,ReadTheInputLine_RememberTheAcceptedKey | |||
| 6E32 | CP $2E | Jump to ReadTheInputLine_RememberTheAcceptedKey if the key is a full stop. | ||
| 6E34 | JR Z,ReadTheInputLine_RememberTheAcceptedKey | |||
| 6E36 | CP $2C | Jump back to ReadTheInputLine_WaitForAKey if the key is not a comma. | ||
| 6E38 | JR NZ,ReadTheInputLine_WaitForAKey | |||
| ReadTheInputLine_RememberTheAcceptedKey | 6E3A | LD ($B704),A | Remember this key at B704 so the next letter is capitalised. | |
| 6E3D | DEC B | Jump to ReadTheInputLine_FinishWhenTheKeyIsEnter if the free-space count in B is zero. | ||
| 6E3E | INC B | |||
| 6E3F | JR Z,ReadTheInputLine_FinishWhenTheKeyIsEnter | |||
|
Print the character in A.
|
||||
| 6E41 | CALL Print_Character | Call Print_Character to print one character. | ||
| 6E44 | LD (HL),A | Store it at 6FF9 and step on. | ||
| 6E45 | INC HL | |||
| 6E46 | DEC B | One fewer byte of the line is free. | ||
| ReadTheInputLine_FinishWhenTheKeyIsEnter | 6E47 | CP $0D | Jump back to ReadTheInputLine_WaitForAKey if the key is not ENTER. | |
| 6E49 | JP NZ,ReadTheInputLine_WaitForAKey | |||
| 6E4C | OR $01 | Clear the zero flag so ENTER ends the line. | ||
| 6E4E | RET | Return. | ||
|
View the equivalent code in;
|
||||
| Prev: 6DCC | Up: Map | Next: 6E4F |