don't click here

Basic Questions & Answers thread

Discussion in 'Engineering & Reverse Engineering' started by Tweaker, May 29, 2008.

  1. Hey, I have a problem when importing the REV01 effects to my hack. On Step 3 (in the guide, first page > link) I did everything it said to do and when I ran build.bat, it gave me an error messege. These are the messages:

    s1comb.asm(6211) : Error 06052 : Branch offset (-33650) out of range at address
    s1comb.asm(6224) : Error 06024 : Branch offset (-33650) out of range at address
    s1comb.asm(7137) : Error 6034 : FREF symbol 'ScrollBlock6' s1comb.asm[7137])
    s1comb.asm(7137) : Error 6034 : FREF symbol 'ScrollBlock5' s1comb.asm[7137])
    s1comb.asm(7137) : Error 6034 : FREF symbol 'ScrollBlock6' s1comb.asm[7137])
    s1comb.asm(7137) : Error 6034 : FREF symbol 'ScrollBlock5' s1comb.asm[7137])
    s1comb.asm(7137) : Error 6034 : FREF symbol 'ScrollBlock6' s1comb.asm[7137])
    s1comb.asm(7137) : Error 6034 : FREF symbol 'ScrollBlock5' s1comb.asm[7137])
    s1comb.asm(7137) : Error 6034 : FREF symbol 'ScrollBlock1_2' s1comb.asm[7137])

    If you ever had this message before, do you know exactly how to fix it?
     
  2. FraGag

    FraGag

    Tech Member
    I'm not sure if this should happen, but to fix this, you will need to replace bra.w with jmp and/or bsr.w with jsr. If you have another b??.w-like instruction, you will need some more work. Another option would be to try to reorganize your code and data so the branch offset gets in range.

    Also, I'm not sure if the FREF symbol errors are related to this; if they still appear, let us know.
     
  3. You know, I found out that the problem is the "bsr.w". I tried "jsr.w" but it didn't work. What should I write exactly?
     
  4. Rika Chou

    Rika Chou

    Tech Member
    5,276
    169
    43
    Just use jsr instead of jsr.w
     
  5. FraGag

    FraGag

    Tech Member
    Code (ASM):
    1.  jsr label
    instead of
    Code (ASM):
    1.  bsr.w label
    The problem is that the offset is too large to fit in a signed word, so you have to use an instruction that allows greater offsets. JSR doesn't actually use offsets; instead, the absolute address of the subroutine is put in the machine code. The full version of jsr would be jsr.l, but since jsr can't be used with other sizes, it is redundant, so we only write jsr.
     
  6. Ok, because of that, the errors went from 13 to 5 left. The errors now say:

    s1comb.asm(6211) : Error 06052 : Branch offset (-33673) out of range at address
    s1comb.asm(6211) : Error 06052 : Branch offset (-33650) out of range at address
    s1comb.asm(7137) : Error 15019 : FREF symbol 'ScrollBlock6' (s1comb.asm[7137])
    s1comb.asm(7142) : Error 15019 : FREF symbol 'ScrollBlock5' (s1comb.asm[7142])
    s1comb.asm(7619) : Error 15019 : FREF symbol 'ScrollBlock1_2' (s1comb.asm[7619])

    How to fix please?

    Also, how do you free space on your "s1built" so you can add the spindash art? Kind of a small question....
     
  7. Dark Sonic

    Dark Sonic

    Member
    14,631
    1,611
    93
    Working on my art!
    Sure enough that did the trick. The title screen now works. Thank you very much.

    But I return with another question. This one is about sprites.

    I ported the Sonic 2 sprites over to Sonic 1. I edited the animations so that the sprites appear in the proper order and all, however the running animation doesn't work properly. Sometimes while running, only on slopes though, the animations get screwed up and the wrong sprite appears. This also causes the game to freeze every so often. Something needs to be changed in the code to make the game know that there are 8 walking animations instead of 6, but I don't know where that bit of code might be.
     
  8. Tweaker

    Tweaker

    Banned
    12,387
    2
    0
    Using the Sonic 2 version of the SAnim_WalkRun routine might do the trick. I've made a couple of modifications which may or may not have broken it. I guess we'll see!
    Code (ASM):
    1. SAnim_WalkRun:
    2.         addq.b  #1,d0       ; is the start flag = $FF ?
    3.         bne.w   SAnim_Roll  ; if not, branch
    4.         moveq   #0,d0       ; is animation walking/running?
    5.         move.b  $27(a0),d0  ; if not, branch
    6.         bne.w   SAnim_Tumble
    7.         moveq   #0,d1
    8.         move.b  $26(a0),d0  ; get Sonic's angle
    9.         bmi.s   @Label1
    10.         beq.s   @Label2
    11.         subq.b  #1,d0
    12. @Label1:
    13.         move.b  $22(a0),d2
    14.         andi.b  #1,d2       ; is Sonic mirrored horizontally?
    15.         bne.s   @Label2     ; if yes, branch
    16.         not.b   d0      ; reverse angle
    17. @Label2:
    18.         addi.b  #$10,d0     ; add $10 to angle
    19.         bpl.s   @Label3     ; if angle is $0-$7F, branch
    20.         moveq   #3,d1
    21. @Label3:
    22.         andi.b  #$FC,1(a0)
    23.         eor.b   d1,d2
    24.         or.b    d2,1(a0)
    25.         btst    #5,$22(a0)
    26.         bne.w   SAnim_Push
    27.         lsr.b   #4,d0       ; divide angle by 16
    28.         andi.b  #6,d0       ; angle must be 0, 2, 4 or 6
    29.         move.w  $14(a0),d2  ; get Sonic's "speed" for animation purposes
    30.         bpl.s   @Label4
    31.         neg.w   d2
    32. @Label4:
    33.         tst.b   $2B(a0)
    34.         bpl.w   @Label5
    35.         add.w   d2,d2
    36. @Label5:
    37. ;       tst.b   ($FFFFFE19).w
    38. ;       bne.s   SAnim_Super
    39.         lea (SonAni_Run).l,a1   ; use running animation
    40.         cmpi.w  #$600,d2        ; is Sonic at running speed?
    41.         bcc.s   @Label6         ; use running animation
    42.         lea (SonAni_Walk).l,a1  ; if yes, branch
    43.         add.b   d0,d0
    44. @Label6:
    45.         add.b   d0,d0
    46.         move.b  d0,d3
    47.         moveq   #0,d1
    48.         move.b  $1B(a0),d1
    49.         move.b  1(a1,d1.w),d0
    50.         cmpi.b  #-1,d0
    51.         bne.s   @Label7
    52.         move.b  #0,$1B(a0)
    53.         move.b  1(a1),d0
    54. @Label7:
    55.         move.b  d0,$1A(a0)
    56.         add.b   d3,$1A(a0)
    57.         subq.b  #1,$1E(a0)
    58.         bpl.s   return_1B4AC
    59.         neg.w   d2
    60.         addi.w  #$800,d2
    61.         bpl.s   @Label8
    62.         moveq   #0,d2
    63. @Label8:
    64.         lsr.w   #8,d2
    65.         move.b  d2,$1E(a0)  ; modify frame duration
    66.         addq.b  #1,$1B(a0)      ; modify frame number
    67.  
    68. return_1B4AC:
    69.     rts
    I used to know the specifics of this, and what determined how many frames are used in the walking animation, but it's been too long now and I don't remember a thing. :)

    Let me know if there's any issues; I haven't personally tested this.
     
  9. Hey, does anyone know where I can find a background changing tutorial and the tutorial for making GHZ work in SonED2?
     
  10. Mairtrus

    Mairtrus

    Get a load of this!! Tech Member
    27
    0
    0
    Mendoza, Argentina
    Sonic Z. The Z DOESN'T means nothing.
    @Dark Sonic
    The problem is not precisely in the routine "SAnim_WalkRun" else in the script of the walking/running Sonic's animation. It is extremely easy to fix, only opens the file "_anim\Sonic.asm", you should see something like this in the firsts scripts:
    Code (ASM):
    1. SonAni_Walk:    dc.b $FF, 8, 9, $A, $B, 6, 7, $FF
    2. SonAni_Run: dc.b $FF, $1E, $1F, $20, $21, $FF, $FF, $FF
    3. SonAni_Roll:    dc.b $FE, $2E, $2F, $30, $31, $32, $FF, $FF
    4. [...]
    5.  
    Rigth?
    Now, once you change the labels "SonAni_Walk" and "SonAni_Run" is when the problem starts, right?
    The solution is to add as many $FF at the end of "SonAni_Run" to have as many bytes as "SonAni_Walk".
    This should be similar to this:
    Code (ASM):
    1. SonAni_Walk:    dc.b $FF, $A,  $B,  $C,  $D,  $E,  $F,  8,  9,  $FF
    2. SonAni_Run: dc.b $FF, $28, $29, $2A, $2B, $FF, $FF, $FF,$FF,$FF
    3. SonAni_Roll:    dc.b $FE, $38, $39, $3A, $3B, $3C, $FF, $FF
    Can you see? The walk script have 10 bytes, so the run script must have 10 bytes too.
    Anyway, the Tweaker's code works fine, but has some changes unnecessary.
    Only you need to change:
    Code (ASM):
    1. loc_13A9C:
    2.         lea (SonAni_Run).l,a1 ; use running animation
    3.         cmpi.w  #$600,d2    ; is Sonic at running speed?
    4.         bcc.s   loc_13AB4   ; if yes, branch
    5.         lea (SonAni_Walk).l,a1 ; use walking animation
    6.         move.b  d0,d1
    7.         lsr.b   #1,d1
    8.         add.b   d1,d0
    9.  
    by this:
    Code (ASM):
    1. loc_13A9C:
    2.         lea (SonAni_Run).l,a1 ; use running animation
    3.         cmpi.w  #$600,d2    ; is Sonic at running speed?
    4.         bcc.s   loc_13AB4   ; if yes, branch
    5.         lea (SonAni_Walk).l,a1 ; use walking animation
    6.         add.b   d0,d0
    7.  
     
  11. Dark Sonic

    Dark Sonic

    Member
    14,631
    1,611
    93
    Working on my art!
  12. Yuki Speed

    Yuki Speed

    Member
    3
    0
    0
    Mount hope, ON, CA
    Sonic Chibi Dash
    Hey! I've got a problem that's stopped my progress of my hack. Basicly what happened is I imported my new sprite through Sonmaped, and I built my ROM. I went through the first act but when I got to the end of the level my screen went gray. Help?
     
  13. Dark Sonic

    Dark Sonic

    Member
    14,631
    1,611
    93
    Working on my art!
    I may be able to help, but I'll need some more information. What exactly is it that you are trying to load in the game?
     
  14. Yuki Speed

    Yuki Speed

    Member
    3
    0
    0
    Mount hope, ON, CA
    Sonic Chibi Dash
    I'm trying to load the signpost art.
     
  15. Aquaslash

    Aquaslash

    <The Has-been Legend> Moderator
    Sounds like you didn't compress the new art.

    I had that happen once, it's an easy to make mistake really.
     
  16. Tweaker

    Tweaker

    Banned
    12,387
    2
    0
    SonMapEd should have an option to save compressed art after an import—did you try that?

    If all else fails, save the decompressed art and compress it with TSDC or something later.
     
  17. Does anybody have an art editing guide? Not the one with the locations of the art, I mean, like I want to edit the LZ, MZ, and GHZ art, any one have a step by step way to do it? Like for example, in S1 Megamix, the brown and orange squares in GHZ are shaded, that's how I want to edit the art. I heard you can edit it in SonED2, but I don't know how exactly to do it. How do you edit the art?
     
  18. Yuki Speed

    Yuki Speed

    Member
    3
    0
    0
    Mount hope, ON, CA
    Sonic Chibi Dash
    The gray screen is fixed. It was because it wasn't compressed. Thanks Tweaker.
     
  19. I believe it's covered in SCHG:SonED2_Manual/Tile_Editor
     
  20. Peruant

    Peruant

    Just dropping in through gaps Member
    One more before I'm set to go. Any recommendations for a decent midi-making program?