Sherlock: annotated disassembly

Routines

Prev: D978 Up: Map Next: D9B7
D99E: The '@' key on an empty line: do the last command again
Reached from the line editor (D8CF) when '@' is typed on an empty line. Unless a typed line still has sentences waiting ($A01B, when the key is ignored), sets D714 and ends the input. The word-list builder at D715 sees D714 and, instead of tokenizing the line again, reuses the tokens already at $5B81 - the previous command's.
Output
F NZ with $D714 set to 1, unless something has already been typed
A The key
D99E LD A,($A01B) Read $A01B in "Game variables" into A - Anything already typed ($A01B set)? Then '@' is an ordinary character (D8C3)
D9A1 AND A Test A for zero (this leaves A as it was and clears carry)
D9A2 JP NZ,$D8C3 If A is not zero, go back to D8C3
D9A5 LD A,$01 Load A with $01 - D714 = 1: use the last word list again
D9A7 LD ($D714),A Store A in "Flag: repeat the last command ('@')" (D714)
D9AA OR $01 Set bit 0 of A
This entry point is used by the routine at D8AD.
D9AC PUSH AF Save AF on the stack - Rub out the '@' just printed: two backspaces ($08)
D9AD LD A,$08 Load A with $08
D9AF CALL $A9B7 Call the routine "Print character A, a word at a time (word wrap)" (A9B7)
D9B2 CALL $A9B7 Call the routine "Print character A, a word at a time (word wrap)" (A9B7)
D9B5 POP AF Restore AF from the stack
D9B6 RET Return to the caller
Prev: D978 Up: Map Next: D9B7