Prev: 42898 Up: Map Next: 42978
42902: Test Laser Hits
Walk the alien and object slots and test each one for a laser hit.
Test the six alien slots, then object slots 1 and 3.
TestLaserHits 42902 LD HL,25008 HL=Alien_Slot_1.
42905 LD DE,24 DE=0024.
42908 LD B,6 Set a slot counter in B for 6 loops.
42910 CALL TestLaserHits_Loop Call TestLaserHits_Loop.
Test object slots 1 and 3 in turn.
42913 LD HL,24840 HL=Object_Slot_1.
42916 LD B,1 Set a slot counter in B for 1 loop.
42918 CALL TestLaserHits_Loop Call TestLaserHits_Loop.
42921 LD HL,24888 HL=Object_Slot_3.
42924 LD B,1 Set a slot counter in B for 1 loop.
42926 CALL TestLaserHits_Loop Call TestLaserHits_Loop.
Test slots 2 and 4 when their type is 200-203.
42929 LD HL,24864 HL=Object_Slot_2.
42932 LD A,(HL) Fetch the slot type.
42933 SUB 200 Subtract 200.
42935 CP 4 Jump to TestLaserHits_Slot4 if that is at least 4.
42937 JR NC,TestLaserHits_Slot4
42939 LD B,1 Set a slot counter in B for 1 loop.
42941 CALL TestLaserHits_Loop Call TestLaserHits_Loop.
Test object slot 4 the same way.
TestLaserHits_Slot4 42944 LD HL,24912 HL=Object_Slot_4.
42947 LD A,(HL) Fetch the slot type.
42948 SUB 200 Subtract 200.
42950 CP 4 Return if that is at least 4.
42952 RET NC
42953 LD B,1 Set a slot counter in B for 1 loop.
Compare this slot against the current laser pulse.
TestLaserHits_Loop 42955 LD A,(HL) Fetch the slot type.
42956 AND A Jump to TestLaserHits_NextSlot if the slot is free.
42957 JR Z,TestLaserHits_NextSlot
42959 BIT 2,(IX+2) Jump to TestLaserHits_NextSlot if bit 2 of pulse 1 is reset.
42963 JR Z,TestLaserHits_NextSlot
42965 PUSH BC Stash BC, DE and HL on the stack.
42966 PUSH DE
42967 PUSH HL
42968 CALL TestOneHit Call TestOneHit.
42971 POP HL Restore HL, DE and BC from the stack.
42972 POP DE
42973 POP BC
TestLaserHits_NextSlot 42974 ADD HL,DE HL+=DE.
42975 DJNZ TestLaserHits_Loop Decrease the counter by one and jump back to TestLaserHits_Loop until it is zero.
42977 RET Return.
Prev: 42898 Up: Map Next: 42978