Prev: AFB7 Up: Map Next: AFEB
AFC7: Parser: Process Item
Used by the routine at GameLoop.
Parser_ProcessItem AFC7 LD HL,$A824 HL=UserInput_Token_1.
AFCA LD B,$0A Set a counter of 0A in B of the maximum number of tokens available in the user input.
ProcessItem_Loop AFCC LD A,(HL) Fetch a token byte from the user input pointer.
AFCD CP $FF Return if the terminator has been reached (FF).
AFCF RET Z
AFD0 PUSH HL Stash the user input token pointer and max count on the stack.
AFD1 PUSH BC
AFD2 LD HL,($A7D8) Load *Pointer_ObjectList into HL.
AFD5 LD BC,($A7E8) Load *Count_Objects into BC.
AFD9 CPIR Search for matching objects.
AFDB JR NZ,ProcessItem_Next Jump to ProcessItem_Next the current token wasn't found in the table.
AFDD CALL Parser_ValidateItem Call Parser_ValidateItem.
AFE0 JR NC,ProcessItem_Next Jump to ProcessItem_Next if the carry flag is not set.
AFE2 POP BC Restore the max count and user input token pointer from the stack.
AFE3 POP HL
AFE4 RET Return.
ProcessItem_Next AFE5 POP BC Restore the max count and user input token pointer from the stack.
AFE6 POP HL
AFE7 INC HL Increment the user input token pointer by one.
AFE8 DJNZ ProcessItem_Loop Decrease the max count by one and loop back to ProcessItem_Loop until all of the user input tokens have been evaluated.
AFEA RET Return.
View the equivalent code in The Jewels Of Babylon.
Prev: AFB7 Up: Map Next: AFEB