Viewing ASM Code in Sonic Eraser?

Discussion in 'Discussion and Q&A Archive' started by Sendator, Sep 20, 2012.

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

    Sendator Newcomer Trialist

    Joined:
    Sep 18, 2012
    Messages:
    7
    Location:
    Southern Hemisphere
    Hi, guys, I'm relatively new here, so I hope that this works out well for a first post.


    Being a constant player of Sonic Eraser, I was wondering how to actually hack the game. I saw a post on Sonic Retro stating that the entire top section of the program was made to be used so it could be linked up with the SegaNet modem. I use the WindHex program, but I cannot figure out how to actually view the code from a Motorala 68000 perspective. How can I do this?
     
  2. Spanner

    Spanner The Tool Member

    Joined:
    Aug 9, 2007
    Messages:
    2,570
    You would need to disassemble the ROM with IDA.
     
  3. Sendator

    Sendator Newcomer Trialist

    Joined:
    Sep 18, 2012
    Messages:
    7
    Location:
    Southern Hemisphere
    What would IDA be?
     
  4. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    The binary ROM needs disassembling in some form for you to actually see the binary code in motorola 68000 mnemonic form:



    Code:
    31 FC 02 40 80 00


    Becomes:





    Code:
    move.w    #$0240,($FFFF8000).w

    Of course, knowing all of the details and reverting all values into mnemonics by hand, although not impossible and not too complicated, due to the extensive amount of code you could be disassembling, it is preferred by many to use a "disassembler". "IDA pro" (which Spanner mentioned) is an interactive disassembler, it is designed to convert raw binary code into mnemonic instructions in text form (like Motorola 68000 for example) whilst giving you multiple other options, considering that computers have states which depend on human input (i.e. from the controller), it cannot find all of the code and run through disassembling everything for you, hence why it's "interactive", you need to decide which is code and which is data.


    Other methods of disassembling include using emulators that have disassembling capabilities, although I haven't used or seen such a thing that exists, I have been told that because you have control over user input, and because the emulator will disassemble any code it processes, it can potentially help you to disassembly all code that gets used in the game, this may not help for code that doesn't get used in the game at any time (i.e. unused code).


    I naturally would advise towards IDA rather than the emulators, but I've never used the emulator method so my opinion is invalid here, sorry.
     
  5. DanielHall

    DanielHall Well-Known Member Member

    Joined:
    Jan 18, 2010
    Messages:
    860
    Location:
    North Wales
    Alternatively, if you want to do it by hand, I suggest you go and have a look at these links:


    http://info.sonicretro.org/SCHG:68000_ASM-to-Hex_Code_Reference - Gives advice into how these instructions work, but it's not particularly reliable.


    http://www.freescale.com/files/archives/doc/ref_manual/M68000PRM.pdf - You should find whatever you need to convert binary into 68000 code. You will find them in the 'integer instructions' chapter in a similar format to this:

    Obviously, you will need to learn how the binary and hexadecimal numbering system works, and how to convert it. Otherwise, use this handy site:


    http://www.mathsisfun.com/binary-decimal-hexadecimal-converter.html


    Not that I recommend disassembling it by hand, but it helps to know how it's done.
     
  6. Sonic master

    Sonic master Well-Known Member Member

    Joined:
    Mar 27, 2010
    Messages:
    303
    I combine gens tracer with IDA pro what gens tracer does is while you play the game it saves all code to a file and what all the registers contain you then use the offsets with IDA pro and tell it that that offset is code it will then go onto identify areas below that until the function is over usally. Keep doing that and also try to look at the code and identify pointers also keep in mind that ida pro identifies stuff that is not pointers as pointers alot.
     
  7. Sendator

    Sendator Newcomer Trialist

    Joined:
    Sep 18, 2012
    Messages:
    7
    Location:
    Southern Hemisphere
    I just got IDA pro and am taking into consideration about what you just said.


    There seems to be a huge chunk of empty code, so that seems like the game is very small.


    I'm using the Hex converter from Sonic Retro that Dandaman talked about.


    I'm inspecting the element right now as I speak.


    It's looking pretty good, but I'm just taking a look at it so I can understand it right now.
     
Thread Status:
Not open for further replies.