don't click here

Arg!

Discussion in 'Engineering & Reverse Engineering' started by Tweaker, Jun 16, 2006.

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

    Tweaker

    Banned
    12,387
    2
    0
    I've been trying to get my life icons in my hack to work for ages, but for some damn reason I can't get it to work right.

    I've narrowed down to where I *SHOULD* need to put the code, but for some reason it won't work. I do however know that it's the right place to put it, as it's where I had to put a jsr to PlayLevel in order to fix the issue where you started out with 0 lives.

    Here's my code so far - I'm positive it's all correct (or at least to a point):
    Code (Text):
    1. loc_909A:    ; CODE XREF: ROM:00009094j
    2.   move.b   ($FFFFFF8C).w,d0
    3.   bne.s    loc_90B6
    4.   moveq    #0,d0
    5.   move.w   d0,($FFFFFFD8).w
    6.   move.w   d0,($FFFFFF8A).w
    7.   move.w   d0,($FFFFFE10).w
    8.   
    9.  
    10.   cmpi.b   #$01,($FFFFFFBB).w
    11.   beq.w    Mighty_909A
    12.   cmpi.b   #$02,($FFFFFFBB).w
    13.   beq.w    Shad_909A
    14.   moveq    #0,d0
    15.   jsr  LoadPLC2
    16.   jmp  loc_909A_Cont
    17.  
    18. Mighty_909A:
    19.   moveq    #32,d0
    20.   jsr  LoadPLC2
    21.   jmp  loc_909A_Cont
    22.  
    23. Shad_909A:
    24.   moveq    #33,d0
    25.   jsr  LoadPLC2
    26.  
    27. loc_909A_Cont:  
    28.   move.b   #$C,($FFFFF600).w
    29.   jmp  PlayLevel
    30.   rts
    31. ; ???????????????????????????????????????????????????????????????????????????
    32.  
    33. loc_90B6:
    Now I must admit that I forgot to load the second non-working PLC (ID #1, for the HUD), but the point remains that NONE of them will work at all.

    I've considered putting the code in PlayLevel, so it would work in any situation, but doing so gives me an error while trying to compile ("cannot fit value BA into a signed byte" - this error is irrelevant to the line it points to where the error is, which is move.w LSelectPointers(pc,d0.w),d0 ; load level number).

    If anyone can help me fix this, it'd be greatly appreciated. This is being too complicated for no apperant reason.

    And in case you didn't catch it, this is for Sonic 1.
     
  2. jman2050

    jman2050

    Teh Sonik Haker Tech Member
    634
    4
    18
    Move the routine to PlayLevel and relocate LSelectPointers closer to the call to it, then get back to me.
     
  3. Hivebrain

    Hivebrain

    Administrator
    3,049
    161
    43
    53.4N, 1.5W
    Github
    I'd have the HUD object load some uncompressed art when the level starts. Messing with PLCs is confusing and usually results in untidy code.
     
  4. drx

    drx

    mfw Researcher
    2,254
    350
    63
    :rolleyes:
    Yea, you should move it to PlayLevel, like jman said, so it loads them in all cases. You should move this around other PLC loads (generic, or level-specific, doesn't matter).

    Or you can do it uncompressed, like Hivebrain said. Then you could include the uncompressed tiles using 'incbin' and edit them on the fly... Just a thought :P
     
  5. Tweaker

    Tweaker

    Banned
    12,387
    2
    0
    Well I moved it to PlayLevel, and it -STILL- doesn't work.

    Should I be using LoadPLC compared to LoadPLC2? All the other calls for it use 2, but maybe this is a different case? I dunno.

    EDIT: Tried LoadPLC and it doesn't work. What the fuck?
     
  6. Mask of Destiny

    Mask of Destiny

    Tech Member
    87
    0
    6
    The addressing mode you're using there only allows for an 8-bit displacement constant (in this case the difference between PC and LSelectPointers). Since this is a signed value that means the instruction has to be within 127 bytes or so of the LSelectPointers label.
     
Thread Status:
Not open for further replies.