Basic Questions and Answers Thread

Discussion in 'Discussion & Q&A' started by Malevolence, Jul 7, 2009.

  1. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    845
    You can't just "make another bank", the sound driver is hardcoded to only look in two banks for music, one of which has the continue music and a bunch of random stuff, and the other which has all the rest of the music and the sound effects. What you can do, is try setting the sound effects in a new bank, which will give you a bit more space for music, or move it to the continue bank and move around the assorted art to get more space. Note that if you put music in the continue bank, you need to use a specific notation in the Z80 playlist section of the sound driver (see the continue music for details).
    Or, you could replace the sound driver entirely, such as the Clone Driver (works like Sonic 1), the KEH sound driver with multi-bank management system, or even the S3K driver.

    Also, when importing music to Sonic 2, you need to either use SMPS2ASM and set the 'uncompressed' flag in the Z80 playlist, or convert the song into the Sonic 2 format with a base address of 1380 and compress it as Saxman (with size). You can't just drop a Sonic 1 format binary into the ROM and expect it to work.
     
    Last edited: May 10, 2019
    RyeBread and Tanman Tanner like this.
  2. Tanman Tanner

    Tanman Tanner Well-Known Member Member

    Joined:
    Dec 23, 2016
    Messages:
    65
    Location:
    Buffalo, New York
    My mistake. Sonic 3 lets me get away with making more banks, but it's not hardcoded like Sonic 2 (at least, not that I know of). I just assumed it'd be the same with Sonic 2, add a new bank, problem solved. Apologies @RyeBread.
     
    RyeBread likes this.
  3. Iso Kilo

    Iso Kilo Local Idiot Member

    Joined:
    Oct 9, 2017
    Messages:
    121
    Location:
    Small Town in BC, Canada
    I'm currently working on a disassembly of Earthworm Jim, and I'm quite new to IDA Pro (6.8), so the question I have to ask: how do I run a second auto analysis? I've still got a lot of data unexplored and I'm not too sure how to handle it, other than doing another run.
     
  4. RyeBread

    RyeBread Well-Known Member Member

    Joined:
    May 10, 2013
    Messages:
    141
    Location:
    Devon
    Right, so I ported the clone driver, but now when I start the game it's almost like it's muted. (It's not, I checked everywhere and Sonic 1 still has its music.)
    I doublechecked the steps and I think I did everything right? Not sure where exactly I went wrong to the point there's no errors but no music is playing.
     
  5. Novedicus

    Novedicus Well-Known Member Member

    Joined:
    Aug 26, 2013
    Messages:
    874
    Lemme ask first, what exactly is your disassembling process like?
     
  6. Iso Kilo

    Iso Kilo Local Idiot Member

    Joined:
    Oct 9, 2017
    Messages:
    121
    Location:
    Small Town in BC, Canada
    Well, I open the file in IDA, set the processor to 68000 and let it do it's thing.
     
  7. Novedicus

    Novedicus Well-Known Member Member

    Joined:
    Aug 26, 2013
    Messages:
    874
    IDA's auto analysis is unreliable, since by itself, it doesn't know how a Genesis ROM is formatted. I THINK there is a module for IDA that opens Genesis ROMs properly, but I don't remember.

    Unfortunately, no matter what you do, IDA isn't going to magically disassemble the entire ROM for you and properly split the data from the code. There's a lot of manual changes you'll need to make. You'll need a very good understanding of the Genesis hardware and know how to analyze code in order to effectively make a proper disassembly.

    Here are some points to get you started with operating IDA, though:

    What should really be done is that the first thing you do when disassembling a Genesis ROM is set up the vector table at the very start of the ROM (data can be turned into longwords by pressing Q, and into actual pointers by pressing O). There are documents online on which pointers are which. Then, I manually start converting data into code by pressing C on the data I want to convert, with going to each vector table pointer as starting points.

    As for other data, you can press D to change the size of the currently selected line of data. With the 68000, it will go from byte to word, and then word to longword, and then back from longword to byte.

    You can set a label by pressing N at the currently selected line. If you have a pointer or already existing label highlighted, it will change the name of that.

    You probably would also want to set up segments for hardware registers and RAM. You can handle segments by going to Edit>Segments.

    You can set up arrays by selecting the data you want to convert into an array and then pressing *. The size of each member in the array is dependent on the size of the first element selected.

    For relative pointer lists (if you don't know what that is, just look at how Sonic 1/2 objects handle pointers to object routines), you can press Ctrl+R on the pointer you want to set up and set the base address and all that. Make sure you also set the correct type of pointer.

    Oh yeah, and I believe even with your version of IDA, it won't properly disassembly PC relative instructions. See here on how to fix that.
     
    TheStoneBanana and Natsumi like this.
  8. Iso Kilo

    Iso Kilo Local Idiot Member

    Joined:
    Oct 9, 2017
    Messages:
    121
    Location:
    Small Town in BC, Canada
    Well, that's about the same answer I got elsewhere: Here are some shortcuts. This was certainly a lot more in deph however. And yes, there is a Genesis plugin for IDA, but I couldn't figure out how to work it. I'm probably getting to ahead of myself with my current skillset, so maybe it'd be for the best that I drop this project.
     
  9. EMK-20218

    EMK-20218 Eduardo Knuckles Member

    Joined:
    Aug 8, 2008
    Messages:
    994
    Location:
    Acapulco, Guaruj√°
    Well... whatever. Forget this. Anyone please trash this thing here.
     
    Last edited: May 10, 2019
  10. RyeBread

    RyeBread Well-Known Member Member

    Joined:
    May 10, 2013
    Messages:
    141
    Location:
    Devon
    Alright, so after finding out there was a newer version of the clone driver not on the github releases but on the github itself, I've almost seemingly gotten it working. The only issue is, after building without issues, the screen is black.

    I've ran into many issues and after several hours I've fixed them but this one's gotten me stumped.

    Edit:
    So that came from me "fixing" this issue, which I can't seem to actually fix. I followed the github guide and I've redone it all about 6 times, no luck. [​IMG]
     
    Last edited: May 9, 2019
  11. Iso Kilo

    Iso Kilo Local Idiot Member

    Joined:
    Oct 9, 2017
    Messages:
    121
    Location:
    Small Town in BC, Canada
    This was way way too short for a full post, so here's a mini no-brainer tutorial.
    In Sonic 1, if you were to run at full speed and enter edit mode (or debug mode), you will keep your momentum once you exit out. The fix is extremely simple. Go to Debug_Main. Immediately after the label, insert this.
    Code:
            clr.w    ($FFFFD000+$14).w
    Now let's go over what exactly this is. clr.w is obviously clear word. And ($FFFFD000+$14).w is the destination. So clear the upper word of ($FFFFD000+$14).w
    But what's ($FFFFD000+$14).w? The first part, $FFFFD000 is the start of Sonic's SST. And then it adds $14. Now, this could be read out as $FFFFD014. And $FFFFD014 is where Sonic's inertia is stored. And that's it. All this is doing is, when Sonic enters debug mode, his inertia value is cleared. Hope this helps some of you guys.
    Edit: Changed from clr.b to clr.w, Sonic will now completely stop.
    Edit 2: Just throw this in
    Code:
            clr    ($FFFFD000+$14).w
            clr    ($FFFFD000+$12).w
            clr    ($FFFFD000+$10).w
    Not gonna bother explaining. But this will now absolutely stop Sonic. Before, he would still be able to keep momentum in air.
     
    Last edited: May 15, 2019
    Tanman Tanner likes this.