Prev: 79A9 Up: Map Next: 7A14
79B6: Turn a parsed sentence into an action and do it
Used by the routines at OBEY and TAKE_ORDER.
MATCH_PATTERN finds the sentence's pattern; the action code is its place in ACTION_PATTERNS, counted from 1, into ACTION and PARSED_ACTION. The pattern's options are set (PATTERN_OPTIONS) and the search for the target begun. A pattern with objects goes to MATCH_AND_TRY, and anything it leaves to be said to TARGET_TROUBLE. With ALL, it goes round again for each object, passing over one an EXCEPT names -- which is what EXCEPTED is believed to check.
PARSE_ACTION 79B6 LD A,$FF No objects yet; clear the phrases; match the pattern
79B8 LD (INSTRUMENT),A
79BB LD (TARGET),A
79BE CALL CLEAR_PHRASES
79C1 CALL MATCH_PATTERN
79C4 RET Z
79C5 LD A,$01 The action code is the pattern's place in the table
79C7 PUSH IX
79C9 POP HL
79CA LD DE,ACTION_PATTERNS
79CD SBC HL,DE
79CF JR Z,PARSE_ACTION_1
79D1 LD DE,$0008
PARSE_ACTION_0 79D4 INC A
79D5 SBC HL,DE
79D7 JR NZ,PARSE_ACTION_0
PARSE_ACTION_1 79D9 LD (ACTION),A Keep it, and the pattern; set its options, start the search
79DC LD (PARSED_ACTION),A
79DF LD (PATTERN),IX
79E3 CALL PATTERN_OPTIONS
79E6 CALL START_TARGETS
79E9 XOR A Only tests from here
79EA LD (DOING_IT),A
79ED LD A,(FLAGS_FIRST_WORDS) No objects in the pattern: done
79F0 AND $0C
79F2 JR Z,PARSE_ACTION_3
79F4 LD A,(ALL_BIT) ALL?
79F7 LD (ALL_ACTION),A
79FA RLCA
79FB AND $01
79FD LD (WITH_ALL),A
PARSE_ACTION_2 7A00 CALL MATCH_AND_TRY Match and try; trouble: TARGET_TROUBLE
7A03 JP NZ,TARGET_TROUBLE
7A06 LD A,(ALL_ACTION) With ALL, on to the next object that is not excepted
7A09 AND A
7A0A JR Z,PARSE_ACTION_3
7A0C CALL EXCEPTED
7A0F JR NZ,PARSE_ACTION_2
PARSE_ACTION_3 7A11 OR $01
7A13 RET
Prev: 79A9 Up: Map Next: 7A14