Prev: B6AC Up: Map Next: B6E0
B6BC: 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 B6BC LD HL,$AF2E Set a pointer to the word token buffer (the first word token) in HL.
B6BF LD B,$0A Set a counter in B for 0A tokens (the maximum number of words).
Check if there are any tokens to process. Return immediately if the first token is the terminator (FF), meaning the input was empty.
ProcessItem_Loop B6C1 LD A,(HL) Return if the current token is FF (no more tokens to process).
B6C2 CP $FF
B6C4 RET Z
B6C5 PUSH HL Remember the token and the count while the object list is searched.
B6C6 PUSH BC
B6C7 LD HL,($AEE2) Load the object list table pointer into HL.
B6CA LD BC,($AEF2) Load the number of objects into BC (for the CPIR search).
B6CE CPIR Search the object list table to see if the token matches any object ID.
B6D0 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).
B6D2 CALL ActionExamineItem Call ActionExamineItem to check if the item is present and accessible.
B6D5 JR NC,ParserProcessItem_0 Jump to ParserProcessItem_0 to check the next token if the item is here (carry flag clear).
B6D7 POP BC Restore BC, HL from the stack.
B6D8 POP HL
B6D9 RET Return with the carry flag set, as a named item isn't here.
ParserProcessItem_0 B6DA POP BC Restore BC, HL from the stack.
B6DB POP HL
B6DC INC HL Move to the next token in the buffer.
B6DD DJNZ ProcessItem_Loop Decrease the counter by one and loop back to ProcessItem_Loop until all 0A tokens have been checked.
B6DF RET Return (no valid item tokens were found in the input).
Prev: B6AC Up: Map Next: B6E0