don't click here

Some changes and fixes for Sonic 2

Discussion in 'Engineering & Reverse Engineering' started by Esrael, Jun 7, 2012.

  1. RetroKoH

    RetroKoH

    Member
    1,662
    22
    18
    Project Sonic 8x16
    Fix that, and we can add that little tidbit to the wiki page. I'll be waiting for the update. :)

    BTW Esrael... I thought you were awesome before, that is just even more amazing. Thats going into my Sonic 2 hack.
     
  2. dsrb

    dsrb

    Member
    3,149
    0
    16
    Posting in epic thread

    Great find, Esrael: it does seem like that behaviour was lost somewhere in development, and with McAleeCh's fix of the alignment it'll be perfect. :)

    So many of these things just cry out for a fully fixed-up Sonic 2 ROM, basically a sequel to Mercury's ReadySonic.
     
  3. RetroKoH

    RetroKoH

    Member
    1,662
    22
    18
    Project Sonic 8x16
    I'm sure someone will pump one out well before me (that will also be much better)... but I've been trying to learn from Mercury, and the SCHG in putting together fixed up, enhanced ROMS for Sonic's 1 AND 2... code-named Rev C. Nothing special, but I am a little bit new to hacking and would like to share a finished ROM with others when I'm done.

    ReadySonic has been a big help in putting a lot of the stuff in (and correcting some of the stuff I have done before) But with the new stuff from RHS, and other things that weren't included (such as an extra life for every 50,000 pts) I'm hoping to put up what could be considered an update to ReadySonic.
     
  4. E-122-Psi

    E-122-Psi

    Member
    2,470
    612
    93
    Hah, you actually set up the whole animation, shame they didn't implement that little easter egg originally.

    I'm not sure if you take requests, but I've thought of one change that could count as a valid fix; is it possible to enable debug for Tails?
     
  5. redhotsonic

    redhotsonic

    Also known as RHS Tech Member
    1,587
    10
    18
    United Kingdom
    YouTuber



    Am I the only one finding this new code not working? I thought on the last hit, the gunge was meant to fall on him, then he runs away, not still blow up. And sometimes, he drops it on himself then carries on attacking.

    I tried Delta, and it does the same thing. =/
     
  6. Jayextee

    Jayextee

    Unpopular Opinions™ Member
    3,253
    60
    28
    Atro City
    I DONE MAKED GAMES.
    Has anybody yet fixed Tails' tails when looking up? They animate faster for one 'cycle' before returning to the normal speed.
     
  7. redhotsonic

    redhotsonic

    Also known as RHS Tech Member
    1,587
    10
    18
    United Kingdom
    YouTuber
    I might as well take on requests, as long as it's for Sonic 2, and you don't mind me using XenoWhirl's 2007 disassembly =P



    To enable debug when using Tails



    Go to "Obj02:" and change this:

    Code (ASM):
    1. Obj02:
    2.     ; a0=character
    3.     cmpi.w  #2,(Player_mode).w
    4.     bne.s   +
    5.     move.w  (Camera_Min_X_pos).w,(Tails_Min_X_pos).w
    6.     move.w  (Camera_Max_X_pos).w,(Tails_Max_X_pos).w
    7.     move.w  (Camera_Max_Y_pos_now).w,(Tails_Max_Y_pos).w
    8. +

    to this:

    Code (ASM):
    1. Obj02:
    2.     ; a0=character
    3.     cmpi.w  #2,(Player_mode).w
    4.     bne.s   +
    5.     move.w  (Camera_Min_X_pos).w,(Tails_Min_X_pos).w
    6.     move.w  (Camera_Max_X_pos).w,(Tails_Max_X_pos).w
    7.     move.w  (Camera_Max_Y_pos_now).w,(Tails_Max_Y_pos).w
    8.     tst.w   (Debug_placement_mode).w    ; is debug mode being used?
    9.     beq.s   +               ; if not, branch
    10.     jmp DebugMode
    11. +
    So, whenever debug mode is active, it will go to DebugMode



    Next, go to "Obj02_Control:" and change this:

    Code (ASM):
    1. Obj02_Control:
    2.     cmpa.w  #MainCharacter,a0
    3.     bne.s   Obj02_Control_Joypad2
    4.     move.w  (Ctrl_1_Logical).w,(Ctrl_2_Logical).w
    5.     tst.b   (Control_Locked).w  ; are controls locked?
    6.     bne.s   Obj02_Control_Part2 ; if yes, branch
    7.     move.w  (Ctrl_1).w,(Ctrl_2_Logical).w   ; copy new held buttons, to enable joypad control
    8.     move.w  (Ctrl_1).w,(Ctrl_1_Logical).w
    9.     bra.s   Obj02_Control_Part2

    to this:

    Code (ASM):
    1. Obj02_Control:
    2.     cmpa.w  #MainCharacter,a0   ; Is Tails the main character?
    3.     bne.s   Obj02_Control_Joypad2   ; No?  Branch then
    4.     move.w  (Ctrl_1_Logical).w,(Ctrl_2_Logical).w
    5.     tst.w   (Debug_mode_flag).w ; is debug cheat enabled?
    6.     beq.s   +           ; if not, branch
    7.     btst    #4,(Ctrl_1_Press).w ; is button B pressed?
    8.     beq.s   +           ; if not, branch
    9.     move.w  #1,(Debug_placement_mode).w ; change Tails into a ring/item
    10.     clr.b   (Control_Locked).w      ; unlock control
    11.     rts
    12. +
    13.     tst.b   (Control_Locked).w  ; are controls locked?
    14.     bne.s   Obj02_Control_Part2 ; if yes, branch
    15.     move.w  (Ctrl_1).w,(Ctrl_2_Logical).w   ; copy new held buttons, to enable joypad control
    16.     move.w  (Ctrl_1).w,(Ctrl_1_Logical).w
    17.     bra.s   Obj02_Control_Part2
    So when you have main control of Tails, you can enter debug by pressing B.



    Next, go to "Obj02_Hurt:" and change this:

    Code (ASM):
    1. Obj02_Hurt:
    2.     jsr ObjectMove
    3.     addi.w  #$30,y_vel(a0)
    4.     btst    #6,status(a0)
    5.     beq.s   +
    6.     subi.w  #$20,y_vel(a0)

    to this:

    Code (ASM):
    1. Obj02_Hurt:
    2.     cmpa.w  #MainCharacter,a0   ; Is Tails the main character?
    3.     bne.s   Obj02_Hurt_Normal   ; No?  Branch then
    4.     tst.w   (Debug_mode_flag).w
    5.     beq.s   Obj02_Hurt_Normal
    6.     btst    #4,(Ctrl_1_Press).w
    7.     beq.s   Obj02_Hurt_Normal
    8.     move.w  #1,(Debug_placement_mode).w
    9.     clr.b   (Control_Locked).w
    10.     rts
    11.  
    12. Obj02_Hurt_Normal:
    13.     jsr ObjectMove
    14.     addi.w  #$30,y_vel(a0)
    15.     btst    #6,status(a0)
    16.     beq.s   +
    17.     subi.w  #$20,y_vel(a0)
    So when Tails is hurt, you can enter debug by pressing B.



    Next, go to "Obj02_Dead:" and change this:

    Code (ASM):
    1. Obj02_Dead:
    2.     bsr.w   Obj02_CheckGameOver
    3.     jsr ObjectMoveAndFall
    4.     bsr.w   Tails_RecordPos
    5.     bsr.w   Tails_Animate
    6.     bsr.w   LoadTailsDynPLC
    7.     jmp DisplaySprite

    to this:

    Code (ASM):
    1. Obj02_Dead:
    2.     cmpa.w  #MainCharacter,a0   ; Is Tails the main character?
    3.     bne.s   +           ; No?  Branch then
    4.     tst.w   (Debug_mode_flag).w
    5.     beq.s   +
    6.     btst    #4,(Ctrl_1_Press).w
    7.     beq.s   +
    8.     move.w  #1,(Debug_placement_mode).w
    9.     clr.b   (Control_Locked).w
    10.     rts
    11. +
    12.     bsr.w   Obj02_CheckGameOver
    13.     jsr ObjectMoveAndFall
    14.     bsr.w   Tails_RecordPos
    15.     bsr.w   Tails_Animate
    16.     bsr.w   LoadTailsDynPLC
    17.     jmp DisplaySprite
    So when Tails is dead (dying), you can enter debug by pressing B.



    Next, go to "loc_41C56:" (part of the debugmode code) and change this:

    Code (ASM):
    1. loc_41C56:
    2.     btst    #4,(Ctrl_1_Press).w
    3.     beq.s   return_41CB6
    4.     moveq   #0,d0
    5.     move.w  d0,(Debug_placement_mode).w
    6.     lea (MainCharacter).w,a1 ; a1=character
    7.     move.l  #Mapunc_Sonic,mappings(a1)
    8.     move.w  #$780,art_tile(a1)
    9.     tst.w   (Two_player_mode).w
    10.     beq.s   loc_41C82
    11.     move.w  #$3C0,art_tile(a1)

    to this:

    Code (ASM):
    1. loc_41C56:
    2.     btst    #4,(Ctrl_1_Press).w
    3.     beq.s   return_41CB6
    4.     moveq   #0,d0
    5.     move.w  d0,(Debug_placement_mode).w
    6.     lea (MainCharacter).w,a1 ; a1=character
    7.     move.l  #Mapunc_Sonic,mappings(a1)
    8.     move.w  #$780,art_tile(a1)
    9.     cmpi.b  #2,(Maincharacter).w    ; are you Tails?
    10.     bne.s   +           ; if not, branch
    11.     move.l  #MapUnc_Tails,mappings(a1)
    12.     move.w  #$7A0,art_tile(a1)
    13. +
    14.     tst.w   (Two_player_mode).w
    15.     beq.s   loc_41C82
    16.     move.w  #$3C0,art_tile(a1)
    So when you exit debug mode, the correct mappings will load.



    Next, go to "loc_41C82:" and change this:

    Code (ASM):
    1. loc_41C82:
    2.     bsr.s   sub_41CB8
    3.     move.b  #$13,y_radius(a1)
    4.     move.b  #9,x_radius(a1)
    5.     move.w  ($FFFFFFCC).w,(Camera_Min_Y_pos).w
    6.     move.w  ($FFFFFFCE).w,(Camera_Max_Y_pos).w
    7.     cmpi.b  #$10,(Game_Mode).w  ; special stage mode?
    8.     bne.s   return_41CB6        ; if not, branch
    9.     move.b  #2,(MainCharacter+anim).w
    10.     bset    #2,(MainCharacter+status).w
    11.     bset    #1,(MainCharacter+status).w

    to this:

    Code (ASM):
    1. loc_41C82:
    2.     bsr.s   sub_41CB8
    3.     move.b  #$13,y_radius(a1)
    4.     move.b  #9,x_radius(a1)
    5.     cmpi.b  #2,(Maincharacter).w    ; are you Tails?
    6.     bne.s   +           ; if not, branch
    7.     move.b  #$F,y_radius(a1)   
    8. +
    9.     move.w  ($FFFFFFCC).w,(Camera_Min_Y_pos).w
    10.     move.w  ($FFFFFFCE).w,(Camera_Max_Y_pos).w
    11.     cmpi.b  #$10,(Game_Mode).w  ; special stage mode?
    12.     bne.s   return_41CB6        ; if not, branch
    13.     move.b  #2,(MainCharacter+anim).w
    14.     bset    #2,(MainCharacter+status).w
    15.     bset    #1,(MainCharacter+status).w
    16.  
    17. return_41CB6:
    18.     rts
    So when you exit debug mode, the correct height of the character will load.



    All done.





    EDIT:


    It's meant to be him "flicking" his tails. But if you do not like that, you can fix it like this:

    Code (ASM):
    1. Obj05AniSelection:
    2.     dc.b    0,0 ; TailsAni_Walk,Run ->
    3.     dc.b    3   ; TailsAni_Roll     -> Directional
    4.     dc.b    3   ; TailsAni_Roll2    -> Directional
    5.     dc.b    9   ; TailsAni_Push     -> Pushing
    6.     dc.b    1   ; TailsAni_Wait     -> Swish
    7.     dc.b    0   ; TailsAni_Balance  -> Blank
    8.     dc.b    2   ; TailsAni_LookUp   -> Flick
    9.     dc.b    1   ; TailsAni_Duck     -> Swish
    10.     dc.b    7   ; TailsAni_Spindash -> Spindash
    11.     dc.b    0,0,0   ; TailsAni_Dummy1,2,3   ->
    12.     dc.b    8   ; TailsAni_Stop     -> Skidding
    13.     dc.b    0,0 ; TailsAni_Float,2  ->
    14.     dc.b    0   ; TailsAni_Spring   ->
    15.     dc.b    0   ; TailsAni_Hang     ->
    16.     dc.b    0,0 ; TailsAni_Blink,2  ->
    17.     dc.b    $A  ; TailsAni_Hang2    -> Hanging
    18.     dc.b    0   ; TailsAni_Bubble   ->
    19.     dc.b    0,0,0,0 ; TailsAni_Death,2,3,4  ->
    20.     dc.b    0,0 ; TailsAni_Hurt,Slide   ->
    21.     dc.b    0   ; TailsAni_Blank    ->
    22.     dc.b    0,0 ; TailsAni_Dummy4,5 ->
    23.     dc.b    0   ; TailsAni_HaulAss  ->
    24.     dc.b    0   ; TailsAni_Fly      ->
    25.     even

    Code (ASM):
    1.     dc.b    2   ; TailsAni_LookUp   -> Flick
    See that? Change the 2 to a 1 and it will be fine.
     
  8. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,735
    334
    63
    SonLVL
    Under "Next, go to "loc_41C56:" (part of the debugmode code) and change this:" you typed "cmpi.b #3,(Maincharacter).w ; are you Tails?" instead of "cmpi.b #2,(Maincharacter).w ; are you Tails?".
     
  9. redhotsonic

    redhotsonic

    Also known as RHS Tech Member
    1,587
    10
    18
    United Kingdom
    YouTuber

    Small typo =P

    Thanks for pointing that out. Changed it in the post.
     
  10. That One Jig

    That One Jig

    aka RichterSnipes Member
    67
    2
    8
    Somewhere in America
    (Not) Working on My PokéHack
    While on the subject of Tails bugs, I've noticed one that I don't think I've seen mentioned before. When Tails is standing next to a solid object, his tails use their pushing animation as opposed to his standard tail animation (the improper animation is in pic 1). Also, during the few frames before Tails enters his actual pushing animation, his tails look corrupted (pic 2).

    [​IMG][​IMG]

    This behavior was corrected in Sonic 3, so there's a good place to start.

    By the way, awesome work redhotsonic. You're really on top of these fixes!
     
  11. MoDule

    MoDule

    Tech Member
    327
    24
    18
    Procrastinating from writing bug-fix guides
    On the subject of the ARZ boss, I've got another that I don't think anyone's mentioned. It's hard to trigger accidentally, but if you defeat the boss while a character is standing on one of the two pillars at either side of the screen, that character will suffer from the walking on air glitch.

    The Fix:

    Locate the label loc_30B4A. The code should look like this:
    Code (ASM):
    1. loc_30B4A:
    2.     move.b  #1,(Screen_Shaking_Flag).w
    3.     addi.w  #1,y_pos(a0)
    4.     cmpi.w  #$510,y_pos(a0)
    5.     blt.s   BranchTo2_JmpTo37_DisplaySprite
    6.     move.b  #0,(Screen_Shaking_Flag).w
    7.     bra.w   JmpTo55_DeleteObject
    Now add the following lines so it looks like this:
    Code (ASM):
    1. loc_30B4A:
    2.     move.b  status(a0),d0
    3.     andi.b  #standing_mask|pushing_mask,d0  ; is someone touching the pillar?
    4.     beq.s   Pillar_Lower            ; if not, branch
    5.     move.b  d0,d1
    6.     andi.b  #p1_standing|p1_pushing,d1  ; is it the main character?
    7.     beq.s   +               ; if not, branch
    8.     andi.b  #$D7,(MainCharacter+status).w
    9.     ori.b   #2,(MainCharacter+status).w ; prevent Sonic from walking in the air
    10. +
    11.     andi.b  #p2_standing|p2_pushing,d0  ; is it the sidekick?
    12.     beq.s   Pillar_Lower            ; if not, branch
    13.     andi.b  #$D7,(Sidekick+status).w
    14.     ori.b   #2,(Sidekick+status).w      ; prevent Tails from walking in the air
    15.  
    16. Pillar_Lower:
    17.  
    18.     move.b  #1,(Screen_Shaking_Flag).w
    19.     addi.w  #1,y_pos(a0)
    20.     cmpi.w  #$510,y_pos(a0)
    21.     blt.s   BranchTo2_JmpTo37_DisplaySprite
    22.     move.b  #0,(Screen_Shaking_Flag).w
    23.     bra.w   JmpTo55_DeleteObject
    Everything up to the label Pillar_Lower is new and what it does is check if any character is interacting with the pillar and clears their interaction bits if necessary.

    A little more:

    Alternatively, if you want the pillars to stay solid even while the are being lowered into the ground, change the code to this:
    Code (ASM):
    1. loc_30B4A:
    2.     move.w  #$23,d1
    3.     move.w  #$44,d2
    4.     move.w  #$45,d3
    5.     move.w  x_pos(a0),d4
    6.     move.w  y_pos(a0),-(sp)
    7.     addi.w  #4,y_pos(a0)
    8.     bsr.w   JmpTo26_SolidObject
    9.     move.w  (sp)+,y_pos(a0)
    10.  
    11.     move.b  #1,(Screen_Shaking_Flag).w
    12.     addi.w  #1,y_pos(a0)
    13.     cmpi.w  #$510,y_pos(a0)
    14.     blt.s   BranchTo2_JmpTo37_DisplaySprite
    15.  
    16.     move.b  status(a0),d0
    17.     andi.b  #standing_mask|pushing_mask,d0  ; is someone touching the pillar?
    18.     beq.s   Pillar_Lower            ; if not, branch
    19.     move.b  d0,d1
    20.     andi.b  #p1_standing|p1_pushing,d1  ; is it the main character?
    21.     beq.s   +               ; if not, branch
    22.     andi.b  #$D7,(MainCharacter+status).w
    23.     ori.b   #2,(MainCharacter+status).w ; prevent Sonic from walking in the air
    24. +
    25.     andi.b  #p2_standing|p2_pushing,d0  ; is it the sidekick?
    26.     beq.s   Pillar_Lower            ; if not, branch
    27.     andi.b  #$D7,(Sidekick+status).w
    28.     ori.b   #2,(Sidekick+status).w      ; prevent Tails from walking in the air
    29.  
    30. Pillar_Lower:
    31.     move.b  #0,(Screen_Shaking_Flag).w
    32.     bra.w   JmpTo55_DeleteObject
    Explanation:

    For an object to have solidity, which for instance allows the player objects to stand on top of it, it has to call one of the SolidObject routines. These routines handle player positioning and flags in such a way so as to make the object appear solid. When a character stands on an object, its on-object status bit is set. When this bit is set, the character no longer follows the level's terrain, but instead walks in a straight line along the object's surface, ignoring gravity. Walking off the edge of an object will cause the SolidObject routine to clear the on-object flag and make the character subject to gravity again. Should an object stop calling SolidObject while a player is standing on it, that player's on-object bit won't be reset and this causes the walking on air glitch. In the case of the ARZ boss's pillars, SolidObject is called in every state except the "moving down" state which is triggered when the boss is defeated. This causes the pillars to eventually vanish without making sure the player's on-object bits are cleared.
     
  12. Esrael

    Esrael

    Neto Tech Member
    304
    257
    63
    Brazil, São Paulo, Guarulhos
    Neto Assembler Editor / Sonic 2 Delta / Neto MD-DOS

    Download Sonic 2 Delta with SaveStates

    This only work when Bottle are full filled with gunge and you hit the boss in correct time.
    To show it working I have made two savestates.
    Run this version with Gens and Load the Savestates.

    Edit: 28/05/2019 - Fixed broken links

    Best regards:
    ----------------------
    Neto.
     
  13. Esrael

    Esrael

    Neto Tech Member
    304
    257
    63
    Brazil, São Paulo, Guarulhos
    Neto Assembler Editor / Sonic 2 Delta / Neto MD-DOS

    Fixing the alignment is easy.
    Just edit mappings into following file:

    Obj5D_MapUnc_2EADC: BINCLUDE "mappings/sprite/obj5D_a.bin"

    The last 3 mappings in the file is animation:
    Change from
    Code (Text):
    1.  
    2.  
    3.                0001E00A004A0025FFF0
    4.                0001E80D00530029FFF0
    5.                0001E80D005B002DFFF0
    6.  
    To
    Code (Text):
    1.  
    2.  
    3.                0001E00A004A0025FFED
    4.                0001E80D00530029FFED
    5.                0001E80D005B002DFFED
    6.  
     
  14. redhotsonic

    redhotsonic

    Also known as RHS Tech Member
    1,587
    10
    18
    United Kingdom
    YouTuber


    The thing is, mate, I thought he was only to do this once. And only on the last hit, and instead of exploding. I thought that was the theory? If not, shut me up! =P



    Also, Module, nice fix. Never knew about that one. Probably because I'm hitting Eggman and Tails is too stupid to stand on the poles =P
     
  15. ICEknight

    ICEknight

    Researcher Researcher
    That animation looks cool, but I can see why they didn't use it. It won't turn around when Robotnik's ship does, leaving the goo-with-eyes occasionally floating away from Robotnik's head.

    They might not have considered fixing it a top priority, being in the rush they were.
     
  16. E-122-Psi

    E-122-Psi

    Member
    2,470
    612
    93
    Alternatively just load the mapping file along with the CPZ Boss art file on SonMapEd and nudge the last three sprites three pixels left.

    Or if you're feeling really lazy just replace the mapping file with this one:

    http://www.sendspace.com/file/4hiy86

    These are brilliant fixes by the way, don't forget to put them in the How To section in the wiki (maybe list the bugs in the game's Bug List page as well).
     
  17. ICEknight

    ICEknight

    Researcher Researcher
    I think the "oozed" Robotnik animation deserves its own wiki-ed guide, seeing how it can also be fixed after being restored...


    Speaking of, I'm surprised that it survived hidden up to the final version. Does it work and have the same mapping problems in the many prototypes with a working CPZ boss?
     
  18. RetroKoH

    RetroKoH

    Member
    1,662
    22
    18
    Project Sonic 8x16
    I'll get on it as soon as I can. I would've liked to earlier today, but something came up. (Technically I AM on business trip today)
    I'll try to get to it as soon as I can get back online.
     
  19. Esrael

    Esrael

    Neto Tech Member
    304
    257
    63
    Brazil, São Paulo, Guarulhos
    Neto Assembler Editor / Sonic 2 Delta / Neto MD-DOS
    To fix this
    find:
    Code (ASM):
    1.  
    2.  
    3. loc_2E790:
    4.  
    5.     subi.b  #1,anim_frame_duration(a0)
    6.     bpl.s   loc_2E7B6
    7.  
    and add the following code:

    Code (ASM):
    1.  
    2. loc_2E790:
    3.  
    4. ;-------------------------------------------------------------------------------                
    5.                 cmpi.b  #$25, mapping_frame(A0)
    6.                 blt.s   _CPz_2
    7.                 move.w  (MainCharacter+x_pos).w, D0
    8.                 sub.w   x_pos(A0), D0
    9.                 bgt.s   _CPz_1
    10.                 bclr    #$00, render_flags(A0)
    11.                 bra.s   _CPz_2
    12. _CPz_1:
    13.                 bset    #$00, render_flags(A0)                  
    14. _CPz_2:                
    15. ;-------------------------------------------------------------------------------  
    16.     subi.b  #1,anim_frame_duration(a0)
    17.     bpl.s   loc_2E7B6
    18.  
    19.  
     
  20. Mercury

    Mercury

    His Name Is Sonic Tech Member
    1,740
    21
    18
    Location Location
    AeStHete
    Hey, Sonic 2 fixes!

    One thing that's always bothered me a lot (and it isn't fixed in 3&K, either) is the camera jump when Tails rolls up.

    You see, because of the change in size of Sonic's collision box when he rolls up, the camera has an offset of 5 pixels to compensate. But Tails doesn't change in size as drastically, since he's so small to begin with. However, the camera code is the same for both characters, making it jump by 4 pixels if you roll while playing as Tails. It's not much, but once you notice it, you can't unsee and it starts to give you a headache.

    Anyway, to fix it, just add the lines between the semicolons:

    Code (ASM):
    1. loc_D78E:
    2.     btst    #2,status(a0)
    3.     beq.s   loc_D798
    4.     subq.w  #5,d0
    5.     ;
    6.     cmpi.w  #2,(Player_mode).w  ; Player_mode is $FFFFFF70
    7.     bne.s   loc_D798
    8.     addq.w  #4,d0
    9.     ;
    10.  
    11. loc_D798:
    12.  
    If your disasm doesn't have the same labels, you can find this code by searching for "subq.w #5,d0".