![]() |
Routines |
| Prev: 50359 | Up: Map | Next: 50411 |
|
Used by the routine at GameLoop.
Checks that every object the command names is here. For each word in UserInput_Token_1 that is an object, Parser_CheckObjectIsHere looks for one of its items in the current room or the inventory. If none is there, Parser_CheckObjectIsHere has already said so, and this returns with the carry flag set so that the game loop at GameLoop skips the command.
|
||||
|
Set up to loop through all word tokens in the token buffer.
|
||||
| Parser_ProcessItem | 50375 | LD HL,48486 | Set a pointer to the word token buffer (UserInput_Token_1) in HL. | |
| 50378 | 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 | 50380 | LD A,(HL) | Return if the current token is 255 (no more tokens to process). | |
| 50381 | CP 255 | |||
| 50383 | RET Z | |||
|
Check if this token refers to a game item by searching the object list table.
|
||||
| 50384 | PUSH HL | Stash the token pointer and counter on the stack for later restoration. | ||
| 50385 | PUSH BC | |||
| 50386 | LD HL,(48414) | Load the object list table pointer into HL. | ||
| 50389 | LD BC,(48426) | Load the number of objects into BC (for the CPIR search). | ||
| 50393 | CPIR | Search the object list table to see if the token matches any object ID. | ||
| 50395 | JR NZ,ProcessItem_NextToken | Jump to ProcessItem_NextToken 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).
|
||||
| 50397 | CALL Parser_CheckObjectIsHere | Call Parser_CheckObjectIsHere to check if the item is present and accessible. | ||
| 50400 | JR NC,ProcessItem_NextToken | Jump to ProcessItem_NextToken if the object is here (carry flag clear). | ||
|
The object isn't here and Parser_CheckObjectIsHere has printed why.
|
||||
| 50402 | POP BC | Restore the token pointer and counter from the stack. | ||
| 50403 | POP HL | |||
| 50404 | RET | Return with the carry flag set. | ||
|
This word isn't an object, or the object is here. Move on to the next word.
|
||||
| ProcessItem_NextToken | 50405 | POP BC | Restore the token pointer and counter from the stack. | |
| 50406 | POP HL | |||
| 50407 | INC HL | Move to the next token in the buffer. | ||
| 50408 | DJNZ ProcessItem_Loop | Decrease the counter by one and loop back to ProcessItem_Loop until all 10 tokens have been checked. | ||
| 50410 | RET | Return (every object named is here). | ||
|
View the equivalent code in;
|
||||
| Prev: 50359 | Up: Map | Next: 50411 |