![]() |
Routines |
| Prev: 6683 | Up: Map | Next: 66E1 |
|
Used by the routine at Handler_Worms.
A worm was found at Percy's position; check if Percy is low enough to collect it and not already carrying one.
|
||||||||
| Handler_Worm_Found | 66A8 | LD A,(IX+$01) | Jump to Animate_Worm if Percy's Y position is less than 79 (not low enough to pick up the worm). | |||||
| 66AB | CP $79 | |||||||
| 66AD | JR C,Animate_Worm | |||||||
| 66AF | LD A,($5FAA) | Jump to Animate_Worm if *CarryingWormFlag is set (so Percy is already carrying a worm). | ||||||
| 66B2 | OR A | |||||||
| 66B3 | JR NZ,Animate_Worm | |||||||
|
Percy is in position and not carrying; collect the worm.
|
||||||||
| 66B5 | OR %11111111 | Set *CarryingWormFlag to FF (mark Percy as carrying a worm). | ||||||
| 66B7 | LD ($5FAA),A | |||||||
| 66BA | PUSH DE | Stash the position, worm counter and room attribute pointer on the stack. | ||||||
| 66BB | PUSH BC | |||||||
| 66BC | PUSH HL | |||||||
| 66BD | DEC HL | Move back three bytes in the room attribute data and write 1E to mark this worm as collected. | ||||||
| 66BE | DEC HL | |||||||
| 66BF | DEC HL | |||||||
| 66C0 | LD (HL),$1E | |||||||
| 66C2 | PUSH IX | Stash IX on the stack. | ||||||
|
|
||||||||
| 66C4 | LD DE,$0064 | Play a two-part collection sound effect by calling BEEP with durations of 0064/ 00C8 then 0064/ 0064. | ||||||
| 66C7 | LD HL,$00C8 | |||||||
| 66CA | CALL $03B5 | |||||||
| 66CD | LD HL,$0064 | |||||||
| 66D0 | LD DE,$0064 | |||||||
| 66D3 | CALL $03B5 | |||||||
| 66D6 | POP IX | Restore IX, the room attribute pointer, worm counter and position from the stack. | ||||||
| 66D8 | POP HL | |||||||
| 66D9 | POP BC | |||||||
| 66DA | POP DE | |||||||
| 66DB | XOR A | Write 00 to clear *EggDropFlag. | ||||||
| 66DC | LD ($5FA9),A | |||||||
| 66DF | JR Next_Worm_Entry | Jump to Next_Worm_Entry to continue scanning. | ||||||
| Prev: 6683 | Up: Map | Next: 66E1 |