I need an ASM of the directional coin block, because I want to change the spawned coins to blocks, like in C|C - Gnarly without using the P-Switch. Is it possible?
Code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;? Block: Original Block/Code by SWR & Jagfillit, ;additional Sprite interaction code by Milk & SL and uses additional code by Kaijyuu. ;This block will spawn a custom sprite when hit by Mario as well as by kicked/thrown sprites. ;Set it to act like tile 129 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; !Item = #$80 ;Sprite number (Only use Custom Sprite's) JMP MarioBelow : JMP MarioAbove : JMP MarioSide : JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireBall MarioCape: MarioBelow: JSR SetSpriteCoord1 LDA !Item JSR SpawnSprite RTL SpriteV: JSR CheckKickedV BCS ContentsBySprite RTL SpriteH: JSR CheckKickedH BCS ContentsBySprite MarioFireBall: MarioAbove: MarioSide: RTL ContentsBySprite: LDA !Item JSR SpriteSpawnedSprite RTL ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;Mario Spawn Routine ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SpawnSprite: PHX PHP SEP #$30 PHA LDX #$0B SpwnSprtTryAgain: LDA $14C8,x ;Sprite Status Table BEQ SpwnSprtSet DEX CPX #$FF BEQ SpwnSprtClear BRA SpwnSprtTryAgain SpwnSprtClear: DEC $1861 BPL SpwnSprtExist LDA #$01 STA $1861 SpwnSprtExist: LDA $1861 CLC ADC #$0A TAX SpwnSprtSet: LDA #$08 STA $14C8,x ;Sprite Status Table PLA STA $7FAB9E,x JSL $07F7D2 ; reset sprite properties JSL $0187A7 ; get table values for custom sprite LDA #$88 ; mark as initialized STA $7FAB10,x INC $15A0,x ;"Sprite off screen" flag, horizontal Continue: LDA $9A ;Sprite creation: X position (low) STA $E4,x ;Sprite Xpos Low Byte LDA $9B STA $14E0,x ;Sprite Xpos High Byte LDA $98 ;Sprite creation: Y position (low) DEC #$10 STA $D8,x ;Sprite Ypos Low Byte LDA $99 ;Sprite creation: Y position (high) STA $14D4,x ;Sprite Ypos High Byte LDA #$3E STA $1540,x ;Sprite Spin Jump Death Frame Counter LDA #$02 ;Item Appear SFX STA $1DFC LDA #$D0 STA $AA,x ;Sprite Y Speed LDA #$2C STA $144C,x LDA $190F,x ;Sprite Properties BPL SpwnSprtProp LDA #$10 STA $15AC,x SpwnSprtProp: PLP PLX RTS SetSpriteCoord1: PHP REP #$20 LDA $98 AND #$FFF0 STA $98 LDA $9A AND #$FFF0 STA $9A PLP RTS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;Sprite Spawn Routine ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SpriteSpawnedSprite: PHX PHP SEP #$30 PHA LDX #$0B TryAgain: LDA $14C8,x ;Sprite Status Table BEQ Set DEX BPL TryAgain Exist: LDA $1861 CLC ADC #$0A TAX Set: LDA #$08 STA $14C8,x ;Sprite Status Table PLA STA $7FAB9E,x JSL $07F7D2 ; reset sprite properties JSL $0187A7 ; get table values for custom sprite LDA #$88 ; mark as initialized STA $7FAB10,x INC $15A0,x ;"Sprite off screen" flag, horizontal LDA $0A ; $0A-D hold the x/y of sprite contact AND #$F0 ; have to clear the low nybble much like $98-9B STA $9A LDA $0B STA $9B LDA $0C AND #$F0 STA $98 LDA $0D STA $99 BRL Continue ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;Sprite Checks ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; This subroutine checks to see if a sprite was thrown at the block vertically. ; If the carry flag is set, the sprite was thrown with enough force. CheckKickedV: LDA $AA,x BPL EndKickCheck1 LDA $14C8,x CMP #$09 BCC EndKickCheck1 SEC RTS EndKickCheck1: CLC RTS ; This subroutine checks to see if a sprite was thrown at the block horizontally. ; If the carry flag is set, the sprite was thrown with enough force. CheckKickedH: LDA $14C8,x CMP #$09 BEQ SpriteKickHCont CMP #$0A BEQ SpriteKickH1 CLC RTS SpriteKickHCont: LDA $B6,x BMI SpriteKickH0 CMP #$08 BCS SpriteKickH1 SpriteKickHReturn: CLC RTS SpriteKickH0: CMP #$F8 BCS SpriteKickHReturn SpriteKickH1: SEC RTS
The sprite is spawning 1 tile higher. How do I solve this?