Basic Questions and Answers Thread

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

  1. TheInvisibleSun

    TheInvisibleSun Visible Member

    Joined:
    Jul 2, 2013
    Messages:
    424
    Location:
    Western New York, USA
    [The word is spelled 'Palette'.]

    What did you try with the LZ 4 code? You should be able to create a check for MZ4, just like the base game does for LZ 4, under LevelDataLoad.
     
  2. RouRouRou

    RouRouRou Ain't no fun if the aliens can't have none. Member

    Joined:
    Nov 20, 2016
    Messages:
    97
    I tried to change the check for LZ4 to MZ4, but not under LevelDataLoad.
    I also tried to create another check for MZ4, but it didn't work.

    Also, are you talking about Git, or Hivebrain?

    Anyway, I'll try again, but I really don't feel like continuing with this level.
    Guess things like this are why most of my ambition died late this year.
     
  3. TheInvisibleSun

    TheInvisibleSun Visible Member

    Joined:
    Jul 2, 2013
    Messages:
    424
    Location:
    Western New York, USA
    I personally use Git. In Hivebrain, I believe the routine is called MainLoadBlockLoad.
     
  4. B. Comet

    B. Comet Is fun still infinite? Member

    Joined:
    Aug 19, 2016
    Messages:
    83
    Location:
    South America Zone
    I can't seem to find said guide, you remember the name or have a link to it?
     
  5. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
  6. RouRouRou

    RouRouRou Ain't no fun if the aliens can't have none. Member

    Joined:
    Nov 20, 2016
    Messages:
    97
    @TheInvisibleSun Late reply, but thanks, it worked out. I may post a pic later.
     
  7. Panduhman02

    Panduhman02 Newcomer In Limbo

    Joined:
    Dec 2, 2018
    Messages:
    10
    Location:
    Cybertron
    Hi there. I'm working on a sonic 2 rom hack and I'm trying to make it as close to mania as possible. So, I have a question. How does one go about adding the dropdash in sonic 2's asm?

    This is the disassembly I'm using (if anyone wants to know...):

    https://github.com/sonicretro/s2disasm?files=1
     
  8. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    TheInvisibleSun likes this.
  9. Deactivated Account

    Deactivated Account Well-Known Member Exiled

    Joined:
    Aug 26, 2016
    Messages:
    244
    Hello! Someone knows how to edit the tone of PSG Square Wave under C4 note? I have an issue with a B.O.B song with the PSG channel 11 and 12 with the note and I cannot find how to edit the tone of the PSG.
    Thank you.
     
  10. Panduhman02

    Panduhman02 Newcomer In Limbo

    Joined:
    Dec 2, 2018
    Messages:
    10
    Location:
    Cybertron
    Okay, thanks anyways...
     
  11. RouRouRou

    RouRouRou Ain't no fun if the aliens can't have none. Member

    Joined:
    Nov 20, 2016
    Messages:
    97
    Oh great, it's me again.

    Anyway, I'll cut to the chase.
    I've drastically increased the size of the drop at the start of Scrap Brain Zone Act 3, and Sonic's standing animation just won't cut it anymore.

    I tried to make a check to see whether it was SBZ3, but as usual I failed.
    That's why I'm here asking for help again.
    Sorry if it's annoying by now.

    Thanks in advance.
     
  12. TheInvisibleSun

    TheInvisibleSun Visible Member

    Joined:
    Jul 2, 2013
    Messages:
    424
    Location:
    Western New York, USA
    You should get in the habit of posting code for the things you've tried. It helps people help you.

    However, I can say that when I did this for my hacks, I changed the Dynamic Level Events for the relevant level so that, within a certain screen positioning, Sonic is forced into his falling animation. When Sonic is out of this screen range, the code moves on to the next routine (which no longer overrides the animation).
     
    RouRouRou and AkumaYin like this.
  13. RouRouRou

    RouRouRou Ain't no fun if the aliens can't have none. Member

    Joined:
    Nov 20, 2016
    Messages:
    97
    Alright, thanks for the advice.

    I think now I'm going to worry about working on layouts, but I may try again at some point.
     
  14. CreepyMystery

    CreepyMystery Reminiscence and Semblance Member

    Joined:
    Oct 20, 2017
    Messages:
    36
    Edit: This is solved again, trash this if you please.
     

    Attached Files:

    Last edited: Dec 29, 2018
  15. TheInvisibleSun

    TheInvisibleSun Visible Member

    Joined:
    Jul 2, 2013
    Messages:
    424
    Location:
    Western New York, USA

    Progress update:

    Special Stage working HUD.PNG

    After reading these more carefully, and rigorously tinkering around, I've gotten the ring counter to be somewhat functional (thanks again to all who responded, especially MJ).

    Some observations/process notes:

    -Since my special stages don't constantly rotate, I was able to save a ton of VRAM space by reducing that art to just the first 9 tiles. This allows for the sufficient space needed (although there are still some graphical problems occurring in the bubble art for some reason.)

    -Although I edited the new Special Stage's HUD art to only include 'RINGS', I didn't account for the the sprite for the numbers in the mapping file (since SonMapEd doesn't/can't load the numbers at the same time), so when calling Hud_Base in the special stage init code, it would only show garbage. By changing the sprite count to '3' rather than '2' in the map file, I was able to display the '0', but no other numbers.

    -I experimented further, and found that what Firerat meant, was to add Hud_Update to Vbla_0A, the routine that the special stages use (Git disassembly), because it does not call for it already, like in the normal stages. I then set the f_ringcount flag to '1' prior to the Special Stage's looping routine.

    -Although I could not get more numbers to load, I decided to create a duplicate Hud_Update routine for the special stages, and edited it to trim out anything unneeded:

    Code:
    ; ---------------------------------------------------------------------------
    ; Subroutine to    update the Special Stage HUD
    ; ---------------------------------------------------------------------------
    
    ; ||||||||||||||| S U B    R O U T    I N E |||||||||||||||||||||||||||||||||||||||
    
    hudVRAM:    macro loc
            move.l    #($40000000+((loc&$3FFF)<<16)+((loc&$C000)>>14)),d0
            endm
    
    
    HUD_UpdateSS:
            tst.w    (f_debugmode).w    ; is debug mode    on?
            bne.w    HudDebug    ; if yes, branch
            tst.b    (f_ringcount).w    ; does the ring    counter    need updating?
            beq.s    FinishHUD1    ; if not, branch
            ;bpl.s    @notzero
            ;bsr.w    Hud_LoadZeroSS    ; reset rings to 0 if Sonic is hit
    
        @notzero:
            clr.b    (f_ringcount).w
            hudVRAM    $2F60        ; set VRAM address
            moveq    #0,d1
            move.w    (v_rings).w,d1    ; load number of rings
            bsr.w    Hud_RingsSS
    
        FinishHUD1:
            rts  
    ; ===========================================================================
    
    HudDebugSS:                ; XREF: HUD_Update
            bsr.w    HudDb_XY
            tst.b    (f_ringcount).w    ; does the ring    counter    need updating?
            beq.s    FinishHUD2    ; if not, branch
            bpl.s    @notzero
            bsr.w    Hud_LoadZeroSS    ; reset rings to 0 if Sonic is hit
    
        @notzero:
            clr.b    (f_ringcount).w
            hudVRAM    $2F60        ; set VRAM address
            moveq    #0,d1
            move.w    (v_rings).w,d1    ; load number of rings
            bsr.w    Hud_RingsSS
    
        FinishHUD2:
            rts  
    ; End of function HUD_Update
    
    ; ---------------------------------------------------------------------------
    ; Subroutine to    load "0" on the    HUD
    ; ---------------------------------------------------------------------------
    
    ; ||||||||||||||| S U B    R O U T    I N E |||||||||||||||||||||||||||||||||||||||
    
    
    Hud_LoadZeroSS:                ; XREF: HUD_Update
            locVRAM    $2F60
            lea    Hud_TilesZeroSS(pc),a2
            move.w    #2,d2
            bra.s    SSloc_1C83E
    ; End of function Hud_LoadZeroSS
    
    ; ---------------------------------------------------------------------------
    ; Subroutine to    load uncompressed HUD patterns ("E", "0", colon)
    ; ---------------------------------------------------------------------------
    
    ; ||||||||||||||| S U B    R O U T    I N E |||||||||||||||||||||||||||||||||||||||
    
    
    Hud_BaseSS:                ; XREF: GM_Level; SS_EndLoop; GM_Ending
            lea    ($C00000).l,a6
            ;bsr.w    Hud_Lives
            locVRAM    $2C60
            lea    Hud_TilesBaseSS(pc),a2
            move.w    #$E,d2
    
    SSloc_1C83E:                ; XREF: Hud_LoadZeroSS
            lea    Art_Hud(pc),a1
    
    SSloc_1C842:
            move.w    #$F,d1
            move.b    (a2)+,d0
            bmi.s    SSloc_1C85E
            ext.w    d0
            lsl.w    #5,d0
            lea    (a1,d0.w),a3
    
    SSloc_1C852:
            move.l    (a3)+,(a6)
            dbf    d1,SSloc_1C852
    
    SSloc_1C858:
            dbf    d2,SSloc_1C842
    
            rts  
    ; ===========================================================================
    
    SSloc_1C85E:
            move.l    #0,(a6)
            dbf    d1,SSloc_1C85E
    
            bra.s    SSloc_1C858
    ; End of function Hud_BaseSS
    
    ; ===========================================================================
    Hud_TilesBaseSS:    dc.b $16, $FF, $FF, $FF, $FF, $FF, $FF,    0, 0, $14, 0, 0
    Hud_TilesZeroSS:    dc.b $FF, $FF, 0, 0
    ; ---------------------------------------------------------------------------
    ; Subroutine to    load debug mode    numbers    patterns
    ; ---------------------------------------------------------------------------
    
    ; ||||||||||||||| S U B    R O U T    I N E |||||||||||||||||||||||||||||||||||||||
    
    
    HudDb_XYSS:                ; XREF: HudDebug
            locVRAM    $2C60        ; set VRAM address
            move.w    (v_screenposx).w,d1 ; load camera x-position
            swap    d1
            move.w    (v_player+obX).w,d1 ; load Sonic's x-position
            bsr.s    SSHudDb_XY2
            move.w    (v_screenposy).w,d1 ; load camera y-position
            swap    d1
            move.w    (v_player+obY).w,d1 ; load Sonic's y-position
    ; End of function HudDb_XY
    
    
    ; ||||||||||||||| S U B    R O U T    I N E |||||||||||||||||||||||||||||||||||||||
    
    
    SSHudDb_XY2:
            moveq    #7,d6
            lea    (Art_Text).l,a1
    
    SSHudDb_XYLoop:
            rol.w    #4,d1
            move.w    d1,d2
            andi.w    #$F,d2
            cmpi.w    #$A,d2
            bcs.s    SSloc_1C8B2
            addq.w    #7,d2
    
    SSloc_1C8B2:
            lsl.w    #5,d2
            lea    (a1,d2.w),a3
            move.l    (a3)+,(a6)
            move.l    (a3)+,(a6)
            move.l    (a3)+,(a6)
            move.l    (a3)+,(a6)
            move.l    (a3)+,(a6)
            move.l    (a3)+,(a6)
            move.l    (a3)+,(a6)
            move.l    (a3)+,(a6)
            swap    d1
            dbf    d6,SSHudDb_XYLoop    ; repeat 7 more    times
    
            rts  
    ; End of function HudDb_XY2
    
    ; ---------------------------------------------------------------------------
    ; Subroutine to    load rings numbers patterns
    ; ---------------------------------------------------------------------------
    
    ; ||||||||||||||| S U B    R O U T    I N E |||||||||||||||||||||||||||||||||||||||
    
    
    Hud_RingsSS:                ; XREF: HUD_Update
            lea    (Hud_100).l,a2
            moveq    #2,d6
            bra.s    Hud_LoadArtSS
            rts
    ; End of function Hud_RingsSS
    
    ; ---------------------------------------------------------------------------
    ; Subroutine to    load score numbers patterns
    ; ---------------------------------------------------------------------------
    
    ; ||||||||||||||| S U B    R O U T    I N E |||||||||||||||||||||||||||||||||||||||
    
    
    Hud_LoadArtSS:
            moveq    #0,d4
            lea    Art_Hud(pc),a1
    
    Hud_ScoreLoopSS:
            moveq    #0,d2
            move.l    (a2)+,d3
    
    SSloc_1C8EC:
            sub.l    d3,d1
            bcs.s    SSloc_1C8F4
            addq.w    #1,d2
            bra.s    SSloc_1C8EC
    ; ===========================================================================
    
    SSloc_1C8F4:
            add.l    d3,d1
            tst.w    d2
            beq.s    SSloc_1C8FE
            move.w    #1,d4
    
    SSloc_1C8FE:
            tst.w    d4
            beq.s    SSloc_1C92C
            lsl.w    #6,d2
            move.l    d0,4(a6)
            lea    (a1,d2.w),a3
            move.l    (a3)+,(a6)
            move.l    (a3)+,(a6)
            move.l    (a3)+,(a6)
            move.l    (a3)+,(a6)
            move.l    (a3)+,(a6)
            move.l    (a3)+,(a6)
            move.l    (a3)+,(a6)
            move.l    (a3)+,(a6)
            move.l    (a3)+,(a6)
            move.l    (a3)+,(a6)
            move.l    (a3)+,(a6)
            move.l    (a3)+,(a6)
            move.l    (a3)+,(a6)
            move.l    (a3)+,(a6)
            move.l    (a3)+,(a6)
            move.l    (a3)+,(a6)
    
    SSloc_1C92C:
            addi.l    #$400000,d0
            dbf    d6,Hud_ScoreLoopSS
    
    
            rts  
    
    ; End of function Hud_ScoreSS
    

    -This did not work, so I again tried to add the newly created subroutine (edited from Markey Jester's post) to count the numbers in the Special Stage Loop:

    Code:
    ; ---------------------------------------------------------------------------
    ; Subroutine to    load ringcount in Special Stages
    ; ---------------------------------------------------------------------------
    
    ; ||||||||||||||| S U B    R O U T    I N E |||||||||||||||||||||||||||||||||||||||
    
    
    SSRing_HudNumbers:
            lea    ($C00000).l,a6        ; load VDP data port address to a6
            move.l    #$5F400003,d0        ; prepare VDP VRAM write mode and address
            moveq    #$00,d1            ; clear d1 (clears entire long-word)
            move.w    (v_rings).w,d1    ; load number of rings Sonic has to the lower word of d1
            locVRAM    $2F60
            jsr    Hud_RingsSS        ; convert hex to decimal, and dump the number art to VRAM address in d0
            rts
    This subroutine did not work either, so I was a bit unsure of what was going on. Initially I attempted a few combinations of both to no avail, but when I called for both routines within particular subroutines ('Hud_UpdateSS' in 'Vbla_0A', and 'SSRing_HudNumbers' in 'SS_MainLoop'), it worked. When testing the rom (in Regen), however, I would get a crash after getting around 30-ish rings. So then I moved Hud_UpdateSS to run directly after the 'WaitforVbla' instruction and it functions without crashing:


    Code:
    SS_NoDebug:
            move.w    (v_vdp_buffer1).w,d0
            ori.b    #$40,d0
            move.w    d0,(vdp_control_port).l
            move.b    #1,(f_ringcount).w ; update rings counter
            bsr.w    PaletteWhiteIn
    
    ; ---------------------------------------------------------------------------
    ; Main Special Stage loop
    ; ---------------------------------------------------------------------------
    
    SS_MainLoop:
            bsr.w    PauseGame
            move.b    #$A,(v_vbla_routine).w
            bsr.w    WaitForVBla
            jsr    HUD_UpdateSS
            bsr.w    MoveSonicInDemo
            move.w    (v_jpadhold1).w,(v_jpadhold2).w
           
            jsr    SSRing_HudNumbers
            jsr    ExecuteObjects
            jsr    BuildSprites
            jsr    SS_ShowLayout
    The odd thing now, is that it doesn't seem to count every ring; it sort of 'skips' for some reason, as if it's updating slower than how often I collect rings. Anybody have any insight on why this is happening? (I'm probably being rather sloppy with my code) [EDIT:] Removing the ringcount check from Hud_UpdateSS seems to do the trick, but this may just be a 'band-aid' measure, and not the best solution.

    Other than that, (and some minor graphical issues), it works! Thanks again for the patient responses and help.
     
    Last edited: Dec 29, 2018
  16. Tanman Tanner

    Tanman Tanner Well-Known Member Member

    Joined:
    Dec 23, 2016
    Messages:
    116
    Location:
    Buffalo, New York
    I'm back with a new compiler for the Sonic 1 GitHub Repo, and new errors that are confusing me!
    Here's the error log:
    Code:
    > > >sonic.asm(68): error: variables cannot be redefined as constants
    > > > DATE
    > > > Date:        dc.b "(C)SEGA 1991.APR" ; Release date
    > > >sonic.asm(412) LOCVRAM(1): error: expression must be evaluatable in first pass
    > > >                 if (narg=1)
    > > >: error: missing ENDIF/ENDCASE
    > > >
    
    The source code up to this point:
    https://gist.github.com/TannerGhosen/01f10db3b8a06e77e62033d70474a62c
    To be clear, I used a different compiler basing off of another repo that used the Sonic 2 Clone Driver for Sonic 1, and it compiled with the settings it defined. All I know is that it has a lot less errors than before.
    EDIT: I also slightly altered my code to match what was done in that repo, altering endcs to endifs and all that jazz.
    I don't know what or why @Clownacy, but the compiler that comes with these GitHub repos just do NOT like your clone driver.
    EDIT 2: Just a rant, why does this dude's repo use 16-128 maps instead of the normal 256? Is there a big difference between the two?
    EDIT 3: EDIT Glore! Anyhow, the clone driver does compile without errors, it's the sonic.asm that errors out as far as the compiler is concerned, and it fully executes them.
     
    Last edited: Dec 31, 2018
  17. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,016
    The installation guide does say...
    Also it's called an 'assembler', not a 'compiler'.
     
    Tanman Tanner and maple_t like this.
  18. Ollie_Ollie_TechDeck

    Ollie_Ollie_TechDeck Newcomer Trialist

    Joined:
    Jan 2, 2019
    Messages:
    5
    Could you teach me how to put your clone driver in my ROM, please?
     
    TheStoneBanana and MarkeyJester like this.
  19. Tanman Tanner

    Tanman Tanner Well-Known Member Member

    Joined:
    Dec 23, 2016
    Messages:
    116
    Location:
    Buffalo, New York
    http://forums.sonicretro.org/index.php?showtopic=32801

    Unrelated to this:
    I want to edit the level order for Sonic 1, but I found out that the file I need to edit is a .bin file (Level Order.bin). This is probably a dumb question with an obvious answer, but what program am I looking at to open this up and alter the hex code that's in it?
     
  20. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922