![]() |
Routines |
Prev: A5DB | Up: Map | Next: A62C |
Used by the routines at Parser_ValidateDirectObject, Parser_ValidateInputTokens and Parser_ValidateAnyDirectObject.
Count how many tokens in the user input refer to game items.
|
||||||||||
Parser_CountItems | A60A | LD HL,$A13B | Set a pointer to UserInput_Token_1 in HL. | |||||||
A60D | LD B,$0A | Set a token count in B of 0A which is the total length of the user input tokens. | ||||||||
A60F | LD E,$00 | Initialise the item counter held in E to 00. | ||||||||
Parser_CountItems_Loop | A611 | LD A,(HL) | Fetch a user input token. | |||||||
A612 | CP $FF | Jump to Parser_CountItems_Process if the terminator character (FF) has been reached. | ||||||||
A614 | JR Z,Parser_CountItems_Process | |||||||||
A616 | PUSH HL | Stash the token pointer and token counter on the stack. | ||||||||
A617 | PUSH BC | |||||||||
A618 | LD HL,$B49E | HL=Table_TokenItemList. | ||||||||
A61B | LD BC,($BBC9) | Fetch the count of the number of items in the table from *Count_Objects_2. | ||||||||
A61F | CPIR | Search to see if the item ID is in the table. | ||||||||
A621 | POP BC | Restore the token counter and token pointer from the stack. | ||||||||
A622 | POP HL | |||||||||
A623 | 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.
|
||||||||||
A625 | INC E | Increment item counter by one. | ||||||||
Parser_CountItems_Skip | A626 | INC HL | Move to the next token. | |||||||
A627 | 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 | A629 | XOR A | Transfer the item count into A and set flags accordingly. | |||||||
A62A | OR E | |||||||||
A62B | RET | Return. | ||||||||
View the equivalent code in;
|
Prev: A5DB | Up: Map | Next: A62C |