Thanks to everyone that replied to this thread and helped me with my issue. Using everyone's advice I was able to fix the issue I was having and I learned some new things. What is trying to be accomplished is I am trying to make it so sonic can roll in the air after falling down to the ground from a ledge when you press a, b, or c. Sonic Does not do anything when a b or c is pressed. I don't even know that much asm and created this based on how other moves were made in sonic 1. Here is the code: Code: ; ||||||||||||||| S U B R O U T I N E ||||||||||||||||||||||||||||||||||||||| Sonic_AirRoll: btst #1,$22(a0) ; is Sonic in the air? bne.s @SpinCheck ; if yes, branch rts ; Game Over. In The Continue? @SpinCheck: cmpi.b #2,$1C(a0) ; is Sonic rolling/jumping? bne.s @nope ; if yes, branch tpress A+B+C,(SonicControl) ; A, B or C pressed? bne.s @Aroll ; if yes, branch rts ; simulation is down reboot matrix @Aroll: move.b #2,$1C(a0) ; use "rolling" animation rts ; Try again for a quarter @nope: rts ; insert witty reboot comment here ; End of function Sonic_AirRoll
You can INVERT your branches pointing to @nope so you avoid repeating the RTS, you can also set the same animation ID again so latter check is not necessary (the game will not go back to 0 unless you change this ID), and so far your issue (only assuming that code does not "work" (because there is no extra specified info) seem to be related to where you call Sonic_AirRoll instead.
And what is the problem, exactly? Have you put a "bsr.w Sonic_AirRoll" in the routine "Obj01_MdJump2" ? I also noticed that there isn't a flag or a check for this.
Isn't there a bitflag in the 'status' ($22) SST byte that indicates the player's rolling? That should be set along with Sonic's animation. Edit: According to the SCHG, it's bit 2.
Code: ; ||||||||||||||| S U B R O U T I N E ||||||||||||||||||||||||||||||||||||||| Sonic_AirRoll: btst #1,$22(a0) ; is Sonic in the air? beq.s @nope ; if not, branch move.b ($FFFFF602).w,d0 andi.b #$70,d0 ; is button A, B or C pressed? beq.s @nope ; if not, branch move.b #2,$1C(a0) ; use "rolling" animation bset #2,$22(a0) ; force Sonic to roll @nope: rts ; End of function Sonic_AirRoll Here's some slightly better code. Can you describe exactly what's going on, @ZiroGX2? Your post is a bit vague as to what's wrong.
Code: Obj01_DoRoll: bset #2,$22(a0) ; set on air flag move.b #$E,$16(a0) ; set width of Sonic move.b #7,$17(a0) ; set height of Sonic move.b #2,$1C(a0) ; use "rolling" animation addq.w #5,$C(a0) ; move Sonic downwards (since he now has smaller hitbox) move.w #$BE,d0 jsr (PlaySound_Special).l ; play rolling sound tst.w $14(a0) ; the last bit here forces Sonic to move forwards in rolling chunks bne.s locret_133E8 move.w #$200,$14(a0) locret_133E8: rts The code you posted is really incomplete. It will not result in "actual" rolling. The thing I posted is just simply what Sonic 1 does when it enables rolling on ground. Use it wisely.
Oh, also, don't put the 'bsr' for Sonic_AirRoll in Obj01_MdJump2/Sonic_MdJump2. That subroutine's for when Sonic is in the air AND rolling. You'll want Obj01_MdJump/Sonic_MdJump, which is for when Sonic's in the air, and NOT rolling.