![]() |
Routines |
| Prev: 87AF | Up: Map | Next: 8813 |
|
Searches for a free enemy slot (one with type FF) by stepping IX through the slots, which are 18 bytes long. No slot is returned if too many enemies are alive or if the player's ship is exploding.
|
||||||||||||||||
| FindFreeSlot | 87F6 | LD B,A | Store the number of slots in B. | |||||||||||||
| 87F7 | LD A,($8E2B) | Fetch the number of enemies that are alive from 8E2B. | ||||||||||||||
| 87FA | CP $07 | Jump to FindFreeSlot_None if it is 07 or more. | ||||||||||||||
| 87FC | JR NC,FindFreeSlot_None | |||||||||||||||
| 87FE | LD A,($8F53) | Fetch the death counter from 8F53. | ||||||||||||||
| 8801 | AND A | Test it. | ||||||||||||||
| 8802 | JR NZ,FindFreeSlot_None | Jump to FindFreeSlot_None if the ship is exploding. | ||||||||||||||
| 8804 | LD DE,$0018 | Set the size of a slot in DE. | ||||||||||||||
| FindFreeSlot_Loop | 8807 | LD A,(IX+$00) | Fetch the type of the object in the slot. | |||||||||||||
| 880A | INC A | Increment it. | ||||||||||||||
| 880B | RET Z | Return with the zero flag set if the type was FF. | ||||||||||||||
| 880C | ADD IX,DE | Move on to the next slot. | ||||||||||||||
| 880E | DJNZ FindFreeSlot_Loop | Decrease the slot counter by one and loop back to FindFreeSlot_Loop until none remain. | ||||||||||||||
| FindFreeSlot_None | 8810 | OR %00000001 | Clear the zero flag. | |||||||||||||
| 8812 | RET | Return. | ||||||||||||||
| Prev: 87AF | Up: Map | Next: 8813 |