Prev: 7E5F Up: Map Next: 7ED3
7E6C: Parser: a noun phrase
Collects one noun phrase into the buffer at $7C45 (cleared by the main parser loop): up to two prepositions (7EE6; a third one is an error), any number of articles (skipped), up to two adjectives (7ED3; a third one is an error), and a noun, which ends the phrase (7E9B stores it at $7C49). Adjectives enter at 7E93 and nouns at 7E9B. A phrase that ends without a noun (for example 'look through') is allowed and simply has no noun.
The phrase is then stored in the frame by 7EF5: the first phrase at offset 4 and the second at offset 14. When ALL EXCEPT is in force ($B609 = 2), each extra noun phrase instead starts a new frame (7F22), with bit 6 of its verb marked, so that 'take all except the sword and the key' produces one frame per exception.
7E6C CALL $7EE6 Store the preposition
7E6F CALL $7F3D Next word
7E72 CP $70 Another preposition?
7E74 JR Z,$7E6C Yes: store it too
7E76 CP $80 An article?
7E78 JR NZ,$7E83
7E7A BIT 4,E Are articles allowed here?
7E7C CALL Z,$7FEE No: syntax error
7E7F RES 4,E Only one article
7E81 JR $7E6F Next word
7E83 CP $60 An adjective?
7E85 JR Z,$7E93
7E87 CP $50 A noun?
7E89 JR Z,$7E9B
7E8B LD HL,($B5CB) Anything else ends the phrase: step back so it is read again
7E8E LD ($B5CD),HL
7E91 JR $7EA1
7E93 CALL $7ED3 Store the adjective
7E96 CALL $7F3D Next word
7E99 JR $7E83
7E9B LD HL,$7C49 Store the noun
7E9E LD (HL),C
7E9F INC HL
7EA0 LD (HL),B
7EA1 LD D,$50 The phrase is complete. Under ALL EXCEPT...
7EA3 LD A,($B609)
7EA6 CP $02
7EA8 JR NZ,$7ECC
7EAA LD HL,($7C45) ...a phrase without a preposition...
7EAD LD A,H
7EAE OR L
7EAF JR NZ,$7EC9
7EB1 BIT 6,(IY+$19) ...is an exception: is this frame already an exception frame?
7EB5 JR NZ,$7EBF
7EB7 LD BC,$FFE8 No: make a new frame for it
7EBA ADD IY,BC
7EBC CALL $7F2E
7EBF CALL $7F1A Store the phrase as its first noun phrase...
7EC2 LD (IY+$01),$40 ...and mark the frame as an exception (bit 6)
7EC6 JP $7C7E Next noun phrase
7EC9 CALL $7F22 A phrase with a preposition under ALL EXCEPT: new frame
7ECC CALL $7EF5 Store the phrase in the frame
7ECF JP Z,$7C7E Next noun phrase
7ED2 RET
Prev: 7E5F Up: Map Next: 7ED3