Basic Questions and Answers Thread

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

  1. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    530
    Location:
    France
    Hi!
    I just finished the 4 parts of the Sonic Retro guide to importing the spindash into sonic 1.

    I'm using the latest Github version, so I had to make the code adaptations in the 2nd, 3rd and 4th part of the guide.

    The problem is that the sound of the spindash continues to be played indefinitely, here a demo video.

    It never happened before. I'm familiar with the Hivebrain version but not Github. Someone can help me? Thank you very much.


     
  2. Psycho RFG

    Psycho RFG Well-Known Member Member

    Joined:
    Feb 22, 2011
    Messages:
    230
    Does it happens in all levels?
    Looking at the vide It seems that you are using the waterfall sound ID. So you can use another sound ID or remove the waterfall sound object of GHz.
     
  3. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    530
    Location:
    France
    I tested it in Marble Zone and it didn't happen.

    Oh, yes, i guess I hadn't noticed, but it actually happens when the Waterfall sound is being played. Thank you!
     
    MarkeyJester likes this.
  4. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    530
    Location:
    France
    Okay, i've searched everywhere. Can't to find anything about it. My game crash when i'm jumping in any levels, even in the special stage.

    Edit: Okay, i figured out that the crash occurs when the SFX "Jump" is played.
    (I tested to replace "sfx_jump" with "sfx_lampost" in SonicJump.asm and the game hasn't crashed.
     
    Last edited: Feb 22, 2020
  5. Samey

    Samey Le Bored Hedgie Member

    Joined:
    May 3, 2017
    Messages:
    40
    So in Sonic 1 (Hivebrain Disassembly) I'm looking for a way to clear Vram before loading a level.
    I want to do this so I can see the empty spots in Vram (like if I wanted to add smthn) but I haven't really been able to find a way to do this.

    Anyone know a way?
     
  6. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    879
    You can do a DMA Fill operation on the entire VRAM. You may need to reload PLC 0 afterwards, IIRC it's only loaded once at startup.
     
    ProjectFM and MarkeyJester like this.
  7. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,821
    Right here.

    This'll go after the "move #$2700,sr" in the "Level:" routine:

    Code:
    		lea	($C00004).l,a6				; load VDP address port to a6
    		move.l	#$8F019780,(a6)				; set increment mode & DMA source
    		move.l	#$94FF93DF,(a6)				; set DMA size
    		move.l	#$40200080,(a6)				; set DMA destination
    		move.w	#$FFFF,-$04(a6)				; fill location with F's
    
    Level_WipeVRAMWait:
    		move.w	(a6),ccr				; load VDP flag to "v" flag
    		bvs.s	Level_WipeVRAMWait			; if still busy with DMA, loop
    		move.w	#$8F02,(a6)				; set increment mode to normal
    		moveq	#$00,d0					; set to reload the HUD/Ring patterns
    		bsr.w	LoadPLC2				; ''
    
    Level_WaitPLC:
    		move.b	#$04,($FFFFF62A).w			; set v-blank routine
    		bsr.w	DelayProgram				; wait for v-blank
    		bsr.w	RunPLC_RAM				; allow PLC to function
    		tst.l	($FFFFF680).w				; are there any PLC items to load?
    		bne.s	Level_WaitPLC				; if so, loop until finished
    This will fill VRAM from 0020 to FFFF with "'F" (yellow) pixels if you use Sonic's palette line, making it easy to spot where the missing tiles are, it'll also distinguish intentionally blank tiles (if any).
     
    Last edited: Feb 28, 2020
  8. Tanman Tanner

    Tanman Tanner Well-Known Member Member

    Joined:
    Dec 23, 2016
    Messages:
    85
    Location:
    Buffalo, New York
    If I can recall, The closest thing Sonic 1 does to clearing VRAM is filling VRAM with 0's when you open up level select via the label Title_ClrVRAM. This is what MainMemory is refering to, I believe.
    This is the code for that.
    Code:
    Title_ClrVram:
           move.l   d0,(a6) ; sets to 0
           dbf   d1,Title_ClrVram ; fill   VRAM with 0
    
           bsr.w   LevSelTextLoad
    
    So most likely, a way to clear VRAM would be to do something like this:
     
    Last edited: Feb 27, 2020
  9. Ralakimus

    Ralakimus Sonic is a shit franchise :V Member

    Joined:
    Aug 26, 2013
    Messages:
    1,016
    Location:
    idk hell?
    While, yes, that works, that's not a DMA fill, that's a manual fill. A DMA fill that clears VRAM would look more like this:
    Code:
        lea    $C00004,a5        ; VDP control port
        move.w #$8F01,(a5)       ; Autoincrement VDP address by 1 after every write
    
        move.l #$94FF93FF,(a5)   ; DMA length $10000 (minus 1)
        move.w #$9780,(a5)       ; Set DMA mode to "fill"
        move.l #$40000080,(a5)   ; DMA at VRAM address $0000
        move.w #$0000,-4(a5)     ; Set to fill with $00 (set in VDP data port) and start the DMA
    
    @WaitDMA:
        move.w (a5),d1           ; Wait for DMA to finish
        btst   #1,d1
        bne.s  @WaitDMA
    
        move.w #$8F02,(a5)       ; Restore autoincrement back to 2
    ClearScreen does this similarly when clearing out the plane data in VRAM.
     
    Last edited: Feb 28, 2020
  10. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,821
    I'm sorry, but is my post invisible? >=(
     
    Last edited: Feb 28, 2020
    Joshwoakes and AURORA☆FIELDS like this.
  11. Iso Kilo

    Iso Kilo Sonic 1 Beta Researcher Member

    Joined:
    Oct 9, 2017
    Messages:
    208
    Location:
    Small Town in BC, Canada
    So I tried this, but,
    Code:
            moveq    #$00,d0                    ; set to reload the HUD/Ring patterns
            bsr.w    LoadPLC2
    Causes the game to hang.
     
    MarkeyJester likes this.
  12. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,821
    I beg your pardon, there was a part of the original post I forgot to copy from 7 years ago, edited d=
     
    Iso Kilo likes this.
  13. Ralakimus

    Ralakimus Sonic is a shit franchise :V Member

    Joined:
    Aug 26, 2013
    Messages:
    1,016
    Location:
    idk hell?
    Ah, I missed it. My bad.
     
    MarkeyJester likes this.
  14. Samey

    Samey Le Bored Hedgie Member

    Joined:
    May 3, 2017
    Messages:
    40
    Woah thanks Markey!
    Exactly what I needed!

    Also wow, Marble Zone has alot of free empty space
     
  15. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,779
    Location:
    italy
    It's just my speculation, but maybe that free space was allocated for the UFOs.

    When they ditched the UFOs, they probably used some VRAM for other things, but some free space remained.

    Again, just a guess.
     
    MarkeyJester likes this.
  16. Samey

    Samey Le Bored Hedgie Member

    Joined:
    May 3, 2017
    Messages:
    40
    Yeah that's what I was thinking too.

    I was going to actually use the empty space for the UFOs when I actually got around to it :p
     
  17. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,821
    There are blank blocks in the background of MZ's clouds, which reference blank tiles in incremental order, rather than referencing tile 0. So I suspect you'd be right.
     
  18. MGHACKS

    MGHACKS Uh.... meow? Member

    Joined:
    Aug 7, 2019
    Messages:
    126
    Location:
    Somewhere far from Sonic fanboys
    Is there a way to use different music when porting the Sonic 3 driver to Sonic 1?

    I've seen some hacks doing this where they still used the Sonic 3 sound driver but changed the music. Since all music files come out as .smd, I wasn't sure to replace or leave the default Sonic 3 music.
     
  19. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,779
    Location:
    italy
    Most (if not all?) the SMPS converters output songs in the Sonic 1 format, but nothing prevents you from converting them to the Sonic 3 format afterwards, although at that point of course you'll have to deal with banks, pointers, and whatnot.

    Or, you can use FlameWing's Driver and smps2asm.
     
    Last edited: Feb 29, 2020
    ProjectFM likes this.
  20. MGHACKS

    MGHACKS Uh.... meow? Member

    Joined:
    Aug 7, 2019
    Messages:
    126
    Location:
    Somewhere far from Sonic fanboys
    It is just SMPSConv by ValleyBell you know or are there more?

    I'm saying this because I want to easily convert music from other Genesis games such as The Hybrid Front and Ristar, but SMPSConv doesn't support .smz or .smy files.
     
    Last edited: Feb 29, 2020