![]() |
Routines |
| Prev: A792 | Up: Map | Next: A7E2 |
|
Walk the alien and object slots and test each one for a laser hit.
|
||||
|
Test the six alien slots, then object slots 01 and 03.
|
||||
| TestLaserHits | A796 | LD HL,$61B0 | HL=Alien_Slot_1. | |
| A799 | LD DE,$0018 | DE=0018. | ||
| A79C | LD B,$06 | Set a slot counter in B for 06 loops. | ||
| A79E | CALL TestLaserHits_Loop | Call TestLaserHits_Loop. | ||
|
Test object slots 01 and 03 in turn.
|
||||
| A7A1 | LD HL,$6108 | HL=Object_Slot_1. | ||
| A7A4 | LD B,$01 | Set a slot counter in B for 01 loop. | ||
| A7A6 | CALL TestLaserHits_Loop | Call TestLaserHits_Loop. | ||
| A7A9 | LD HL,$6138 | HL=Object_Slot_3. | ||
| A7AC | LD B,$01 | Set a slot counter in B for 01 loop. | ||
| A7AE | CALL TestLaserHits_Loop | Call TestLaserHits_Loop. | ||
|
Test slots 02 and 04 when their type is C8-CB.
|
||||
| A7B1 | LD HL,$6120 | HL=Object_Slot_2. | ||
| A7B4 | LD A,(HL) | Fetch the slot type. | ||
| A7B5 | SUB $C8 | Subtract C8. | ||
| A7B7 | CP $04 | Jump to TestLaserHits_Slot4 if that is at least 04. | ||
| A7B9 | JR NC,TestLaserHits_Slot4 | |||
| A7BB | LD B,$01 | Set a slot counter in B for 01 loop. | ||
| A7BD | CALL TestLaserHits_Loop | Call TestLaserHits_Loop. | ||
|
Test object slot 04 the same way.
|
||||
| TestLaserHits_Slot4 | A7C0 | LD HL,$6150 | HL=Object_Slot_4. | |
| A7C3 | LD A,(HL) | Fetch the slot type. | ||
| A7C4 | SUB $C8 | Subtract C8. | ||
| A7C6 | CP $04 | Return if that is at least 04. | ||
| A7C8 | RET NC | |||
| A7C9 | LD B,$01 | Set a slot counter in B for 01 loop. | ||
|
Compare this slot against the current laser pulse.
|
||||
| TestLaserHits_Loop | A7CB | LD A,(HL) | Fetch the slot type. | |
| A7CC | AND A | Jump to TestLaserHits_NextSlot if the slot is free. | ||
| A7CD | JR Z,TestLaserHits_NextSlot | |||
| A7CF | BIT 2,(IX+$02) | Jump to TestLaserHits_NextSlot if bit 2 of pulse 01 is reset. | ||
| A7D3 | JR Z,TestLaserHits_NextSlot | |||
| A7D5 | PUSH BC | Stash BC, DE and HL on the stack. | ||
| A7D6 | PUSH DE | |||
| A7D7 | PUSH HL | |||
| A7D8 | CALL TestOneHit | Call TestOneHit. | ||
| A7DB | POP HL | Restore HL, DE and BC from the stack. | ||
| A7DC | POP DE | |||
| A7DD | POP BC | |||
| TestLaserHits_NextSlot | A7DE | ADD HL,DE | HL+=DE. | |
| A7DF | DJNZ TestLaserHits_Loop | Decrease the counter by one and jump back to TestLaserHits_Loop until it is zero. | ||
| A7E1 | RET | Return. | ||
| Prev: A792 | Up: Map | Next: A7E2 |