Prev: 46764 Up: Map Next: 46816
46780: Parser: Process Item
Used by the routine at GameLoop.
Parser: Process Item.
Set up to loop through all word tokens in the token buffer.
ParserProcessItem 46780 LD HL,44846 Set a pointer to the word token buffer (the first word token) in HL.
46783 LD B,10 Set a counter in B for 10 tokens (the maximum number of words).
Check if there are any tokens to process. Return immediately if the first token is the terminator (255), meaning the input was empty.
ProcessItem_Loop 46785 LD A,(HL) Return if the current token is 255 (no more tokens to process).
46786 CP 255
46788 RET Z
46789 PUSH HL Remember the token and the count while the object list is searched.
46790 PUSH BC
46791 LD HL,(44770) Load the object list table pointer into HL.
46794 LD BC,(44786) Load the number of objects into BC (for the CPIR search).
46798 CPIR Search the object list table to see if the token matches any object ID.
46800 JR NZ,ParserProcessItem_0 Jump to ParserProcessItem_0 if the token doesn't match any object ID (not an item token).
The token matches an object ID. Now verify that the item is actually present (in the current room or player's inventory).
46802 CALL ActionExamineItem Call ActionExamineItem to check if the item is present and accessible.
46805 JR NC,ParserProcessItem_0 Jump to ParserProcessItem_0 to check the next token if the item is here (carry flag clear).
46807 POP BC Restore BC, HL from the stack.
46808 POP HL
46809 RET Return with the carry flag set, as a named item isn't here.
ParserProcessItem_0 46810 POP BC Restore BC, HL from the stack.
46811 POP HL
46812 INC HL Move to the next token in the buffer.
46813 DJNZ ProcessItem_Loop Decrease the counter by one and loop back to ProcessItem_Loop until all 10 tokens have been checked.
46815 RET Return (no valid item tokens were found in the input).
Prev: 46764 Up: Map Next: 46816