Sonic_Peelout:
cmpi.b #2,$39(a0) ; are we charging a peelout?
beq.w Sonic_Peelouting ; if so,go to the peelout charge code
cmpi.b #7,$1C(a0) ; are we using animation 7 (looking up)?
bne.w Sonic_NoPeelout ; if not,don't do anything
move.b ($FFFFF603).w,d0 ; check currently held buttons
andi.b #$70,d0 ; are A,B or C pressed?
beq.w Sonic_NoPeelout ; if not,don't do anything
move.b #$0B,$1C(a0) ; start using animation 0C (run)
move.w #$D0,d0
jsr (sub_135E).l ; play sound D0 (spindash sound)
move.b #2,$39(a0) ; set peelout charge flag
addq.l #4,sp
Sonic_NoPeelout:
rts
Sonic_Peelouting:
move.b ($FFFFF602).w,d0
btst #0,d0 ; has up been released yet?
bra.s Sonic_EndPeelout
bne.w Sonic_EndPeelout ; if not,go to charging code
move.w #$BC,d0
jsr (sub_135E).l ; play sound BC
move.b #7,$17(a0) ; set width/2 to $7
move.b #$0C,$1C(a0) ; use animation 1 (running)
addq.w #5,$C(a0) ; add 5 to upper byte of playfield Y coordinate (?)
move.b #0,$39(a0) ; unset peeloout charge flag
move.w #$ccc,$14(a0) ; set Sonic's speed to $ccc
btst #0,$22(a0) ; which way are we facing?
beq.w Sonic_NoPeelout ; if we're facing left,don't do anything
neg.w $14(a0) ; set speed in other direction if we're facing right
Sonic_EndPeelout:
move.w #$60,($FFFFF73E).w; reset looking up/down
addq.l #4,sp ; Don't process any more movements in this frame.
rts
; End of function Sonic_Peelout