Basic Questions and Answers Thread

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

  1. amphobius

    amphobius spreader of the pink text Member

    Joined:
    Feb 24, 2008
    Messages:
    970
    Location:
    United Kingdom
    Thanks for the info! I'll get this in soon. :)
     
    Last edited by a moderator: Jul 19, 2013
  2. DarkMarioBros

    DarkMarioBros Newcomer Trialist

    Joined:
    Jul 18, 2013
    Messages:
    1
    Location:
    Dark Dimension
    I'm in trouble to build  everytime but nothing change

    I'll make Mario in Sonic 1 (not Somari)

    I'm trying to use Sonic Retro's Sonic 1 Disassembly,

     All files done  but ... nothing happen when I try to build.
     
    Last edited by a moderator: Jul 19, 2013
  3. TheInvisibleSun

    TheInvisibleSun Visible Member

    Joined:
    Jul 2, 2013
    Messages:
    424
    Location:
    Western New York, USA
    In the main folder, there should be a file called errors.txt. *EDIT* Open the file, and it should tell you why it's not building the ROM.
     
    Last edited by a moderator: Jul 20, 2013
  4. SuperEgg

    SuperEgg I'm a guy that knows that you know that I know Member

    Joined:
    Oct 17, 2009
    Messages:
    Location:
    THE BEST GOD DAMN STATE OF TEXAS
    You're going to have to port in the Tails' tail object from Sonic 2, or for simplicity, Sonic 2 NA. Once you do that, you've gotta make sure the object loads along with Tails himself. Shouldn't be that hard, just steal those few lines of code from S2 and you'll be set. Also, adjust Tails' height. You're using the same height as Sonic, which he's not.
     
  5. โบวี่

    โบวี่ Tsingtao Enjoyer Member

    Joined:
    Dec 27, 2011
    Messages:
    215
    Here's a quick noob question;

     If it is possible to do so, how do you replace the Sonic 1 drum samples with WAV files I have currently ripped and sampled from an old keyboard?
     
  6. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,902
    Location:
    italy
    This gets asked quite often. Please, search at least in this very topic before you ask the next time. This was less than 3 months ago.
     
    Last edited by a moderator: Aug 5, 2013
  7. JoenickROS

    JoenickROS ROS (bug fixing in progress) Member

    Joined:
    Feb 5, 2012
    Messages:
    929
    Been a while since I have asked a question but this has me baffled. You see I"m trying to add another water palette, since I just recently added water to my CCZGF art port, and I have found out that deleting or commenting all of this:


    moveq #$15,d0 ; palette number $15
    cmpi.w #8,(Current_Zone).w
    beq.s Level_WaterPal ; branch if level is HPZ
    moveq #$16,d0 ; palette number $16
    cmpi.w #$C01,(Current_Zoneandact).w
    beq.s Level_WaterPal ; branch if level is CPZ
    moveq #$14,d0 ; palette number $16
    cmpi.w #$D,(Current_Zone).w
    beq.s Level_PalNotCPZ ; branch if level is not CPZ

    out, effects absolutely nothing, all the correct water palettes still load. So my question is, is there any other place in the asm file where the water palette numbers are loaded. I've searched for it and I cant seem to find another place for it, just the main code for loading water palettes. I find it weird that deleting all that doesn't crash the game, or load the wrong water palettes.
     
  8. TimpZ

    TimpZ Well-Known Member Member

    Joined:
    Apr 30, 2013
    Messages:
    63
    Location:
    Lund
    This is something I've struggled with for a while. I wanted to implement the leniency on crouching from S&K in S2 (where you can slightly move a bit and still crouch rather than having to stand dead still). Originally the code looks like this in the HG split disassembly:
     


    ; loc_1A9D2:
    Sonic_Roll:
    tst.b status_secondary(a0)
    bmi.s Obj01_NoRoll
    mvabs.w inertia(a0),d0
    cmpi.w #$80,d0 ; is Sonic moving at $80 speed or faster?
    blo.s Obj01_NoRoll ; if not, branch
    move.b (Ctrl_1_Held_Logical).w,d0
    andi.b #button_left_mask|button_right_mask,d0 ; is left/right being pressed?
    bne.s Obj01_NoRoll ; if yes, branch
    btst #button_down,(Ctrl_1_Held_Logical).w ; is down being pressed?
    bne.s Obj01_ChkRoll ; if yes, branch
    ; return_1A9F8:
    Obj01_NoRoll:
    rts

     
    My first edit was this:
     
     


    cmpi.w #$108,d0 ; is Sonic moving at $108 speed or faster?
    blo.w Sonic_Duck ; if not, branch - branch to crouch

     

    This worked surprisingly well, until I realised it screws up the solidity physics. Whenever Sonic hits a wall with high speed he stops preemtively, changes to his pushing animation and then proceeds to move closer to the wall:
    [​IMG]
     
    Interestingly enough jumping into a wall doesn't make the glitch happen, while running into it does. Also, looking up was broken until I changed Sonic_Duck to Sonic_Lookup and unless you tell the program not to, he can slide along the floor while crouched.
     
    I tried to figure out why but seeing as how I'm not very proficient in 68k assembly I thought I might as well try and ask here. I took a glance on the differences in S2 and S3&K and I found out that the layout of the code is different. This is the parts I'm guessing are important in order: http://pastebin.com/Vg3YhKQ9

    All in all I'm pretty stumped to battle this as completely changing the layout of the code or importing the code from S3K seems a bit daunting for what I percieved to be a simple edit. Perhaps someone can give some insight?
     
     
  9. Alriightyman

    Alriightyman I'm back! Member

    Joined:
    Oct 3, 2007
    Messages:
    156
    Location:
    USA
    Go to Level_MainLoop: and scroll up a bit from there, you should find what you are looking for.

    You must have broke something else that is effecting that.  Applying that to a vanilla Sonic 2, does not do yield that results that you have explained.  I even picked up speed shoes to double check! 


    So, what else did you add/do to this hack?
     
    Last edited by a moderator: Aug 8, 2013
  10. TimpZ

    TimpZ Well-Known Member Member

    Joined:
    Apr 30, 2013
    Messages:
    63
    Location:
    Lund
    Applying that to a vanilla Sonic 2 does yield exactly the results that I explained. Go to line 33675 in the HG disassembly and change 

    blo.s Obj01_NoRoll

    to

    blo.w Sonic_Duck

    EDIT: If you still don't believe me I could PM you a GMV or something?
     
    Last edited by a moderator: Aug 8, 2013
  11. Alriightyman

    Alriightyman I'm back! Member

    Joined:
    Oct 3, 2007
    Messages:
    156
    Location:
    USA
    Oops! I didn't see the Sonic_Duck:

    Don't do that.  just adjust the 


    cmpi.w #$80,d0 ; is Sonic moving at $80 speed or faster?

    to


    cmpi.w #$100,d0 ; is Sonic moving at $80 speed or faster?

    Why are you even calling Sonic_Duck?
     
  12. TimpZ

    TimpZ Well-Known Member Member

    Joined:
    Apr 30, 2013
    Messages:
    63
    Location:
    Lund
    Because I want Sonic to duck when he's moving less than that speed. The code you just suggested does nothing other than increase the speed needed to roll, holding down does nothing because of the rts. In Sonic 2, Sonic has to be completely still in order to duck while in Sonic & Knuckles he can move at about 1.5 pixels per frame (iirc) and still duck. It completely changes how the physics feel and allows you to for example spindash on downwards slopes which normally is impossible in Sonic 2.
     
  13. Alriightyman

    Alriightyman I'm back! Member

    Joined:
    Oct 3, 2007
    Messages:
    156
    Location:
    USA
    I see.  But calling Sonic_Duck will not work.  I would suggest looking at S&K.  I know it looks a little confusing, but the Sonic object in Sonic 2 and in Sonic and Knuckles is mostly identical. 


    Player_Spin:

    in S&K is the Sonic_Roll: function.  It is a bit different from Sonic 2.  It looks as though it sets the ducking animation;


    move.b #8,$20(a0)

    $20(a0) is anim(a0) in S&K.  So, I would try to duplicate that and see if it works.

    And when you see this:


    tst.b (Reverse_gravity_flag).w
    beq.s loc_117C2
    subi.w #$A,$14(a0)

    ignore them. Reverse_gravity_flag does not exist in Sonic 2.

    If you have trouble deciphering what is going on, let me know and I will try to help.  I have to go to work, but I'll check back when I get home.
     
    Last edited by a moderator: Aug 8, 2013
  14. TimpZ

    TimpZ Well-Known Member Member

    Joined:
    Apr 30, 2013
    Messages:
    63
    Location:
    Lund
    I tried to port Player_Spin to Sonic_Roll. It's basically a terrible mix of S&K/S2 code where I renamed anything that needed it. Result; it works basically like vanilla S2 as far as I can tell, other than the roll leniency being $100 rather than $80. I would very much appreciate the deciphering you were talking about Alriightyman since I'm not exactly sure of the purpouse behind loc_1176A, loc_11780 or loc_1A9FA, nor am I sure what #1 or #$C is in Ctrl_1_logical or how I should translate #2, status(a0) to S2.

    Code:
    Sonic_Roll:
    	tst.b	status_secondary(a0)
    	bmi.s	Obj01_NoRoll	
    	
    	move.b	(Ctrl_1_logical).w,d0
    	andi.b	#$C,d0 ; is a direction pressed? (left/right?)
    	bne.s	Obj01_NoRoll ; branch if it is (rts)
    	btst	#1,(Ctrl_1_logical).w
    	beq.s	loc_11780 ; if a certain button is pressed, branch
    		
    	move.w	inertia(a0),d0	
    	bpl.s	loc_1176A ; branch on plus
    	neg.w	d0 ; negate the value? reverse a signed hex perhaps?
    	
    	
    loc_1176A:
    	cmpi.w	#$100,d0
    	bcc.s	loc_11790 ; branch on Carry Clear?
    	btst	#3,$2A(a0) ; test the third bit in primary status (standing on an object?)
    	bne.s	Obj01_NoRoll ; branch if he is
    	move.b	#8,$20(a0) ; set his animation (ducking?)
    	
    ; return_1A9F8:
    Obj01_NoRoll:
    	rts
    	
    ; ---------------------------------------------------------------------------
    
    loc_11780:
    	cmpi.b	#8,anim(a0) ; Is he already ducking(?)
    	bne.s	Obj01_NoRoll ; if he is, branch
    	move.b	#0,anim(a0) ; otherwise reset animation(?)
    	rts
    ; ---------------------------------------------------------------------------
    ; loc_1A9FA:
    loc_11790:
    	btst	#2,status(a0) ; "RSS flag, set if the object should remember that it is destroyed." - S3K SCHG. no idea what this does here, but bit 2 is unknown or unused in S2 according to SCHG
    	beq.s	Obj01_DoRoll
    	rts
    
    ; ---------------------------------------------------------------------------
    ; loc_1AA04:
    Obj01_DoRoll:
    	bset	#2,status(a0)
    	move.b	#$E,y_radius(a0)
    	move.b	#7,x_radius(a0)
    	move.b	#AniIDSonAni_Roll,anim(a0)	; use "rolling" animation
    	addq.w	#5,y_pos(a0)
    	move.w	#SndID_Roll,d0
    	jsr	(PlaySound).l	; play rolling sound
    
    	tst.w	inertia(a0)
    	bne.s	return_1AA36
    	move.w	#$200,inertia(a0)
    
    return_1AA36:
    	rts
    
     
    Last edited by a moderator: Aug 9, 2013
  15. Onapa

    Onapa Newcomer Trialist

    Joined:
    Jul 18, 2013
    Messages:
    5
    Location:
    Michigan
    I'm having problems with SonED2. Every time I edit an act in SonED2 on Hivebrain's Split and Text Disassembly (ASM68K), the graphics/level design looks garbled. Also there's an error when i'm running the build scripts. Here are some screen shots. 

    [​IMG]

    [​IMG]
     
    Last edited by a moderator: Aug 9, 2013
  16. vladikcomper

    vladikcomper Well-Known Member Member

    Joined:
    Dec 2, 2009
    Messages:
    415
    It looks like SonEd2 has spoiled those files completely by zeroing them. This never happened to me, but I heard this may occur if you close SonED2 instantly after the save command, not giving it enough time to save all the data properly.

    I doubt you can recover these files now, unless you have a working backup. If you don't, all you can do is replace the listed files with ones from a clean disassembly, but there can be even more corrupted data though.
     
  17. Dark Lips

    Dark Lips Well-Known Member Member

    Joined:
    Nov 14, 2008
    Messages:
    293
    Location:
    Wolverhampton UK
    Hiya guys and girls, Bobesh8 and myself have started work on a project called Sonic Redemption CD - I am having trouble getting the DMA_68KtoVRAM routine to work on the megacd... does anybody have any idea why? I am stumped and have come to the conclusion its some quirk of the megacd.
     
  18. vladikcomper

    vladikcomper Well-Known Member Member

    Joined:
    Dec 2, 2009
    Messages:
    415
    1) There's a bug in Sega CD's DMA transfers, when the first word of the data transferred gets corrupted. There's no way around it, it's a hardware bug, you have to fix it manually by sending the first word via VDP's data port.

    2) In Mode 1, DMA from the ROM section doesn't work in Kega, Unlike the first bug, this one is emulation bug somehow and it doesn't occur on real hardware. If you want your game to work in emulation however, you'll have to aviod DMA transfers from ROM at all, moving data manually through VDP data port instead.

    That's all I know.
     
  19. theocas

    theocas #! Member

    Joined:
    Apr 10, 2010
    Messages:
    375
    As far as number one there goes, that's caused due to timing issues in the Mega CD's DRAM controller, which corrupts the first word read out when the DMA timing (150ns) is used — this issue doesn't appear when the 68k reads it, as the 68k is comparatively "slow" as each CPU cycle of the 68k alone is about 130ns, and (IIRC, it's been a long time since I looked at this section of the manual) the CPU gives peripherals 2 cycles of time from the assertion of /AS to data output. Another workaround is to set the DMA duration to one word longer than you want, and source/destination one word before what you want. It's the lazy approach, so to speak.

    DMA from ROM in Mode 1 DOES work in Kega — rather sporadically, that is. ROMs over 512K seem to make it angry for whatever reason, but the Sonic 1 + Mode 1 thing a colleague and I pulled off years ago did not present any such problems in Kega. It's a horrible emulation quirk and I doubt it'll ever get fixed, so if you want the Mega CD, it's probably your best bet to use Mode 2.

    The Mega CD manual also states that the Z80 should NOT bank to the Word RAM — however, in the tests I've conducted on various hardware (they're by no means extensive, but cover a good chunk of the hardware available) that's absolute bogus, and banking to that area of memory works without a hitch. Sega was probably worried that the timing issues that cause DMA problems also cause Z80 issues, but since the Z80 cycles are 279ns, that shouldn't be a problem.

    And please, whatever you do, read the God damn documentation. I'm tired of people thinking they can just "port" things to the Mega CD without so much as a tiny bit of knowledge about the hardware. Write your own loaders instead of using some shitty off-the-shelf garbage. Write your own SubCPU code to handle CD-DA and to load things. You aren't getting jackshit out of the hardware if all you do is work off of some template — that's total lazyness, and I haven't seen even the smallest hint of competence out of Bobesh8, with whom I've talked on IRC on several occasions. He's never even read the docs, despite repeated attempts by me and people who shall go unnamed to help him…

    Not that I'm discouraging y'all from doing Mega CD stuff, but please, be aware of what you're getting yourself into. And do it right, please.
     
    Last edited by a moderator: Aug 9, 2013
  20. Dark Lips

    Dark Lips Well-Known Member Member

    Joined:
    Nov 14, 2008
    Messages:
    293
    Location:
    Wolverhampton UK
    hmmm ok thanks for the info guys... there must be some kind of work around as megamix seems to use dma, i.e spindash dust, sonic 3 shields and what not. 

    ok guys and girls, I had a tinker with the DMA routine from sonic 2 and implemented it as I would any other sonic 1 hack... with odd results - I tried copying data to word ram and I got it working as in sonic and the dust is now drawn by DMA routine but its very glitched... sonic is distorted almost like the tiles are miss aligned.
     
    Last edited by a moderator: Aug 12, 2013