Prev: 49567 Up: Map Next: 49639
49572: Find Objects In Cell
Used by the routine at DrawCellObjects.
Makes a list at CellObjectList of the addresses of all of the objects which are in a cell. The list ends with a zero word.
Input
HL The cell: the column in L and the row in H
Point at the list and the first object slot.
FindObjectsInCell 49572 LD IY,50002 Point IY at CellObjectList.
49576 LD IX,41597 Point IX at ObjectSlot_01.
Turn the cell round if the view is rotated.
49580 CALL ConvertCell Call ConvertCell.
49583 EX DE,HL Keep the column in E and the row in D.
Look at this slot.
FindObjectsInCell_Next 49584 LD A,(IX+0) Jump to FindObjectsInCell_Skip if the slot is not in use.
49587 AND A
49588 JR Z,FindObjectsInCell_Skip
49590 LD A,E Jump to FindObjectsInCell_Skip if the object is not in the same column.
49591 CP (IX+2)
49594 JR NZ,FindObjectsInCell_Skip
49596 LD A,D Jump to FindObjectsInCell_Skip if the object is not in the same row.
49597 CP (IX+4)
49600 JR NZ,FindObjectsInCell_Skip
49602 PUSH IX Copy the address of the object into HL (using the stack).
49604 POP HL
49605 LD (IY+0),L Add the address of the object to the list.
49608 LD (IY+1),H
49611 INC IY Move on to the next place in the list.
49613 INC IY
FindObjectsInCell_Skip 49615 LD BC,16 Move on to the next object slot.
49618 ADD IX,BC
49620 PUSH IX Copy the address of the slot into HL (using the stack).
49622 POP HL
See whether every slot has been looked at.
49623 LD BC,41837 Test whether this is past the last slot.
49626 AND A
49627 SBC HL,BC
Go back for the next slot.
49629 JR C,FindObjectsInCell_Next Jump to FindObjectsInCell_Next if it is not.
End the list.
49631 XOR A Write a zero word to the end of the list.
49632 LD (IY+0),A
49635 LD (IY+1),A
49638 RET Return.
View the equivalent code in;
Prev: 49567 Up: Map Next: 49639