; =========================================================================== ; --------------------------------------------------------------------------- ; Object 4F - Cannon ; --------------------------------------------------------------------------- Obj4F: moveq #$00,d0 ; clear d0 move.b $24(a0),d0 ; load routine counter move.w Obj4F_Index(pc,d0.w),d0 ; load correct relative address jmp Obj4F_Index(pc,d0.w) ; jump to address Obj4F_Index: dc.w Obj4F_Setup-Obj4F_Index ; 00 - Setup routine dc.w Obj4F_Idle-Obj4F_Index ; 02 - Idle and waiting for Sonic ; =========================================================================== ; --------------------------------------------------------------------------- ; Object 4F - 00 - Setup routine ; --------------------------------------------------------------------------- Obj4F_Setup: addq.b #$02,$24(a0) ; advance to next routine (for next frame) ori.l #$00140000|($F4C0/$20),(a0) ; set display mode and pattern index address move.l #Map_Obj4F,$04(a0) ; set mappings list address move.b #$20,$16(a0) ; set draw height (only if bit 4 is set in object byte $01) move.w #$0120,$18(a0) ; set priority and draw width move.w $08(a0),$3C(a0) ; store X and Y spawn positions move.w $0C(a0),$3E(a0) ; '' ; --------------------------------------------------------------------------- ; Object 4F - 02 - Idle ; --------------------------------------------------------------------------- Obj4F_Idle: moveq #$FFFFFF80,d2 ; prepare subtraction/and value move.w $3C(a0),d0 ; load object's original X spawn position and.w d2,d0 ; wrap to nearest object load block move.w ($FFFFF700).w,d1 ; load screen's X position add.w d2,d1 ; move left a load block (include block to left of screen) and.w d2,d1 ; wrap to nearest object load block sub.w d1,d0 ; subtract from object's X spawn position cmpi.w #$0300-$80,d0 ; is the object still within the load area? (-$80 to +$2FF relative to screen) bhi.w DeleteObject ; if not, branch to delete the object (it's gone out of range) bra.w DisplaySprite ; save object to priority list for display ; =========================================================================== ; --------------------------------------------------------------------------- ; Object 4F - Mappings ; --------------------------------------------------------------------------- Map_Obj4F: dc.w Map4F_Frame00-Map_Obj4F Map4F_Frame00: dc.b $08 ; Number of sprite peices dc.b $E0,$01,$00,$00,$E0 ; Top left blue sphere (left side) dc.b $E0,$01,$08,$00,$E8 ; '' (right side) dc.b $E0,$01,$00,$02,$10 ; Top right red sphere (left side) dc.b $E0,$01,$08,$02,$18 ; '' (right side) dc.b $10,$01,$00,$02,$E0 ; Bottom left red sphere (left side) dc.b $10,$01,$08,$02,$E8 ; '' (right side) dc.b $10,$01,$00,$00,$10 ; Bottom right blue sphere (left side) dc.b $10,$01,$08,$00,$18 ; '' (right side) even ; ===========================================================================