![]() |
Routines |
| Prev: 54640 | Up: Map | Next: 54816 |
|
Used by the routines at Process_Enemy_Entity, Handle_Homing_Enemy, Kill_Wall_Bouncing_Enemy and Process_Final_Phase_Enemy_Entity.
Removes the entity whose record is pointed to by Entity_Record_Pointer from the entity list. Steps back to the start of the entity's 12-byte record, then block-copies all subsequent records down by 12 bytes via LDIR, closing the gap. The entity list end pointer at Playfield_Entity_List_Pointer is decremented by 12 to reflect the shorter list. Returns with HL pointing to the record that now occupies the removed entity's slot.
|
||||
| Remove_Entity_From_List | 54705 | LD HL,(50394) | Load the entity record pointer from Entity_Record_Pointer. | |
|
This entry point is used by the routines at Kill_Tracked_Enemy_Entity and Process_Cluster_Entity.
|
||||
| Remove_Entity_From_List_Step | 54708 | DEC HL | Step back to the start of the entity record and save the updated pointer to Entity_Record_Pointer. | |
| 54709 | DEC HL | |||
| 54710 | LD (50394),HL | |||
| 54713 | LD DE,12 | Compute the start of the next entity record (12 bytes ahead) in DE. | ||
| 54716 | ADD HL,DE | |||
| 54717 | EX DE,HL | |||
| 54718 | LD HL,(50385) | Load the entity list end pointer from Playfield_Entity_List_Pointer, subtract the destination address to get the copy byte count, and load that count into BC. | ||
| 54721 | SBC HL,DE | |||
| 54723 | INC HL | |||
| 54724 | INC HL | |||
| 54725 | INC HL | |||
| 54726 | LD B,H | |||
| 54727 | LD C,L | |||
| 54728 | LD HL,(50394) | Set source to the start of the next entity record and shift all remaining records down by 12 bytes via LDIR. | ||
| 54731 | EX DE,HL | |||
| 54732 | LDIR | |||
| 54734 | LD HL,(50385) | Decrement the entity list end pointer at Playfield_Entity_List_Pointer by 12 bytes and return with HL pointing to the new occupant of the vacated slot. | ||
| 54737 | LD DE,12 | |||
| 54740 | SBC HL,DE | |||
| 54742 | LD (50385),HL | |||
| 54745 | LD HL,(50394) | |||
| 54748 | RET | Return. | ||
|
Entity movement handler, stored as the entity handler address in entity records that use the narrow sprite renderer. Applies the entity's velocity to its current screen position, validates that the new position lies within the playfield bounds, updates the entity record, and redraws the sprite. If the new position is out of bounds the entity is removed via Remove_Entity_From_List.
|
||||
| Move_And_Redraw_Entity | 54749 | LD (50394),HL | Save the entity record pointer to Entity_Record_Pointer. | |
| 54752 | CALL Erase_Narrow_Entity_Sprite | Erase the entity's current sprite via Erase_Narrow_Entity_Sprite. | ||
| 54755 | LD HL,(50394) | Reload the entity record from Entity_Record_Pointer and point HL at the Y position field; copy the pointer to DE. | ||
| 54758 | INC HL | |||
| 54759 | INC HL | |||
| 54760 | INC HL | |||
| 54761 | LD D,H | |||
| 54762 | LD E,L | |||
| 54763 | INC DE | Advance DE to the Y velocity field and add the velocity to the current Y position. | ||
| 54764 | INC DE | |||
| 54765 | INC DE | |||
| 54766 | INC DE | |||
| 54767 | LD A,(DE) | |||
| 54768 | ADD A,(HL) | |||
| 54769 | CP 16 | |||
| 54771 | JR C,Remove_Entity_From_List | Reject the move if the new Y position is above the playfield top edge (16). | ||
| 54773 | CP 184 | |||
| 54775 | JR NC,Remove_Entity_From_List | Reject the move if the new Y position is below the playfield bottom edge (184). | ||
| 54777 | LD (HL),A | Store the new Y position; advance to the X fields and add the X velocity to the current X position. | ||
| 54778 | LD B,A | |||
| 54779 | INC DE | |||
| 54780 | INC HL | |||
| 54781 | LD A,(DE) | |||
| 54782 | ADD A,(HL) | |||
| 54783 | CP 8 | Reject the move if the new X position is past the left edge (8). | ||
| 54785 | JR C,Remove_Entity_From_List | Remove the entity if the new X position is too close to the left wall. | ||
| 54787 | CP 248 | Reject the move if the new X position is past the right edge (248). | ||
| 54789 | JR NC,Remove_Entity_From_List | Remove the entity if the new X position is too close to the right wall. | ||
| 54791 | LD (HL),A | Store the new X position; step back and update the two additional entity record fields from their corresponding velocity bytes. | ||
| 54792 | DEC HL | |||
| 54793 | DEC HL | |||
| 54794 | LD A,(DE) | |||
| 54795 | ADD A,(HL) | |||
| 54796 | LD (HL),A | |||
| 54797 | DEC HL | |||
| 54798 | DEC DE | |||
| 54799 | LD A,(DE) | |||
| 54800 | ADD A,(HL) | Update the final position field and step back to the entity record origin. | ||
| 54801 | LD (HL),A | |||
| 54802 | DEC HL | |||
| 54803 | EXX | Set the entity colour to INK: WHITE, PAPER: BLACK (BRIGHT) in B' and redraw the sprite via Draw_Narrow_Entity_Sprite. | ||
| 54804 | LD B,71 | |||
| 54806 | EXX | |||
| 54807 | CALL Draw_Narrow_Entity_Sprite | |||
| 54810 | LD HL,(50394) | Reload the entity record pointer from Entity_Record_Pointer. | ||
| 54813 | JP Advance_Entity_Pointer | Jump to the entity update completion handler at Advance_Entity_Pointer. | ||
| Prev: 54640 | Up: Map | Next: 54816 |