Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sonic_Homing:
- ; Registers
- ; a1 - Object pointer
- ; d1 - Iteration count
- ; Setup registers
- lea (v_objspace).w,a1 ; Point to the first object (Sonic)
- lea $40(a1),a1 ; Skip to next object since we don't want to count Sonic in.
- moveq #$7E,d1 ; Set max. number of iterations to 0x7E
- moveq #0,d0 ; Set object number to 0
- Sonic_Homing_Loop:
- ; Read object index
- move.b (a1),d0 ; Load the object number from RAM.
- beq.s Sonic_Homing_Loop_Next ; If it's 0, skip to next object.
- ; Check if the object is an enemy
- move.b obColType(a1),d0
- andi.b #$C0,d0
- bne.s Sonic_Homing_Loop_Next ; If not, it's not an enemy, skip.
- ; Calculate distance to object.
- move.b #0,(a1) ; Destroy object?
- Sonic_Homing_Loop_Next:
- lea $40(a1),a1 ; Skip to next object. Decrement loop iteration
- dbf d1,Sonic_Homing_Loop ; and continue.
- rts ; Done!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement