Prev: 757A Up: Map Next: 75D2
7585: Parse one command from the tokens
Used by the routine at START.
Called by the main loop with TOKEN_POINTER pointing into TOKENS; returns NZ to go back for another line. A line of several commands -- joined by THEN, or by a full stop -- is taken one command at a time, the main loop coming back here while MORE_COMMANDS says there is more.
PARSE_COMMAND 7585 LD IY,COMMAND_FRAME Start at the first frame, outside any quotation
7589 XOR A
This entry point is used by the routine at ORDER_BEGINS.
PARSE_ORDER 758A LD (IS_ORDER),A }
758D CALL CLEAR_ALL_EXCEPT No ALL or EXCEPT, and no frames yet: CLEAR_ALL_EXCEPT leaves A zero
7590 LD (COMMAND_FRAMES),A
7593 LD E,$FF Was the last command left unfinished -- after 'which key?', say? Then fit these words into it
7595 LD A,(QUESTION_WAITING)
7598 AND A
7599 LD D,$A0
759B JP NZ,END_COMMAND
759E LD D,$C0 A fresh command
This entry point is used by the routines at PARSE_THEN and PARSE_SPECIAL.
PARSE_NEXT_COMMAND 75A0 XOR A E says what may come next: bit 1 a verb, bit 2 an adverb, bit 4 an article, and more
75A1 LD (PHRASE),A
75A4 LD A,E
75A5 OR $C7
75A7 LD E,A
75A8 LD A,(ALL_EXCEPT) In one case a verb may not start here
75AB CP $02
75AD JR NZ,PARSE_COMMAND_0
75AF RES 1,E
PARSE_COMMAND_0 75B1 CALL CLEAR_FRAME Clear this frame
NEW_NOUN_PHRASE 75B4 LD HL,PHRASE_PREPOSITIONS Start a new noun phrase, and allow an article
75B7 LD B,$0A
75B9 CALL CLEAR_BYTES
75BC SET 4,E
This entry point is used by the routine at PARSE_ARTICLE.
PARSE_NEXT_WORD 75BE CALL NEXT_TOKEN Next token: its class in D
CLASS_DISPATCH 75C1 PUSH DE Go to the handler for its class, from PARSER_CLASSES
75C2 RRCA
75C3 RRCA
75C4 RRCA
75C5 LD E,A
75C6 LD D,$00
75C8 LD HL,PARSER_CLASSES
75CB ADD HL,DE
75CC LD E,(HL)
75CD INC HL
75CE LD D,(HL)
75CF EX DE,HL
75D0 POP DE
75D1 JP (HL)
Prev: 757A Up: Map Next: 75D2