Basic Questions and Answers Thread

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

  1. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    Is the sonic 2 clone driver essentially just an optimized S1 driver with the necessary S2 music files added through megaPCM, or is it more complicated then that?
     
  2. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,020
    Being optimised has no part in it. Neither does MegaPCM, it doesn't interface with the music directly; it just handles what SMPS feeds it (the DAC track). The original Clone Driver used JMan's PCM driver for DAC, while v2 uses MegaPCM.

    At its core, both Clone Drivers are just S1's driver, with S2's music ported to it.
     
    Last edited by a moderator: Oct 1, 2014
  3. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    417
    Location:
    Town Creek, AL
    MegaPCM can use any DACs. I once had Sonic & Crackers DAC Samples added to it. Now I have S1 & S3K Samples to mine. I think Sonic 2's & Sonic 1's DACs are the same. The Majority of Sonic 2's Music I have In my Sonic 1 hack sounds as if it's Sonic 2's.

    Question regarding Sonic 1's Level Select.

    First off...


    Character equ $FFFFF601
    PlaylistEntry = $FFFFF603
    OptionSSFix = $FFFFF612

    Code:
    LevelSelect:
    		move.b	#1,(OptionSSFix)
    		move.b	#4,($FFFFF62A).w
    		bsr.w	DelayProgram
    		bsr.w	LevSelControls
    		bsr.w	RunPLC_RAM
    		tst.l	($FFFFF680).w
    		bne.s	LevelSelect
    		andi.b	#$F0,($FFFFF605).w ; is	A, B, C, or Start pressed?
    		beq.s	LevelSelect	; if not, branch
    		
    		;move.b	#1,(OptionSSFix).w
    		move.w	($FFFFFF82).w,d0
    		cmpi.w	#$03,d0		; have you selected item $03 (sound test)?
    		bne.w	LevSel_Level_SS;LevSelLevSel_Level_SS	; if not, go to	Level/SS subroutine
    		
    		move.w	($FFFFFF84).w,d0
    		addi.w	#$80,d0
    		
    			
    LevSel_NoCheat:	Move.b	#1,(OptionSSfix)
    		cmpi.w	#$A0,d0		; is sound $80-$94 being played?
    		bcs.s	LevSel_PlaySnd	; if yes, branch
    		cmpi.w	#$A0,d0		; is sound $95-$A0 being played?
    		bcs.w	LevelSelect	; if yes, branch
    
    LevSel_PlaySnd:
    		cmpi.b	#$A0,d0
    		blt	LevSel_NoSFX
    		subi.b	#$A0,d0
    ...
    
    Code:
    LevSelControls:			; XREF: LevelSelect
    		move.b	(v_jpadpress1).w,d1
    		andi.b	#btnUp+btnDn,d1		; is up/down pressed and held?
    		bne.s	LevSel_UpDown		; if yes, branch
    		subq.w	#1,(v_levseldelay).w	; subtract 1 from time to next move
    		bpl.w	LevSel_CHKsNDTEST	; if time remains, branch
    
    LevSel_UpDown:
    		move.w	#$B,(v_levseldelay).w	; reset time delay
    		move.b	(v_jpadhold1).w,d1
    		andi.b	#btnUp+btnDn,d1		; is up/down pressed?
    		beq.w	LevSel_ChkSndTest	; if not, branch
    		move.w	(v_levselitem).w,d0
    		btst	#bitUp,d1		; is up	pressed?
    		beq.s	LevSel_Down		; if not, branch
    		subq.w	#1,d0			; move up 1 selection
    		bhs.s	LevSel_Down
    		moveq	#$03,d0			; if selection moves below 0, jump to selection	$15
    
    LevSel_Down:
    		btst	#bitDn,d1		; is down pressed?
    		beq.s	LevSel_Refresh		; if not, branch
    		addq.w	#1,d0			; move down 1 selection
    		cmpi.w	#$04,d0
    		blo.s	LevSel_Refresh
    		moveq	#0,d0			; if selection moves above $15,	jump to	selection 0
    
    LevSel_Refresh:	
    		move.w	d0,(v_levselitem).w ; set new selection
    		bsr.w	LevSelTextLoad	; refresh text
    		move.l	#SoundCD,d0 ; selection blip sound
    		jsr	PlaySound
    		rts
    ; ===========================================================================
    
    LevSel_ChkSndTest: move.b	#1,(OptionSSFix).w	
    		tst.w	(v_levselitem).w	; is item $15 selected?
    		 	; if not, branch
    
    		bne.s	LevSel_Tracks; if not, branch
    		move.b	(v_jpadpress1).w,d1
    		andi.b	#btnR+btnL,d1		; is left/right	pressed?
    		beq.s	LevSel_NoMove		; if not, branch
    		move.w	(v_levselChar).w,d0
    		;move.w	(Character).w,d2
    			
    		btst	#bitL,d1		; is left pressed?
    		beq.s	LevSel_Right
    				; if not, branch
    		subq.w	#1,d0 	; subtract 1 from sound
    		bhs.s	LevSel_Right
    		moveq	#$02,d0
    		subq.b	#1,(Character).w; is suppose to subtract 1 from character	
    		tst.b	(character).w
    		bhs.s	LevSel_Right
    		
    		move.b	#2,(Character).w
    LevSel_Right:	
    		btst	#bitR,d1		; is right pressed?
    		beq.s	LevSel_Refresh2		; if not, branch
    		addq.w	#1,d0; add 1	to sound test
    		addq.b	#1,(Character).w	; is suppose to add 1 to character (sonic, Richter,Nebula)
    		cmpi.w	#$03,d0
    		blo.s	LevSel_Refresh2
    		moveq	#0,d0
    		cmpi.b	#$03,(Character).w
    		blo.s	LevSel_Refresh2
    		st.b	(Character).w
    		;moveq	#0,D2
    				; if sound test	moves below 0, set to $4F
    					; if sound test	moves above $4F, set to	0
    LevSel_Refresh2:
    		move.w	d0,(v_levselChar).w
    		;move.b	d2,(Character).w	; set sound test number
    		bsr.w	LevSelTextLoad
    		
    		move.l	#SoundCD,d0 ; selection blip sound
    		jsr	playsound
    LevSel_NoMove:
    
    		rts
    ; ===========================================================================
    
    
    ; End of function LevSelControls
    
    Levsel_Tracks:	move.b	#1,(OptionSSFix).w
    		cmpi.w	#$01,(v_levselitem).w	; is item $15 selected?
    		bne.s	LevSel_gOlEVEL	; if not, branch
    		move.b	(v_jpadpress1).w,d1
    		andi.b	#btnR+btnL,d1		; is left/right	pressed?
    		beq.s	LevSel_Tracks_NoMove		; if not, branch
    		move.w	(v_levselPlist).w,d0
    		
    			
    		btst	#bitL,d1		; is left pressed?
    		beq.s	LevSel_Tracks_Right
    				; if not, branch
    		subq.w	#1,d0 	; subtract 1 from sound
    		bhs.s	LevSel_Tracks_Right
    		subq.b	#1,(PlaylistEntry).w; is suppose to subtract 1 from character	
    		
    		bhs.s	LevSel_Tracks_Right
    		moveq	#$02,d0
    		;moveq	#$01,d2
    LevSel_Tracks_Right:	;sf.b 	d2	
    		btst	#bitR,d1		; is right pressed?
    		beq.s	LevSel_Refresh2		; if not, branch
    		addq.w	#1,d0; add 1	to sound test
    		addq.b	#1,(PlaylistEntry).w	; is suppose to add 1 to character (sonic, Richter,Nebula)
    		cmpi.w	#$03,d0
    		blo.s	LevSel_Tracks_Refresh2
    		cmpi.b	#$01,(PlaylistEntry).w
    		blo.s	LevSel_Tracks_Refresh2
    		moveq	#0,d0
    		;moveq	#0,D2
    				; if sound test	moves below 0, set to $4F
    					; if sound test	moves above $4F, set to	0
    LevSel_Tracks_Refresh2:
    		move.w	d0,(v_levselPlist).w
    		;move.b	d2,(Character).w	; set sound test number
    		bsr.w	LevSelTextLoad
    		
    		move.l	#SoundCD,d0 ; selection blip sound
    		jsr	playsound
    LevSel_Tracks_NoMove:
    
    		rts
    Levsel_GoLevel:	move.b	#1,(OptionSSFix).w
    		cmpi.w	#$02,(v_levselitem).w	;Is this the first choice?
    		bne.s	LevSel_CheckSoundTest 	; if not, branch
    		move.b	(v_jpadpress1).w,d1
    		andi.b	#joystart,d1		; is left/right	pressed?
    		beq.s	LevSel_NoMove_Level
    		;MOVE.B	#1,(Final)	; if not, branch
    	jmp	Level_Select_Menu	
    LevSel_NoMove_Level:
    		rts
    ; End of function LevSelControls
    LevSel_CheckSoundTest: move.b	#1,(OptionSSFix).w				; XREF: LevSelControls
    		cmpi.w	#$03,($FFFFFF82).w ; is	item $14 selected?
    		bne.s	LevSel_HPZ	; if not, branch
    	
    		move.b	($FFFFF605).w,d1
    		andi.b	#$C,d1		; is left/right	pressed?
    		beq.s	LevSel_chkNoMove	; if not, branch
    		move.w	($FFFFFF84).w,d0
    		btst	#2,d1		; is left pressed?
    		beq.s	LevSel_chkRight	; if not, branch
    		subq.w	#1,d0		; subtract 1 from sound	test
    		bcc.s	LevSel_chkRight
    		moveq	#$4F,d0		; if sound test	moves below 0, set to $4F
    
    LevSel_chkRight:
    		btst	#3,d1		; is right pressed?
    		beq.s	LevSel_chkRefresh2	; if not, branch
    		addq.w	#1,d0		; add 1	to sound test
    		cmpi.w	#$50,d0
    		bcs.s	LevSel_chkRefresh2
    		moveq	#0,d0		; if sound test	moves above $4F, set to	0
    
    LevSel_chkRefresh2:
    		move.w	d0,($FFFFFF84).w ; set sound test number
    		bsr.w	LevSelTextLoad	; refresh text
    
    https://www.youtube.com/watch?v=Q0v-XUzIUPE

    Going to sound test, playing sound & Music, then going to S2 Level Select, in this level select you can select a level to play, whereas in S1's Level Select, Now an Options Menu, you can select character (it goes forward and not back, how to go back a character? 00 is Sonic, 01 is Richter, 02 is Nebula Sonic), Music Playlist (Switch Between Original & custom, odd thing is, press right once, original, twice, custom, three times, original & can't go back. Just need 00 as Original & 01 as custom), Play music & sound test, go to level select, choose a level & it goes right back to option menu. Also after selecting Level Select, once in, GHZ3 is highlighted and i tried


    clr.b (OptionSSFix).w
    clr.b (v_levselitem).w

    at the begnning of Level_Select_Menu: in s2_menu.asm and nothing. what can i do to fix all this cause i tried everything and still at a loss.

    (all that time with no internet, 2 weeks, now back up & still at a loss with this... bummerr)
     
  4. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,020
    Not exactly, Sonic 2 has additional samples, such as clapping, tom, record scratch...
     
  5. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    I would have thought the S2 clone driver would have been made to run a little faster to avoid lagging like straight S1 driver ports, but maybe there's something else there I don't know of. So anyway, does this mean that guides that require MegaPCM will work with the Clone driver (V.2)?
     
  6. redhotsonic

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England
    Sonic 1's driver runs on the 68000. Sonic 2's driver runs on the z80. The 68000 is a lot easier to work with, so Sonic 2 clone driver is Sonic 2's driver on the 68000. This puts a little more stress on the 68000, and may cause more slowdown in your game, but at least it's miles easier to create/port music.

    So technically, no, it doesn't avoid lagging, in fact, it causes more lag... ish...
     
  7. N30member

    N30member non-pro user btw Member

    Joined:
    Feb 15, 2014
    Messages:
    216
    Location:
    Kazakhstan
    Umm, how to port Sonic 2 Clone Driver to Sonic 1? I saw that Lone Devil did it, but I'm wondering how he put it in.
     
  8. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,020
    'Basic Questions'? I'm not making a topic for this, you know?


    I can't optimise the driver to the levels of S2's driver, as that doesn't run on the 68k at all! Also, for christ's sake, the lag isn't game-breaking! You know Sonic 1 is the Lord of Lag because the game lacked optimisation, right? That tech demo of v2 running in S3K should've been evidence enough. And what guides require MegaPCM? The most I've seen any guide interact with MegaPCM is adding samples to it, and you can do that with almost any DAC driver. What MegaPCM has is expanded boundaries; more samples, more playback options. It's comparable to my v2 driver: what you can do to S1's driver, you can do to v2.


    Porting the driver... Way easier with the original Clone Driver. The v2 is AS assembler-specific, so, unless you're using an AS disasm, or are willing to retool the driver to suit asm68k, it's not gonna happen. You also have to restore the Special SFX system, which was removed from the v2. I've done this plenty of times before, but could never simplify it in a way that doesn't require an entirely separate version of the driver. I want to keep things like the Xeno patch; just a compatibility layer and separate guide.


    EDIT: Let me just straighten it out. The original Clone Driver is just S1's driver with a custom DAC driver to handle the greater number of samples. The ported music and SFXs are just that, ported. That's all the Clone Driver is.
     
    Last edited by a moderator: Oct 2, 2014
  9. N30member

    N30member non-pro user btw Member

    Joined:
    Feb 15, 2014
    Messages:
    216
    Location:
    Kazakhstan
    I use Project 128, so you can think I'm using AS. So, I need to optimize it for a whiiile... :|
     
    Last edited by a moderator: Oct 2, 2014
  10. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,020
    Project Sonic 1: Two-Eight uses AS? Wish I'd known that when I made the Git version...


    To add to the list of 'v2 to S1' hurdles, you have to convert PlaySound to the v2 equivalent, along with SoundDriverLoad. You also have to worry about equate incompatibilities. Another added joy is the tacked-on MZ 'block push' sound and associated coordination flag, which you could convert to an S3K-style Continuous SFX for the sake of simplicity, but you'd really need to know what you're doing.
     
    Last edited by a moderator: Oct 2, 2014
  11. N30member

    N30member non-pro user btw Member

    Joined:
    Feb 15, 2014
    Messages:
    216
    Location:
    Kazakhstan
    There are 2 versions of Two-Eight: first one uses ASM68K, next uses AS. But I'm using kram1024 mod, which is already using AS. Anyway, I'll think about it. I know at least that I need to change equates to RAM addresses. =P (or write the RAM locations to beginning of ASM file)


    EDIT: And let's continue this discussion in IRC, because there would be tons of usefulless posts. Also, I'm writing this from tablet, not laptop... Wonder if I had Sonic hacking tools for Android.
     
    Last edited by a moderator: Oct 2, 2014
  12. redhotsonic

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England
    I stand corrected. But to be fair, I always stay away from music porting and sound driver and all that shit; I just leave ValleyBell to do that as he is a genius with it all. I just stay in the area I am comfortable with.
     
    Last edited by a moderator: Oct 2, 2014
  13. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    There's a guide somewhere in the SSRG tutorials section for properly implementing S3K music into Sonic 1, which naturally requires MegaPCM. I was making sure that the guide would work for the s2 Clone driver. As for the lag, that's a bit of an issue for me. Even if it isn't gamebreaking, it's still lag in a sonic game. So much for blast processing :p
     
    Last edited by a moderator: Oct 2, 2014
  14. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    417
    Location:
    Town Creek, AL
    Last edited by a moderator: Oct 2, 2014
  15. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,020
    Fine then. If placebo-lag is too much, then don't bother. I've already made my point about what little it does. Actually, let me go over it again, because I swear you're acting like it'd make the entire game run at 50hz. It has the same problem as the priority manager: every frame, another bunch of calculations, so when things on-screen get to be too much, things start chugging. Otherwise, as long as you're careful with your optimisations, object placement and design choices, things will work as always. Just look at Sonic 2 Recreation; 68k driver, just about lag-less in every area, even underwater with screen deformation. Compensate for the added cycles and you'll be fine. Or just, you know, use a Z80 driver and experience slightly less slowdown in those problem areas. They both do the same thing anyway, which was the whole point of the driver.

    Speaking of which, just what Clone Driver are you talking about? v2 already has that level of S3K-compatability. In fact, some of the code in that guide was from my driver; and my driver's compatibility has since improved beyond what the guide does. Unless you're working with the original Clone Driver (why), there's no point. You'll just break the other features.

    No point. You've already got all the help I'll give on that subject.

    So, erm, question answered, I guess. The Clone Driver is a modified version of Sonic 1's 68k SMPS sound driver; and you can't really port v2 back to Sonic 1, not without a fair bit of knowledge in that area.
     
    Last edited by a moderator: Oct 3, 2014
  16. redhotsonic

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England
    ^_^


    Just so you know, I did some clever optimisations with the deformation with water ripples. Only act 2 during the crumble runaway, do you experience very little and very short lag, and even that's not noticeable as such. I always did want the sound driver on the z80 to rid that tiny slowdown, but it was hardly worth the porting just for that. ValleyBell said the 68k will do (means more effects too), and after seeing your comment, he was right.
     
    Last edited by a moderator: Oct 2, 2014
  17. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
  18. Deadalive

    Deadalive Newcomer Trialist

    Joined:
    Aug 3, 2014
    Messages:
    19
    Location:
    Green Hill Zone
    I have two questions for those that can help. 1 I have added Tails to my hack and everything loads correctly(signpost, monitors ect) but whatever I do I always loads an orange Sonic for his ending, any ideas? 2 I searched around for this so I apologize if this was answered before but how to I make the "got through" text like Sonic 3? That is the Blue with yellow outlining wording. Thank you for your replies.
     
  19. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    Both require editing the art work. The ending and title card text have their own art files and mappings that you'd need to load in an editor (i'd recommend SonmapEd). The only issue with this is that the got through and title card text use the same art; changing it would result in all the large text art being altered along with it.
     
  20. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,020
    Wait, what?

    According to the information under section 8 of the 68k user manual, the cycle count is:


    jsr table(pc,d0.w) 22(2/2)
    bra.w label 10(2/0)
    32(4/2)

    movea.l table(pc,d0.w),a0 18(4/0)
    jsr (a0) 16(2/2)
    34(6/2)

    I haven't been using this thing wrong the entire time, have I?