How to implement an alternate Title Screen background layout (Sonic 1 Github AS/ASM68K)

Discussion in 'Tutorials' started by Thiago REzEnDe, Aug 2, 2024.

  1. Thiago REzEnDe

    Thiago REzEnDe Newcomer Prospect

    Joined:
    Sep 17, 2022
    Messages:
    10
    Location:
    Hill Valey, California
    Hello, this is my first tutorial, and i hope this one will be helpful to anyone. Are you just tired because you want to edit the title screen's background layout but you can't due to GHZ using the same layout? This is the tutorial for you. First of all, before we go straight up to the code, go to levels folder, make a copy of ghz1 and ghzbg and rename them to ts1 & tsbg. After that, open sonic.asm and search for LevelLayoutLoad. Next, below ; End of function LevelLayoutLoad2, paste this:

    TitleScreen_LayoutLoad:
    lea (v_lvllayout).w,a3
    move.w #$1FF,d1
    moveq #0,d0

    TitleScreen_ClrRam:
    move.l d0,(a3)+
    dbf d1,TitleScreen_ClrRam ; clear the RAM ($A400-A7FF)

    lea (v_lvllayout).w,a3 ; RAM address for title screen layout
    moveq #0,d1
    bsr.w TitleScreen_LayoutLoad2 ; load title screen layout into RAM
    lea (v_lvllayout+$40).w,a3 ; RAM address for background layout
    moveq #2,d1
    ; End of function TitleScreen_LayoutLoad

    ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||


    TitleScreen_LayoutLoad2:
    move.w (v_zone).w,d0
    lsl.b #6,d0
    lsr.w #5,d0
    move.w d0,d2
    add.w d0,d0
    add.w d2,d0
    add.w d1,d0
    lea (TitleScreen_Index).l,a1
    move.w (a1,d0.w),d0
    lea (a1,d0.w),a1
    moveq #0,d1
    move.w d1,d2
    move.b (a1)+,d1 ; load title screen width (in tiles)
    move.b (a1)+,d2 ; load title screen height (in tiles)

    TitLoad_NumRows:
    move.w d1,d0
    movea.l a3,a0

    TitLoad_Row:
    move.b (a1)+,(a0)+
    dbf d0,TitLoad_Row ; load 1 row
    lea $80(a3),a3 ; do next row
    dbf d2,TitLoad_NumRows ; repeat for number of rows
    rts
    Then, go to Level_GHZBG and below it, paste this:

    Level_TS1: incbin "levels\ts1.bin"
    even
    byte_689D70: dc.b 0, 0, 0, 0
    Level_TSbg: incbin "levels\tsbg.bin"
    even

    Finally, above Level_Index, paste this:

    TitleScreen_Index:
    dc.w Level_TS1-TitleScreen_Index, Level_TSbg-TitleScreen_Index, byte_689D70-TitleScreen_Index

    And Tadaa! you have an alternate title screen bg layout! you can now edit the bg with no problems!

    PS: When you complete this tutorial, you won't see any changes untill you modify it. And if i mistakenly did something wrong on the tutorial, let me know.

    EDIT: Fixed the thread's title.
    EDIT 2: Fixed up some writing issues.
     
    Last edited: Aug 2, 2024
    AleDrawer2008 and Nik Pi like this.