Prev: 26770 Up: Map Next: 26848
26788: Parser: Resolve Phrase
Used by the routine at GameLoop.
Replace a typed phrase with the verb it stands for.
Parser_ResolvePhrase 26788 INC BC The search stops one byte past the matching noun.
26789 LD A,(25288) Fetch how many nouns the game knows.
26792 SUB C Select this noun's phrase and the marker that ends it.
26793 LD B,A
26794 LD E,A
26795 LD A,254
26797 LD HL,(25298) Fetch the noun-phrase table.
26800 INC B Count the phrase terminator as one more step.
26801 JR Parser_ResolvePhrase_Step1 Continue at Parser_ResolvePhrase_Step1 to walk past the phrases already considered.
Parser_ResolvePhrase_Loop1 26803 INC HL Skip a byte inside the phrase just passed.
Parser_ResolvePhrase_Loop2 26804 INC HL Walk forward until the end-of-phrase marker.
26805 CP (HL)
26806 JR Z,Parser_ResolvePhrase_Loop1
Parser_ResolvePhrase_Step1 26808 DJNZ Parser_ResolvePhrase_Loop2 Repeat for each phrase before this noun.
26810 JR Parser_ResolvePhrase_Step2 Continue at Parser_ResolvePhrase_Step2 to read the object this phrase names.
Parser_ResolvePhrase_Loop3 26812 INC HL Step to the next byte of the phrase.
Parser_ResolvePhrase_Step2 26813 LD A,(HL) Read the object this phrase refers to.
26814 CALL IsObjectInCurrentRoom Call IsObjectInCurrentRoom to test whether the object is here.
26817 RET Z Return when that object is here or being carried.
26818 INC HL Step to the next byte of the phrase.
26819 LD A,(HL) Read the marker that follows the object.
26820 CP 254 Jump back to Parser_ResolvePhrase_Loop3 when another object follows in the phrase (254).
26822 JR Z,Parser_ResolvePhrase_Loop3
26824 LD HL,25464 Print I can't see on the same line.
26827 CALL PrintString
26830 LD IX,(25300) Fetch the noun table.
26834 CALL GetTableEntry Call GetTableEntry to look up the table entry.
26837 CALL PrintString Call PrintString to print the message.
26840 LD HL,25477 Print here..
26843 CALL PrintStringAndANewline
26846 SCF Set the carry flag to reject the command.
26847 RET Return.
Prev: 26770 Up: Map Next: 26848