Prev: 6AF5 Up: Map Next: 6B2B
6B12: Erase Object
Used by the routine at HandlerObjects.
Erases an object that is no longer in view and empties its slot. An empty slot is handled by the pause loop at HandlerObjects_EmptySlot instead.
Input
HL The object slot
B Number of object slots left to handle
EraseObject 6B12 LD A,(HL) Fetch the sprite ID of the object.
6B13 AND A If A is zero then the slot is empty, so jump to HandlerObjects_EmptySlot.
6B14 JR Z,HandlerObjects_EmptySlot
6B16 PUSH BC Stash BC and HL on the stack.
6B17 PUSH HL
6B18 PUSH HL Point IX at the object (using the stack to do so).
6B19 POP IX
6B1B CALL StoreEntity Copy the position and sprite ID of the object using StoreEntity.
6B1E CALL RemoveEntity Call RemoveEntity to erase the object from the screen.
6B21 POP HL Restore HL from the stack.
6B22 XOR A Set A to 00 ready to empty the slot.
6B23 LD (HL),A Empty the slot by clearing the sprite ID of the object.
6B24 INC HL Increment HL by one.
6B25 LD (HL),A Write 00 to the next byte of the object.
6B26 INC HL Increment HL by one.
6B27 LD (HL),A Write 00 to the final byte of the object.
6B28 POP BC Restore BC from the stack.
6B29 JR NextObject_2 Jump to NextObject_2.
Prev: 6AF5 Up: Map Next: 6B2B