The Options Menu to Sonic 1

Discussion in 'Discussion and Q&A Archive' started by theocas, Jul 19, 2010.

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

    theocas #! Member

    Joined:
    Apr 10, 2010
    Messages:
    375
    So I am trying to port the Sonic 2 Options Menu to Sonic 1, but there are some questions. I am implementing it as an additional screen mode. Is that the way I should go? There are also some RAM adresses and some other stuff that I can't figure out the Sonic 1 equivalent of. They are:



    Code:
    Metablock_Table
    
    $FFFF0160
    
    $FFFFF7F0
    
    Level_started_flag
    
    VDP_control_port (not sure, I think it's $C0000)
    
    $FFFF00B6
    
    $FFFF0030
    
    $FFFF0190
    
    $FFFF0216
    Any help would be appreciated.
     
  2. Animemaster

    Animemaster Lets get to work! Member

    Joined:
    Mar 20, 2009
    Messages:
    1,229
    Location:
    UK
    In the s2 2007 disam, at the begining of the s2.asm file you have the name of the adresses in s2 and there conversion for sonic 1. The options work a bit like the levelselect in sonic 1, and of course sonic 2. You need menuscreen: and menuscreen_options: I think it is, and then port the art for the bg and maybe the text and convert the code. Obviously when I had a problem I posted my code and a load of people snatch the code for themselves and then expected me to fix it for them? not going down that route again....


    Edit: If you succeed, I would hope you customize it to make it more original, getting a bit tired of the same options being ported.. but its a good place to understand how it was done.
     
    Last edited by a moderator: Jul 19, 2010
  3. theocas

    theocas #! Member

    Joined:
    Apr 10, 2010
    Messages:
    375
    But the issue is what are the Sonic 1 equivalents of those adresses?
     
  4. Animemaster

    Animemaster Lets get to work! Member

    Joined:
    Mar 20, 2009
    Messages:
    1,229
    Location:
    UK
    Like I said in s2.asm look at the top, here is and example:


    ; RAM variables


    RAM_Start(sonic 2) = ramaddr( $FFFF0000 ) (sonic 1)


    Metablock_Table(sonic 2) = ramaddr( $FFFF0000 ) (sonic 1)
     
  5. theocas

    theocas #! Member

    Joined:
    Apr 10, 2010
    Messages:
    375
    I see now. I now need what Options_menu_box should be in Sonic 1. Can I just pick any free RAM adress, or does it have to be a specific one? ALso what about the Menu Text? It uses the charset command, and there doesn't seem to be something with the same use in ASM68K.
     
    Last edited by a moderator: Jul 19, 2010
  6. theocas

    theocas #! Member

    Joined:
    Apr 10, 2010
    Messages:
    375
    Sorry for the double post, but I got moar stuff working. This is what it looks like:


    [​IMG]


    I know the background is the right mappings, but I am confused why it loads that kind of strange art. I have loaded the art all before doing the options menu stuff. Is it possible that I have to clear the VRAM first?


    Get a test ROM here.


    EDIT: if you need the source, please PM me.
     
    Last edited by a moderator: Jul 20, 2010
  7. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    The art is loaded into the incorrect location of V-Ram, not loaded at all, or the mappings are incorrect, either way the mappings are not in co-ordination with the art tiles which explains the oddness looking of the Sonic 2 options screen.
     
    Last edited by a moderator: Jul 20, 2010
  8. theocas

    theocas #! Member

    Joined:
    Apr 10, 2010
    Messages:
    375
    That's just what I suspected. So can this be corrected by changing the line above the loading for the art? I mean this line for example:



    move.l #$42000000,($C00004).l



    I guess then I would need to change the mappings as well? I did omit loading of some Level-Select related data, such as the icons. If you're wondering, the files are straight from a Sonic 2 disasm, and this is the loading part of my code:



    OptionsMenu:
    bsr.w Pal_FadeFrom


    move #$2700,sr


    move.w ($FFFFF60C).w,d0


    andi.b #-$41,d0


    move.w d0,($C00004).l


    bsr.w ClearScreen


    lea ($C00004).l,a6


    move.w #$8004,(a6)


    move.w #$8230,(a6)


    move.w #$8407,(a6)


    move.w #$8230,(a6)


    move.w #$8700,(a6)


    move.w #$8C81,(a6)


    move.w #$9001,(a6)


    move.l #$42000000,($C00004).l


    lea (Menu_Font).l,a0


    bsr.w NemDec


    move.l #$4E000000,($C00004).l


    lea (ArtNem_MenuBox).l,a0


    bsr.w NemDec


    lea ($FFFF0000).l,a1


    lea (Menu_Mappings).l,a0


    move.w #$6000,d0


    bsr.w EniDec


    lea ($FFFF0000).l,a1


    move.l #$60000003,d0


    moveq #$27,d1


    moveq #$1B,d2


    moveq #$14, d0


    bsr PalLoad1


    bsr.w JmpTo_ShowVDPGraphics



    After that the contents of MenuScreen_Options come. In the Sonic 2, it does a jump to the routine, and then some more code which doesn't seem to matter for the Options menu at all, but I could be wrong.
     
  9. theocas

    theocas #! Member

    Joined:
    Apr 10, 2010
    Messages:
    375
    OK, I got a tiny bit further with the code, but Selection is still broken. Here's a quick vid showing that all off:


    ">" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344">


    The new ROM is right here. I think there must be an infinite loop somewhere, but at least all the mappings seems to be correct. I just screwed with the location the data is saved to. The background is still broken because I can't seem to find Sonic 1's equivalent of Dynamic_Normal. I am just totally confused again. I've played with the code for a rather long time, but no dice. As always, PM me for the code if you want to look at it.
     
  10. Animemaster

    Animemaster Lets get to work! Member

    Joined:
    Mar 20, 2009
    Messages:
    1,229
    Location:
    UK
    If you don't have dynamic_normal then port it from sonic 2.
     
  11. theocas

    theocas #! Member

    Joined:
    Apr 10, 2010
    Messages:
    375
    Yeah but I want to get the selection worked out first. There seems to be an infinite loop somewhere I suppose. I did look at the code that reads buttons, did some changes to it, but not even start worked, which makes me think that routine never gets called. Stupid it's so difficult to debug this crap. Is there a Mac build of Gens with debug tools?
     
  12. IWasAPerson

    IWasAPerson Part Of This Complete Breakfast Member

    Joined:
    Aug 18, 2008
    Messages:
    22
    I had a similar problem with the controller when I ported the options menu to s1. Go look at your code again. Is the RAM address $FFFFF605 loaded at all (to d0, specifically)? That's the specific flag that checks to see whether a button has been pressed or not (sry if you knew this already), and what you're looking for here. Run your code against the S2 code and see if the times where that flag shows up matches up with your code.
     
  13. theocas

    theocas #! Member

    Joined:
    Apr 10, 2010
    Messages:
    375
    No, that flag is never loaded. The only ones that are ever loaded are $FFFFF602 and $FFFFF603. Is it possible that that is part of my problem?


    EDIT: I found 2 occurences in the S2 code that are in my port, but have the wrong address. I did replace both with $FFFFF605 but still no dice. If it does help, for Dynamic_Normal I simply put this:




    nop


    rts
     
    Last edited by a moderator: Jul 20, 2010
Thread Status:
Not open for further replies.