Prev: 27381 Up: Map Next: 27435
27410: 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 27410 LD A,(HL) Fetch the sprite ID of the object.
27411 AND A If A is zero then the slot is empty, so jump to HandlerObjects_EmptySlot.
27412 JR Z,HandlerObjects_EmptySlot
27414 PUSH BC Stash BC and HL on the stack.
27415 PUSH HL
27416 PUSH HL Point IX at the object (using the stack to do so).
27417 POP IX
27419 CALL StoreEntity Copy the position and sprite ID of the object using StoreEntity.
27422 CALL RemoveEntity Call RemoveEntity to erase the object from the screen.
27425 POP HL Restore HL from the stack.
27426 XOR A Set A to 0 ready to empty the slot.
27427 LD (HL),A Empty the slot by clearing the sprite ID of the object.
27428 INC HL Increment HL by one.
27429 LD (HL),A Write 0 to the next byte of the object.
27430 INC HL Increment HL by one.
27431 LD (HL),A Write 0 to the final byte of the object.
27432 POP BC Restore BC from the stack.
27433 JR NextObject_2 Jump to NextObject_2.
Prev: 27381 Up: Map Next: 27435