Prev: 40260 Up: Map Next: 40381
40343: Routine at 9D97
Used by the routines at Action_Inventory, 37134, Action_Examine, 41040 and ActionTie.
Output
A The number of objects
ObjectCount 40343 PUSH IX Stash IX, IY and BC on the stack.
40345 PUSH IY
40347 PUSH BC
40348 LD B,0 Initialise the count of the number of objects.
40350 LD IX,49248 Set IX to $C060 which is 3 bytes less than the start of the object table due to the following line adding $0003 and moving us on to the first record.
ObjectCount_Loop 40354 CALL Step3ByteTable_Next Call Step3ByteTable_Next to fetch the next record in IY.
40357 JR Z,ObjectCount_End Jump to ObjectCount_End if we've reached the end of the table data.
40359 CP (IY+1) Don't count this record if it's a "Mother Object", if it is then loop back to ObjectCount_Loop to continue.
40362 JR NZ,ObjectCount_Loop
40364 BIT 7,(IY+7) Don't count this record if it's not "visible", if not then loop back to ObjectCount_Loop to continue.
40368 JR Z,ObjectCount_Loop
40370 INC B Increase B, the object counter, by one.
40371 JP ObjectCount_Loop Jump to ObjectCount_Loop.
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.
Prev: 40260 Up: Map Next: 40381