Prev: 9356 Up: Map Next: 93A6
9395: Find Unused Alien Slot
Used by the routines at 9466 and 970E.
Output
F Z: slot available
F NZ: no available slots
HL The alien slot address
FindSlotAlien 9395 LD HL,$61B0 HL=Alien_States.
There are a maximum of 6 aliens on screen at a time.
9398 LD B,$06 B=06 (alien counter).
939A LD DE,$0018 DE=0018 (the length of each slot).
FindSlotAlien_Loop 939D LD A,(HL) A=HL.
939E AND A Jump to FindSlotAlien_Return if A is zero.
939F JR Z,FindSlotAlien_Return
93A1 ADD HL,DE HL=HL+DE.
93A2 DJNZ FindSlotAlien_Loop Decrease alien slot counter by one and loop back to FindSlotAlien_Loop until counter is zero.
93A4 AND A If no available slot was found, ensure the Z flag is unset (so NZ is true).
FindSlotAlien_Return 93A5 RET Return.
Prev: 9356 Up: Map Next: 93A6