Sherlock: annotated disassembly

Routines

Prev: AFB3 Up: Map Next: AFFA
AFE1: Handler guards: only at the start of a sentence
AFE1 and AFE8 throw the word back as ordinary (AF67) when the parse so far (A012, $A01B, flags in E) says it is not where a command word belongs.
Input
E Parse flags
Output
F Returns if E bit 1 is set; otherwise the caller is abandoned with NZ
AFE1 BIT 1,E Test bit 1 of E - Guard: E bit 1 set (start of a sentence)? Then return
AFE3 RET NZ If bit 1 of E is set, return
AFE4 POP HL Restore HL from the stack - Otherwise drop the caller's return address and refuse: NZ, 'not a special word' (AF67)
AFE5 JP $AF67 Go back to the routine "Not a special word: NZ" (AF67)
This entry point is used by the routine at B01C.
AFE8 BIT 1,E Test bit 1 of E - (Second guard) E bit 1 clear: return
AFEA RET Z If bit 1 of E is clear, return
AFEB LD A,($A012) Read A012 in "Game variables" into A - Otherwise refuse unless nothing has been read yet in this sentence (A012, $A01B both zero)
AFEE AND A Test A for zero (this leaves A as it was and clears carry)
AFEF JR NZ,$AFF6 If A is not zero, skip ahead to AFF6
AFF1 LD A,($A01B) Read $A01B in "Game variables" into A
AFF4 AND A Clear the carry flag for the caller (A is unchanged)
AFF5 RET NZ If A is not zero, return
AFF6 POP HL Restore HL from the stack - Refuse (AF67)
AFF7 JP $AF67 Go back to the routine "Not a special word: NZ" (AF67)
Prev: AFB3 Up: Map Next: AFFA