![]() |
Routines |
| Prev: 768C | Up: Map | Next: 77AE |
|
Used by the routine at Handler_Plane.
Manages the plane's bomb. When the plane is above Percy, a bomb is dropped which falls downward. When the bomb hits or the explosion timer expires, Percy is damaged. The explosion cycles through animation frames before clearing.
|
||||
|
Check the bomb explosion counter.
|
||||
| Handle_Plane_Bomb | 7713 | LD A,($77AE) | Fetch the bomb explosion counter from *Bomb_Explosion_Counter. | |
| 7716 | OR A | Jump to Bomb_Explosion if the counter is non-zero (explosion in progress). | ||
| 7717 | JR NZ,Bomb_Explosion | |||
| 7719 | BIT 7,(IY+$03) | Jump to Check_Bomb_Drop if bit 7 of *IY+03 is not set (no bomb active). | ||
| 771D | JR Z,Check_Bomb_Drop | |||
|
Bomb is falling; update its position.
|
||||
| 771F | LD IX,$DAF0 | Point IX at Sprite03_2Wide_X_Position (bomb sprite data). | ||
| 7723 | LD (IX+$03),$14 | Set the bomb sprite frame to 14. | ||
| 7727 | LD A,(IX+$01) | Add 03 to the bomb Y position. | ||
| 772A | ADD A,$03 | |||
| 772C | CP $A0 | Jump to Bomb_Hit_Ground if the Y position has reached A0 (hit the ground). | ||
| 772E | JR NC,Bomb_Hit_Ground | |||
| 7730 | LD (IX+$01),A | Write the updated Y position to *IX+01. | ||
| 7733 | PUSH IY | Stash IY on the stack. | ||
| 7735 | LD IX,$DAC0 | Point IX at Percy_X_Position (Percy sprite data). | ||
| 7739 | LD IY,$DAF0 | Point IY at Sprite03_2Wide_X_Position (bomb sprite data). | ||
| 773D | CALL CheckEggCollision | Call CheckEggCollision to check for collision between the bomb and Percy. | ||
| 7740 | POP IY | Restore IY from the stack. | ||
| 7742 | RET C | Return if there was no collision (carry set). | ||
| 7743 | LD (IY+$03),$00 | Write 00 to *IY+03 (deactivate the bomb). | ||
| 7747 | LD A,$07 | Write 07 to *Bomb_Explosion_Counter (start the explosion counter). | ||
| 7749 | LD ($77AE),A | |||
| 774C | RET | Return. | ||
|
Bomb explosion animation is in progress.
|
||||
| Bomb_Explosion | 774D | DEC A | Decrement the explosion counter. | |
| 774E | LD ($77AE),A | Write the updated counter to *Bomb_Explosion_Counter. | ||
| 7751 | OR A | Jump to Bomb_Explosion_Done if the counter has reached zero (explosion finished). | ||
| 7752 | JR Z,Bomb_Explosion_Done | |||
| 7754 | RRA | Divide by two and add 36 to select the explosion animation frame. | ||
| 7755 | ADD A,$36 | |||
| 7757 | LD ($DAC3),A | Write the frame to *Percy_Frame_ID (Percy's sprite frame, showing the explosion on Percy). | ||
| 775A | LD A,R | Use the Memory Refresh Register masked with 07 as a random flicker value. | ||
| 775C | AND %00000111 | |||
| 775E | LD ($DAC2),A | Write to *Percy_Colour (Percy's sprite active flag, for flicker effect). | ||
| 7761 | JP PlayHitSound | Jump to PlayHitSound. | ||
|
Explosion complete; register the hit on Percy.
|
||||
| Bomb_Explosion_Done | 7764 | LD A,$FF | Write FF to *FallingState (set collision flag to damage Percy). | |
| 7766 | LD ($5FA7),A | |||
| 7769 | RET | Return. | ||
|
Bomb hit the ground without hitting Percy; deactivate the bomb.
|
||||
| Bomb_Hit_Ground | 776A | LD (IY+$03),$00 | Write 00 to *IY+03 (deactivate the bomb). | |
| 776E | RET | Return. | ||
|
No bomb active; check if the plane should drop one.
|
||||
| Check_Bomb_Drop | 776F | LD A,R | Use the Memory Refresh Register masked for a random check. | |
| 7771 | AND %00000001 | |||
| 7773 | RET NZ | Return if the random bit is not set (don't drop this frame). | ||
| 7774 | LD A,($DAC1) | Check if Percy's Y position plus 0A is greater than or equal to the plane's Y position. | ||
| 7777 | ADD A,$0A | |||
| 7779 | CP (IX+$01) | |||
| 777C | RET C | Return if Percy is above the plane (carry set). | ||
| 777D | LD A,($DAC0) | Mask Percy's X position and store in B. | ||
| 7780 | AND %11111100 | |||
| 7782 | LD B,A | |||
| 7783 | LD A,(IX+$00) | Mask the plane's X position with FC and compare with B. | ||
| 7786 | AND %11111100 | |||
| 7788 | CP B | Return if the X positions don't match (plane not above Percy). | ||
| 7789 | RET NZ | |||
| 778A | BIT 7,(IY+$02) | Return if bit 7 of *IY+02 is not set (plane not active). | ||
| 778E | RET Z | |||
| 778F | BIT 7,(IY+$00) | Return if bit 7 of *IY+00 is set (plane is stunned). | ||
| 7793 | RET NZ | |||
|
Drop the bomb: set the bomb sprite position and activate it.
|
||||
| 7794 | LD A,(IX+$01) | Set the bomb Y position to the plane's Y plus 0A. | ||
| 7797 | ADD A,$0A | |||
| 7799 | LD ($DAF1),A | Write to *Sprite03_2Wide_Y_Position (bomb Y position). | ||
| 779C | LD A,(IX+$00) | Copy the plane's X position to *Sprite03_2Wide_X_Position (bomb X position). | ||
| 779F | LD ($DAF0),A | |||
| 77A2 | LD A,$FF | Write FF to *Sprite03_2Wide_Colour (bomb sprite active flag). | ||
| 77A4 | LD ($DAF2),A | |||
| 77A7 | SET 7,(IY+$03) | Set bit 7 of *IY+03 (mark bomb as active). | ||
| 77AB | JP PlayHitSound | Jump to PlayHitSound. | ||
| Prev: 768C | Up: Map | Next: 77AE |