Prev: 970E Up: Map Next: 98AE
9884: Test Alien Beside Slot
Return with the Z flag set if the alien is beside the object in World_Slot_2_Position, otherwise with the Z flag unset.
Input
IX Actor slot
TestAlienBesideSlot 9884 LD H,(IX+$03) Fetch the high byte of the world X.
9887 LD L,(IX+$02) Fetch the low byte of the world X.
988A LD DE,($60C2) Fetch World_Slot_2_Position.
988E LD BC,$0008 Add an 08 tolerance.
9891 ADD HL,BC
9892 SBC HL,DE Subtract the slot-2 position.
9894 LD A,H Fetch the high byte of the gap.
9895 AND %00011111 Keep only bits 0-4.
9897 JR NZ,TestAlienBesideSlot_NotBeside Jump to TestAlienBesideSlot_NotBeside if they are not on the same screen.
9899 LD A,L Fetch the low byte of the gap.
989A CP $10 Jump to TestAlienBesideSlot_NotBeside if it is at least 10.
989C JR NC,TestAlienBesideSlot_NotBeside
Test whether the alien is vertically close to the object.
989E LD A,($60C4) Fetch World_Slot_2_Y.
98A1 SUB (IX+$04) Subtract the alien's Y position.
98A4 CP $10 Jump to TestAlienBesideSlot_NotBeside if the Y gap is at least 10.
98A6 JR NC,TestAlienBesideSlot_NotBeside
98A8 XOR A Return with the Z flag set.
98A9 RET
TestAlienBesideSlot_NotBeside 98AA LD A,$01 Return with the Z flag unset.
98AC AND A
98AD RET
Prev: 970E Up: Map Next: 98AE