Prev: 71E2 Up: Map Next: 722E
71F3: Does a typed name fit an object's name?
Used by the routines at MATCH_PATTERN, FIND_NAMED_OBJECT and ROOM_BY_NAME.
The noun has to match; the adjectives need not be typed at all, and are accepted in either order -- it tries them as given, then swapped -- but one that does not belong rules the object out. Called directly on the small curious key: KEY, CURIOUS KEY, SMALL CURIOUS KEY and CURIOUS SMALL KEY all match; LARGE KEY, SMALL LARGE KEY and MAP do not.
Input
HL The typed name
IY The object's name
Output
F Z if it fits
NAME_MATCHES 71F3 PUSH DE
71F4 PUSH HL
71F5 PUSH IY
71F7 CALL WORD_MATCHES The nouns must match, or it is not this object
71FA JR NZ,NAME_MATCHES_1
71FC LD A,$01 Note that the noun matched
71FE LD (NAME_FAILED),A
7201 CALL WORD_MATCHES Adjectives in the order typed? Then it fits, A = 0
7204 JR NZ,NAME_MATCHES_0
7206 CALL WORD_MATCHES
7209 LD A,$00
720B JR Z,NAME_MATCHES_1
NAME_MATCHES_0 720D POP IY Otherwise start again from the beginning of both names...
720F POP HL
7210 PUSH HL
7211 PUSH IY
7213 LD DE,$0004 ...compare the first typed adjective with the object's second...
7216 ADD IY,DE
7218 INC HL
7219 INC HL
721A CALL WORD_MATCHES
721D JR NZ,NAME_MATCHES_1
721F LD DE,$FFFC ...and the second typed adjective with the object's first: A = 1 if that fits
7222 ADD IY,DE
7224 CALL WORD_MATCHES
7227 LD A,$01
NAME_MATCHES_1 7229 POP IY
722B POP HL
722C POP DE
722D RET
Prev: 71E2 Up: Map Next: 722E