Sherlock: annotated disassembly

Routines

Prev: B6DA Up: Map Next: B772
B6FD: Do the slot's words name some of the room's scenery?
The actor's room record (D33C) has at +7/+8 the address of a list of scenery words - things its description mentions that are not objects (none: Z). The list is read word by word (B77F); adjectives (class $60) and a noun ($50, B772 gives the class) are gathered into a pattern at $AAAC and matched against the slot at HL (A4E0). NZ when they match.
Input
HL The slot's words
Output
F Z if the words do not name some scenery of the room; NZ if they do
B6FD XOR A Clear A to zero (and the carry flag)
B6FE LD ($B77E),A Store A in "B6FD's flag" (B77E)
B701 LD ($B6D8),HL Remember the slot's words
B704 CALL $D33C Call the routine "IX = record of the actor's room" (D33C) - The actor's room record: +7/+8 point at its scenery words; none: Z
B707 LD L,(IX+$07) Read byte +7 of the record at IX into L
B70A LD H,(IX+$08) Read byte +8 of the record at IX into H
B70D LD A,H Copy H into A
B70E OR L Set in A the bits that are set in L
B70F RET Z If the result is zero, return
B710 PUSH HL Save HL on the stack
B711 POP IX Restore IX from the stack
B713 LD HL,$0000 Load HL with $0000
B716 LD ($B6D6),HL Store HL in "B6FD's working pointers" (B6D6)
B719 LD IY,$AAAC Build each scenery phrase as a pattern at $AAAC
B71D LD HL,$AAAC Point HL at $AAAC - Clear the pattern
B720 LD B,$06 Load B with $06
B722 CALL $A2AB Call the routine "Fill B bytes at HL with zero (or, from A2AC, with A)" (A2AB)
B725 CALL $B77F Call the routine "Fetch the next word for B6FD's name match" (B77F) - Next word (B77F); none left: Z, not scenery
B728 RET Z If the zero flag is set, return
B729 CALL $B772 Call the routine "A = the class of dictionary word DE" (B772) - A noun ($50) ends the phrase; an adjective ($60) goes in the first adjective place
B72C CP $50 Compare A with $50
B72E JR Z,$B75A If A equals $50, jump on to B75A
B730 CP $60 Compare A with $60
B732 JR NZ,$B725 If A differs from $60, go back to B725
B734 LD (IY+$02),E Store E in byte +2 of the record at IY
B737 LD (IY+$03),D Store D in byte +3 of the record at IY
B73A CALL $B77F Call the routine "Fetch the next word for B6FD's name match" (B77F) - Second word: a noun ends it, a second adjective is kept
B73D RET Z If the zero flag is set, return
B73E CALL $B772 Call the routine "A = the class of dictionary word DE" (B772)
B741 CP $50 Compare A with $50
B743 JR Z,$B75A If A equals $50, skip ahead to B75A
B745 CP $60 Compare A with $60
B747 JR NZ,$B71D If A differs from $60, go back to B71D
B749 LD (IY+$04),E Store E in byte +4 of the record at IY
B74C LD (IY+$05),D Store D in byte +5 of the record at IY
B74F CALL $B77F Call the routine "Fetch the next word for B6FD's name match" (B77F) - Third word: must be the noun
B752 RET Z If the zero flag is set, return
B753 CALL $B772 Call the routine "A = the class of dictionary word DE" (B772)
B756 CP $50 Compare A with $50
B758 JR NZ,$B71D If A differs from $50, go back to B71D
B75A LD (IY+$00),E Store E in the first byte of the record at IY - The noun goes first in the pattern
B75D LD (IY+$01),D Store D in byte +1 of the record at IY
B760 LD HL,($B6D8) Read B6D8 in "B6FD's working pointers" into HL - Do the slot's words name it (A4E0)? No: on to the next phrase
B763 CALL $A4E0 Call A4E0 (inside "Do the pattern words at IY name the words...")
B766 JR NZ,$B71D If the zero flag is clear, go back to B71D
B768 LD IX,($B6D6) Read "B6FD's working pointers" (B6D6) into IX - Yes: free the word list B77F built (A1AF) and return NZ
B76C CALL $A1AF Call the routine "Free every node of the list starting at IX" (A1AF)
B76F OR $01 Make A non-zero, which clears the zero flag, and hand that back to the caller
B771 RET Return to the caller
Prev: B6DA Up: Map Next: B772