![]() |
Routines |
| Prev: 46453 | Up: Map | Next: 46534 |
|
Used by the routines at ParserValidateDirectObject, Parser_ValidateInputTokens and ParserValidateAnyDirectObject.
Parser: Count Item References.
|
||||||||||||
| ParserCountItemReferences | 46500 | LD HL,44846 | Set a pointer to the first word token in HL. | |||||||||
| 46503 | LD B,10 | Set a token count in B of 10 which is the total length of the user input tokens. | ||||||||||
| 46505 | LD E,0 | Initialise the item counter held in E to 0. | ||||||||||
| Parser_CountItems_Loop | 46507 | LD A,(HL) | Fetch a user input token. | |||||||||
| 46508 | CP 255 | Jump to Parser_CountItems_Process if the terminator character (255) has been reached. | ||||||||||
| 46510 | JR Z,Parser_CountItems_Process | |||||||||||
| 46512 | PUSH HL | Remember the token and the count while the object list is searched. | ||||||||||
| 46513 | PUSH BC | |||||||||||
| 46514 | LD HL,(44770) | Load the pointer for the character-set pointer into HL. | ||||||||||
| 46517 | LD BC,(44786) | Fetch the count of the number of items in the table from the object count. | ||||||||||
| 46521 | CPIR | Search to see if the item room ID is in the table. | ||||||||||
| 46523 | POP BC | Restore BC, HL from the stack. | ||||||||||
| 46524 | POP HL | |||||||||||
| 46525 | JR NZ,Parser_CountItems_Skip | Jump to Parser_CountItems_Skip if this token doesn't refer to a game item. | ||||||||||
|
This token does point to a game item, so increase the item counter.
|
||||||||||||
| 46527 | INC E | Increment item counter by one. | ||||||||||
| Parser_CountItems_Skip | 46528 | INC HL | Move to the next token. | |||||||||
| 46529 | DJNZ Parser_CountItems_Loop | Decrease the token counter by one and loop back to Parser_CountItems_Loop until all the tokens have been evaluated. | ||||||||||
| Parser_CountItems_Process | 46531 | XOR A | Leave the number of items named in the command in A. The zero flag is set when none were named. | |||||||||
| 46532 | OR E | |||||||||||
| 46533 | RET | Return. | ||||||||||
|
View the equivalent code in;
|
||||||||||||
| Prev: 46453 | Up: Map | Next: 46534 |