Sonic 2's level select in Sonic 1

Discussion in 'Approved' started by PsychoSk8r, Feb 23, 2009.

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

    PsychoSk8r HighKnights Member

    Joined:
    Aug 9, 2007
    Messages:
    271
    Location:
    Birmingham, UK
    This guide was originally written by Esrael, though it was made for the Outdated disassembly by DRX, so credit also goes to Esrael.


    This guide was designed for use with Snasm68k (v2.1D) =P


    Firstly, make a back-up of all your current work.


    Secondly, open sonic1.asm, and go to Title_ChkLevSel, replace it with:



    Title_ChkLevSel:
    tst.b ($FFFFFFE0).w; check if level select asm is on


    beq.w PlayLevel; if not, play level


    jmp Level_Select_Menu; Go to Sonic 2 Level Select


    moveq #2,d0


    bsr.w PalLoad2; load level select pallet


    lea ($FFFFCC00).w,a1


    moveq #0,d0


    move.w #$DF,d1


    rts



    Then, go to endofrom, and before that, add the following lines:



    s2_menuasm:
    include 's2_menu.asm'



    Now, open up _inc/Pallet Pointers.asm, and underneath



    dc.l Pal_Ending
    dc.w $FB00


    dc.w $1F



    add the following:



    dc.l Menu_Palette; pallet address
    dc.w $FB00 ; RAM address


    dc.w $1F ; (pallet length / 2) - 1



    Finally, extract this file into the same directory as sonic1.asm


    ------------


    Some people not using Snasm68k get the following error:



    Code:
    SN 68k version 2.53
    
    
    
    C:\USERS\INFINITI\DESKTOP\S1 - COPY\S2_MENU.ASM(125) : Error : Illegal value (64
    
    416)
    
    lea $fba0(a2),a2
    
    Errors during pass 1 - pass 2 aborted
    
    Assembly completed.
    
    1 error(s) from 48844 lines in 0.17 seconds
    
    Lightning's ROM Padder
    So to fix that, go to line 125 in S2_MENU.ASM and replace



    lea $FBA0(A2), A2


    with
    Code:
    lea     $FFFFFBA0(A2), A2
    

    Expect more guides as I learn more. =P
     
    Last edited by a moderator: Oct 21, 2010
    Nat The Porcupine likes this.
  2. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    This is just awesome! But there is one thing, I can't get:

    You know, the code under the jmp will be ignored, so why are you keep it there? Also, you just added the jmp line, so "replace" isn't the right word, it'll be much better, when you call it "Add this line (~the jmp line~) under the beq.w line and delete the code under it (to the rts)." or something like that.


    Just a few ideas. =P
     
  3. PsychoSk8r

    PsychoSk8r HighKnights Member

    Joined:
    Aug 9, 2007
    Messages:
    271
    Location:
    Birmingham, UK
    Yeah, i'm just a little lazy =P
     
  4. hyper

    hyper Newcomer Trialist

    Joined:
    Aug 25, 2008
    Messages:
    5
    Location:
    France, near Paris
    Hello I have a small bug with soundtest


    I play sound : 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13


    bug at 14 I have : illagal instruction$9091A44B


    Please help me and your tutorial is Great !!! B)


    Sorry for Bad grammar Because i'm French
     
  5. hyper

    hyper Newcomer Trialist

    Joined:
    Aug 25, 2008
    Messages:
    5
    Location:
    France, near Paris
    Hello again I resolved my problem


    Just add a music in the slot 94
     
  6. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    Wrong Topic huh? You know, you have to post in the "Sonic Specific Modification" forum. :( Split please.
     
  7. Jimmy

    Jimmy "GIVE HIM BREAD FIST!" Member

    Joined:
    Apr 2, 2008
    Messages:
    41
    Location:
    Slough. England
    Not really. With the level select, tends to come a sounds test too =P The person from what I see was having a problem with that but figured it out.
     
    Last edited by a moderator: Feb 26, 2009
  8. PsychoSk8r

    PsychoSk8r HighKnights Member

    Joined:
    Aug 9, 2007
    Messages:
    271
    Location:
    Birmingham, UK
    Heh, i wouldn't of noticed this since I already have music in the slot. Thanks for pointing it out Hyper b^_^d
     
  9. Spanner

    Spanner The Tool Member

    Joined:
    Aug 9, 2007
    Messages:
    2,570
    *bump*


    An asterisk is missing on the level select screen, however it can be rectified by going to Menu_Clear_Act_x in s2_menu.asm and uncommenting the 2 lines after dbra D1, Menu_Clear_Act_x:



    lea $FFFFFF10(A2), A2
    move.w #$001A, (A2) ; Load "*"



    I added FFFF before FF10 in case it provided incompatibilities with ASM68K.
     
    Last edited by a moderator: Mar 29, 2009
  10. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    A few weeks ago someone was testing my hack on real hardware and helped me at fixing some bugs to make it work. However, then he said (something like this):


    "The S2 Level Select screen gives you an illegal instruction, but you can just press C to skip that. Not a big problem."


    Well right, not a big problem, but it still annoys me. So I decided to look through Esrael's code another time to find the problem, and I found it! Here's a simple guide:


    1. Open the file (s2_menu.asm) and make a search for Inicializa o contador das animações do menu (I don't know what the hell that means, but I think it's the easiest way to find that line.)


    You should see this:



    ;-------------------------------------------------------------------------------
    move.w #$0000,($FFFFF7B8).w ; Inicializa os quadros das animações do menu


    move.w #$0000,($FFFFF7B9).w ; Inicializa o contador das animações do menu


    jsr Dynamic_Menu ; Chama a rotina de animação


    ;-------------------------------------------------------------------------------



    You don't need much ASM knowledge to understand what's wrong here, but I'll explain the bug anyway: You can't clear odd RAM adresses using words or longwords (well, at least not on real hardware and some emulators).



    move.w #$0000,($FFFFF7B9).w ; Inicializa o contador das animações do menu


    This line causes the error.


    2. To fix that you can simply replace those two move.w lines with a single clr.l line, for example this:



    ;-------------------------------------------------------------------------------
    clr.l ($FFFFF7B8).w ; clear RAM adresses $F7B8 to $F7BA


    ; move.w #$0000,($FFFFF7B8).w ; Inicializa os quadros das animações do menu


    ; move.w #$0000,($FFFFF7B9).w ; Inicializa o contador das animações do menu


    jsr Dynamic_Menu ; Chama a rotina de animação


    ;-------------------------------------------------------------------------------



    After that the bug should be gone and the S2 screen should completly work with real hardware.


    (Also, please don't tell me there are smarter/alternate ways, cause I know that myself.)
     
  11. EMK-20218

    EMK-20218 The Fuss Maker Exiled

    Joined:
    Aug 8, 2008
    Messages:
    1,067
    Location:
    Jardim Capelinha, São Paulo
    It means to Start the counter for the menu animations. :(
     
  12. Irixion

    Irixion Well-Known Member Member

    Joined:
    Aug 11, 2007
    Messages:
    670
    Location:
    Ontario, Canada
    I shall bump, but just thought I'd let everyone know that the link in OP is broken making this guide..not work. :>
     
  13. PsychoSk8r

    PsychoSk8r HighKnights Member

    Joined:
    Aug 9, 2007
    Messages:
    271
    Location:
    Birmingham, UK
    Yeah, I noticed. I don't have the original files either. (Though, I did recreate it, but it's now heavily modified, so that's no good for this guide).


    Though you can download Esrael's version, which is made for his disassembly, it just requires pointing subroutines to their sonic 1 equivalents, and it's a small, easy, good way to learn.
     
  14. Qjimbo

    Qjimbo Well-Known Member Member

    Joined:
    Feb 27, 2008
    Messages:
    850
    Location:
    Vancouver, BC
    Last edited by a moderator: Oct 21, 2010
  15. Mrmoonshining

    Mrmoonshining Newcomer In Limbo

    Joined:
    Dec 16, 2011
    Messages:
    10
    Location:
    argentina
    This Tutorial Is Amazing And Is Easy To Modify It In ASM Greetings !!!
     
Thread Status:
Not open for further replies.