Build Errors when adding stuff

Discussion in 'Discussion and Q&A Archive' started by TheRetroGuy, Sep 13, 2012.

Thread Status:
Not open for further replies.
  1. TheRetroGuy

    TheRetroGuy Newcomer In Limbo

    Joined:
    Aug 18, 2012
    Messages:
    20
    I tried to add the Sonic 2 title screen to Sonic 1 and this happened


    [​IMG]


    I also attached the sonic1.asm too. Here it is sonic1.zip (It's compressed so I could upload it)


    Does anyone know a fix to this problem?
     

    Attached Files:

  2. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    Search messages about the "out of range" error.
     
  3. TheRetroGuy

    TheRetroGuy Newcomer In Limbo

    Joined:
    Aug 18, 2012
    Messages:
    20
    The first error is on a line that says this

    the first routine is this:

    and the second line says this

    and this routine is:

     
    Last edited by a moderator: Sep 14, 2012
  4. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    No, both errors are on lines that say bsr.w mvsoniconptfm. That's what the error message says.


    It might be a problem with your editor not counting the lines properly. What are you using?
     
  5. Mike B Berry

    Mike B Berry A grandiose return Member

    Joined:
    Jun 6, 2012
    Messages:
    377
    Location:
    New places, newer motivation
    I don't think you understand...


    Use note pad or whatever program you use to view your ASM file and select the status bar option and search for the lines that are causing your error. In this case it is (-32874) Line number 32874


    Look how it is says Illegal value. Obviously the code isn't being called into the routine properly. I would like to also point out that it might also be out of range. I would suggest changing you BSR.W code to something a bit stronger.
     
    Last edited by a moderator: Sep 14, 2012
  6. TheRetroGuy

    TheRetroGuy Newcomer In Limbo

    Joined:
    Aug 18, 2012
    Messages:
    20
    If I change them to bsr.l I still have problems so you may be right. I had a problem very similar to this when I tried to add the spindash.
     
    Last edited by a moderator: Sep 14, 2012
  7. Mike B Berry

    Mike B Berry A grandiose return Member

    Joined:
    Jun 6, 2012
    Messages:
    377
    Location:
    New places, newer motivation
    Rather than using BSR.L, try using JSR instead.
     
    Last edited by a moderator: Sep 14, 2012
  8. redhotsonic

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England
    You mean JSR, right? =P
     
  9. Irixion

    Irixion Well-Known Member Member

    Joined:
    Aug 11, 2007
    Messages:
    670
    Location:
    Ontario, Canada
    Illegal value? What's mysoniconpt fm? I've had Sonic 2's assembler throw that at me when the file has some garbage in the header, just clear it out with hex.
     
  10. Flamewing

    Flamewing Elite Hacker Member

    Joined:
    Aug 28, 2011
    Messages:
    37
    Location:
    France
    The 'illegal value' refers to the fact that -32874 and -32942 both are less than -32768, which is the largest distance a bsr.w can jump in the negative direction. A bsr.s jump (actually, any b??.s) is limited to -128 to 127 bytes (basically, a single byte saying how large the distance is), a bsr.w jump is limited to -32768 to 32767 (2 bytes telling the distance), while a jmp or a jsr can jump anywhere. This happens because you added too much stuff in between the referred branches and their targets. In order to find the offending branches, go to the line numbers in parenthesis right after the .asm:


    {stuff}SONIC1.ASM(here) : Error : {stuff}


    Please DON'T "clear it out with hex". Just change the branches in question to be jsr instead.
     
  11. TheRetroGuy

    TheRetroGuy Newcomer In Limbo

    Joined:
    Aug 18, 2012
    Messages:
    20
    I did it and the errors are gone but the title screen menu is glitched up. But I fixed it by changing the Title_LoadText: routine a bit. But I have another problem when I use the spindash. The centisecond numbers in the timer are showing up in Sonic's spindash dust as shown below in the picture. Any ideas to how to fix this?


    [​IMG]
     
    Last edited by a moderator: Sep 14, 2012
  12. StephenUK

    StephenUK Working on a Quackshot disassembly Member

    Joined:
    Aug 5, 2007
    Messages:
    1,026
    I think it's you that doesn't understand. -32874 is not the line number at all, it's the value that the code is trying to branch by, which is larger than what a BSR can cope with, hence why a JSR is needed. Look at Flamewing's response for a more complete explanation.
     
  13. Mike B Berry

    Mike B Berry A grandiose return Member

    Joined:
    Jun 6, 2012
    Messages:
    377
    Location:
    New places, newer motivation
    I find it very funny that you mention that. Every time I ran into issues like this, they are always fixed by this method. My methods may be indirect or down right retarded, there is no room to ridicule them. I always fix them in the end.


    But I digress here; he fixed the issue. And I don't see any point in continuing this.
     
    Last edited by a moderator: Sep 14, 2012
  14. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    TheRetroGuy, the issue there is that the smoke's art is loaded into VRAM in the same space where the number art for your centi-second time art is loaded, you will need to find another space for either the smoke art, or the number art.
     
  15. TheRetroGuy

    TheRetroGuy Newcomer In Limbo

    Joined:
    Aug 18, 2012
    Messages:
    20
    I don't know where to start at. Here is my new sonic1.asm after I fixed the build errors. sonic1.zip


    I will also include my pattern load cues.asm here: Pattern load cues.zip
     

    Attached Files:

    Last edited by a moderator: Sep 15, 2012
  16. redhotsonic

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England
    You could use Regen and open the VDP debugger to look for space there. Basically, where ever you told the centiseconds to load, change that number to point somewhere else in the VDP where it is free. I haven't downloaded what you put in the previous post, but I am guessing that you've put something similar to this:



    move.l #$56800003,d0 ; Use this for the VRAM
    bsr.w Hud_Secs ; Use the seconds art



    I have mine in #$56800003. Although, I've moved a lot of art about, so #$56800003 probably isn't a good choice for you. This may take some trial-and-error. Also, remember to change the HUD mappings for the centiseconds so it points to your new location.
     
  17. TheRetroGuy

    TheRetroGuy Newcomer In Limbo

    Joined:
    Aug 18, 2012
    Messages:
    20
    This is what it has for the centisecond timer:



    Code:
    CentiSecond:		move.l #$75400003,d0		moveq #0,d1		move.b ($FFFFFE25).w,d1 ; load frames		mulu.w #$1AA,d1		lsr.l #8,d1		jsr Hud_Secs		rts
    [/CODE]
     
    Last edited by a moderator: Sep 15, 2012
  18. redhotsonic

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England
    The "move.l #$75400003,d0" is what is over-writing the Spindash art. You need to edit this bit so you can move the centi-seconds elsewhere.
     
  19. TheRetroGuy

    TheRetroGuy Newcomer In Limbo

    Joined:
    Aug 18, 2012
    Messages:
    20
    I changed the move.l #$75400003 to #$75400009


    It has this for my hud mappings:



    Code:
    ; ---------------------------------------------------------------------------
    
    ; Sprite mappings - SCORE, TIME, RINGS
    
    ; ---------------------------------------------------------------------------
    
            dc.w byte_1C5BC-Map_obj21, byte_1C5F0-Map_obj21
    
            dc.w byte_1C624-Map_obj21, byte_1C658-Map_obj21
    
    
    
            ; Y-Pos, layout, VDP (2bytes - plane, pallet line (2bits), flip, mirror, first tile (11bits) - ), X-Pos
    
    byte_1C5BC:    dc.b $C
    
            dc.b $80, $D, $80, 0, 0        ; SCOR
    
            dc.b $80, $D, $80, $18,    $20    ; E + score left numbers
    
            dc.b $80, $D, $80, $20,    $40    ; score right numbers
    
            dc.b $90, $D, $80, $10,    0    ; TIME
    
            dc.b $90, $D, $80, $28,    $28    ; minutes : seconds
    
            dc.b $90, 1, $80, $2A, $48    ; :
    
            dc.b $90, 5, $80, $E0, $50    ; centiseconds
    
            dc.b $A0, $D, $80, 8, 0        ; RING
    
            dc.b $A0, 1, $80, 0, $20    ; S
    
            dc.b $A0, 9, $80, $30, $30    ; number of rings
    
            dc.b $40, 5, $81, $A, 0        ; lives icon
    
            dc.b $40, $D, $81, $E, $10    ; lives counter
    
            dc.b 0
    
    byte_1C5F0:    dc.b $C
    
            dc.b $80, $D, $80, 0, 0        ; SCOR
    
            dc.b $80, $D, $80, $18,    $20    ; E + score left numbers
    
            dc.b $80, $D, $80, $20,    $40    ; score right numbers
    
            dc.b $90, $D, $80, $10,    0    ; TIME
    
            dc.b $90, $D, $80, $28,    $28    ; minutes : seconds
    
            dc.b $90, 1, $80, $2A, $48    ; :
    
            dc.b $90, 5, $80, $E0, $50    ; centiseconds
    
            dc.b $A0, $D, $A0, 8, 0        ; RING
    
            dc.b $A0, 1, $A0, 0, $20    ; S
    
            dc.b $A0, 9, $80, $30, $30    ; number of rings
    
            dc.b $40, 5, $81, $A, 0        ; lives icon
    
            dc.b $40, $D, $81, $E, $10    ; lives counter
    
            dc.b 0
    
    byte_1C624:    dc.b $C
    
            dc.b $80, $D, $80, 0, 0        ; SCOR
    
            dc.b $80, $D, $80, $18,    $20    ; E + score left numbers
    
            dc.b $80, $D, $80, $20,    $40    ; score right numbers
    
            dc.b $90, $D, $A0, $10,    0    ; TIME
    
            dc.b $90, $D, $80, $28,    $28    ; minutes : seconds
    
            dc.b $90, 1, $80, $2A, $48    ; :
    
            dc.b $90, 5, $80, $E0, $50    ; centiseconds
    
            dc.b $A0, $D, $80, 8, 0        ; RING
    
            dc.b $A0, 1, $80, 0, $20    ; S
    
            dc.b $A0, 9, $80, $30, $30    ; number of rings
    
            dc.b $40, 5, $81, $A, 0        ; lives icon
    
            dc.b $40, $D, $81, $E, $10    ; lives counter
    
            dc.b 0
    
    byte_1C658:    dc.b $C
    
            dc.b $80, $D, $80, 0, 0        ; SCOR
    
            dc.b $80, $D, $80, $18,    $20    ; E + score left numbers
    
            dc.b $80, $D, $80, $20,    $40    ; score right numbers
    
            dc.b $90, $D, $A0, $10,    0    ; TIME
    
            dc.b $90, $D, $80, $28,    $28    ; minutes : seconds
    
            dc.b $90, 1, $80, $2A, $48    ; :
    
            dc.b $90, 5, $80, $E0, $50    ; centiseconds
    
            dc.b $A0, $D, $A0, 8, 0        ; RING
    
            dc.b $A0, 1, $A0, 0, $20    ; S
    
            dc.b $A0, 9, $80, $30, $30    ; number of rings
    
            dc.b $40, 5, $81, $A, 0        ; lives icon
    
            dc.b $40, $D, $81, $E, $10    ; lives counter
    
            even
    [/CODE]
     
    Last edited by a moderator: Sep 15, 2012
  20. Animemaster

    Animemaster Lets get to work! Member

    Joined:
    Mar 20, 2009
    Messages:
    1,229
    Location:
    UK
    Well? has it worked? you need to test it to see if you've done it right.
     
Thread Status:
Not open for further replies.