Prev: 37718 Up: Map Next: 37798
37781: Find Unused Alien Slot
Used by the routines at 37990 and 38670.
Output
F Z: slot available
F NZ: no available slots
HL The alien slot address
FindSlotAlien 37781 LD HL,25008 HL=Alien_States.
There are a maximum of 6 aliens on screen at a time.
37784 LD B,6 B=6 (alien counter).
37786 LD DE,24 DE=0024 (the length of each slot).
FindSlotAlien_Loop 37789 LD A,(HL) A=HL.
37790 AND A Jump to FindSlotAlien_Return if A is zero.
37791 JR Z,FindSlotAlien_Return
37793 ADD HL,DE HL=HL+DE.
37794 DJNZ FindSlotAlien_Loop Decrease alien slot counter by one and loop back to FindSlotAlien_Loop until counter is zero.
37796 AND A If no available slot was found, ensure the Z flag is unset (so NZ is true).
FindSlotAlien_Return 37797 RET Return.
Prev: 37718 Up: Map Next: 37798