![]() |
Routines |
| Prev: 40272 | Up: Map | Next: 40381 |
|
Used by the routines at Action_Inventory, ActionOpenOrClose, Action_Examine, TableListWhatIsHere and ActionTie.
Counts the visible objects at the location or container in A. A character id counts what that character holds. An object is visible when bit 7 of its attribute byte is set.
|
||||||||||||
| ObjectCount | 40343 | PUSH IX | Initialise the object count. | |||||||||
| 40345 | PUSH IY | |||||||||||
| 40347 | PUSH BC | |||||||||||
| 40348 | LD B,0 | |||||||||||
| 40350 | LD IX,49248 | Use the slot before the object table as this object. | ||||||||||
| ObjectCount_Loop | 40354 | CALL Table_FindTheRecord | Call Table_FindTheRecord to fetch the next record in IY. | |||||||||
| 40357 | JR Z,ObjectCount_End | Jump to ObjectCount_End at the end of the object index. | ||||||||||
| 40359 | CP (IY+1) | Jump back to ObjectCount_Loop without counting this object if its location is not the id in A. | ||||||||||
| 40362 | JR NZ,ObjectCount_Loop | |||||||||||
| 40364 | BIT 7,(IY+7) | Jump back to ObjectCount_Loop without counting this object if it is not visible. | ||||||||||
| 40368 | JR Z,ObjectCount_Loop | |||||||||||
| 40370 | INC B | Count one more object. | ||||||||||
| 40371 | JP ObjectCount_Loop | Jump back to ObjectCount_Loop to find the record. | ||||||||||
| ObjectCount_End | 40374 | LD A,B | Store the object count in A. | |||||||||
| 40375 | POP BC | Restore BC, IY and IX from the stack. | ||||||||||
| 40376 | POP IY | |||||||||||
| 40378 | POP IX | |||||||||||
| 40380 | RET | Return. | ||||||||||
|
View the equivalent code in;
|
||||||||||||
| Prev: 40272 | Up: Map | Next: 40381 |