don't click here

A few questions about RAM usage

Discussion in 'Engineering & Reverse Engineering' started by Ambil, Aug 16, 2005.

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

    Ambil

    I want that heinous hedgehog hammered! Member
    893
    0
    0
    Spain
    I am writing some lines in the Sonic 1 dissasembly, and I need some information about it. So I want to some locations in the RAM, regarding:

    The current X camera position.
    The current Y camera position.
    The current X Sonic position.
    The current Y Sonic position.

    Another information I need for my program is where the current input from the joypad are located, yet I had a look at drx's Assembly notes and checked it's at 0xFFF604.

    Thank you for helping me.

    ~Ambil
     
  2. Sonic 65

    Sonic 65

    Tech Member
    $FFFFD008: Sonic's X position
    $FFFFD00C: Sonic's Y position

    Dunno where the camera position is, though.
     
  3. LOst

    LOst

    Tech Member
    4,891
    6
    18
    $FFF700 Camera X
    $FFF704 Camera Y

    $FFF604 Input hold (Use this for button holds)
    $FFF605 Input click (Use this for button clicks)
     
  4. Sonic 65

    Sonic 65

    Tech Member
    Here's a value list too:

    F0 = Any button
    80 = Start
    01 = Up
    02 = Down
    04 = Left
    06 = A
    08 = Right
    ?? = B

    When you want to check if a button is pressed, simply use the following code:

    andi.b #$xx,($FFFFF605).w ; Check if xx is pressed
    beq.w subroutine_before ; If not, go back...
    [custom code here]

    Same if you want to check if it's being held; just replace FFFFF605 with FFFFF604.
     
  5. Aurochs

    Aurochs

    Единый, могучий Советский Союз! Tech Member
    2,343
    0
    0
    Whatever catches my fancy
    Sonic65 is way off.

    Bitfield:

    SACBRLDU

    And that, I believe, is a standard across most Genesis games. Or, at least those developed by Sega. :P
     
  6. Ambil

    Ambil

    I want that heinous hedgehog hammered! Member
    893
    0
    0
    Spain
    Thanks guys, but I have some things to say.

    I wish to know what do address 0xFFF7CC store in the RAM.

    And Sonic 65, that's a good idea, but now that I know the bits in the drx's guide,

    I guess the codes for the buttons would be:

    Code (Text):
    1. $80 - Start
    2. $40 - A button
    3. $20 - C button
    4. $10 - B button
    5. $08 - Right
    6. $04 - Left
    7. $02 - Down
    8. $01 - Up

    Example:

    my_program:
    andi.b #$11, ($FFFFF604).w ;test if B and Up are holded
    bne.s _return_

    (custom code)

    _return_
    rts
     
  7. LOst

    LOst

    Tech Member
    4,891
    6
    18
    SACBRLDU
     
  8. LOst

    LOst

    Tech Member
    4,891
    6
    18
    $FFF7CC is a byte flag cleared when going into debug. If it isn't cleared, it will store the last keystrokes for Sonic in $FFF602

    EDIT: Well, simply if it is set to something other than 00, it will stop Sonic from taking input. Nothing is really doing this in the game that I know of.
     
  9. Ambil

    Ambil

    I want that heinous hedgehog hammered! Member
    893
    0
    0
    Spain
    Well, my program is completed (I think). I now wish to know where is the routine in the disassembly where the game is paused.

    Note: I use drx's disassembly. It's quite useful, but I would like to grab Hivebrain's one, since I heard it's much nicer. Now that Hacking CulT is down, I can't download it, so anyone to do me this favour, please.
     
  10. Tweaker

    Tweaker

    Misfit
    12,389
    1
    0
    Hehe, you guys should read Saxman's S2 Guide more. It has all this shit in there.
     
  11. Ambil

    Ambil

    I want that heinous hedgehog hammered! Member
    893
    0
    0
    Spain
    Regarding Sonic 1?
     
  12. Hivebrain

    Hivebrain

    Administrator
    3,011
    99
    28
    53.4N, 1.5W
    Github
    $FFFFF7CC is the "ending mode" flag, used during the ending sequence. If it's set to 01, then the controls are locked.
     
  13. Tweaker

    Tweaker

    Misfit
    12,389
    1
    0
    Yep. S2 was built off S1, and uses most of the same RAM locations. Besides that, the button format is universal.
     
Thread Status:
Not open for further replies.