ASM to Sega Genesis Platform

All about assembly programming in the Sega Genesis console.


    Tutorial: Rings Required to Preform Action

    Share
    avatar
    SuperSonicX

    Mensagens : 40
    Data de inscrição : 2011-06-30
    Current Project : The Gamer's Smorgas-Board

    Tutorial: Rings Required to Preform Action

    Post  SuperSonicX on Mon Jul 11, 2011 2:47 pm

    This is a tutorial to add ring requirements to certain actions. Here is a standard check for rings:
    Code:
    cmpi.w   #20,($FFFFFE20).w ; do you have   at least 20 rings?
    bcc.s   Code_Okay   ; if yes, branch
    Notice the code "cpmi.w #20($FFFFFE20).w". This calls to check your rings and see how many you have. bcc.s Code_Okay says to branch if you have enough. For example, put this at the beginning of any Sonic Routine (I'm showing the spindash here.) replacing the X with your number of rings.
    Code:
            cmpi.w   #X,($FFFFFE20).w ; do you have   at least X rings?
            bcc.s   SonicSD_Okay   ; if yes, branch
            rts
    SonicSD_Okay:
    This will require X amount of rings to do the spindash. If you don't, the code will end without doing anything.

    Subtracting Rings if has required amount:

    Look at this code:
    Code:

          sub.w   #20,($FFFFFE20).w ; minus 20 rings
          move.b   #$80,($FFFFFE1D).w   ; update ring counter
    This says to subtract rings. So add this at the beginning of the SonicSD_Okay code you just added, changing X to the number you used above.
    Code:

          sub.w   #X,($FFFFFE20).w ; minus X rings
          move.b   #$80,($FFFFFE1D).w   ; update ring counter
    So this will take away X rings when you attempt a spindash with more than X rings.


    This is it for the Tutorial: No credit required.
    avatar
    calebjhuhlu

    Mensagens : 55
    Data de inscrição : 2011-06-16

    Re: Tutorial: Rings Required to Preform Action

    Post  calebjhuhlu on Wed Jul 20, 2011 7:34 am

    Thanks! But when i applied it, when i got to five rings (i edited the 20 to 5 rings, Using Selbi's Jumpdash Code) It Started Over, back at 0 rings. Can you help me fix that?
    avatar
    SuperSonicX

    Mensagens : 40
    Data de inscrição : 2011-06-30
    Current Project : The Gamer's Smorgas-Board

    Re: Tutorial: Rings Required to Preform Action

    Post  SuperSonicX on Thu Jul 21, 2011 12:02 pm

    calebjhuhlu wrote:Thanks! But when i applied it, when i got to five rings (i edited the 20 to 5 rings, Using Selbi's Jumpdash Code) It Started Over, back at 0 rings. Can you help me fix that?

    If you want it not to subtract rings, revove that block of code that tells is to subtract 5 rings and update the ring counter. Also make sure both 20's were changed to 5.
    avatar
    calebjhuhlu

    Mensagens : 55
    Data de inscrição : 2011-06-16

    Re: Tutorial: Rings Required to Preform Action

    Post  calebjhuhlu on Thu Jul 21, 2011 12:53 pm

    not sure what you mean, but i found this: The first part works fine. it wont jumpdash unless i have 5 rings. Then, i applied the second part (minus 5 rings) every time i got 5 rings (without jumpdashing) it went back to zero. it stayed the same i added the last part of the code.
    avatar
    SuperSonicX

    Mensagens : 40
    Data de inscrição : 2011-06-30
    Current Project : The Gamer's Smorgas-Board

    Re: Tutorial: Rings Required to Preform Action

    Post  SuperSonicX on Thu Jul 21, 2011 4:00 pm

    calebjhuhlu wrote:not sure what you mean, but i found this: The first part works fine. it wont jumpdash unless i have 5 rings. Then, i applied the second part (minus 5 rings) every time i got 5 rings (without jumpdashing) it went back to zero. it stayed the same i added the last part of the code.
    Move that code to subtract 5 rings right after the line
    that plays the jumpdash sound. It should work then.
    avatar
    calebjhuhlu

    Mensagens : 55
    Data de inscrição : 2011-06-16

    Re: Tutorial: Rings Required to Preform Action

    Post  calebjhuhlu on Thu Jul 21, 2011 6:55 pm

    Thank you! Its working perfectly now!
    avatar
    drumberboy1122

    Mensagens : 20
    Data de inscrição : 2012-05-20

    Re: Tutorial: Rings Required to Preform Action

    Post  drumberboy1122 on Mon May 21, 2012 8:59 am

    awesome tutorial but where it says code okay, how do you replace that? Do you leave the okay and just put in the routine?
    avatar
    Green Snake

    Mensagens : 2093
    Data de inscrição : 2012-04-07
    Localização : I do not even know
    Current Project : nope

    Re: Tutorial: Rings Required to Preform Action

    Post  Green Snake on Tue May 22, 2012 5:07 am

    drumberboy1122 wrote:awesome tutorial but where it says code okay, how do you replace that? Do you leave the okay and just put in the routine?

    Rename ''SonicSD_okay'' To name fitting with your things, like:
    [code]Objxx:
    ; do you have at least x ring?
    ; if yes, branch to Objxx_okay
    Objxx:
    ;your code here
    avatar
    drumberboy1122

    Mensagens : 20
    Data de inscrição : 2012-05-20

    Re: Tutorial: Rings Required to Preform Action

    Post  drumberboy1122 on Tue May 22, 2012 1:03 pm

    Green Snake wrote:
    drumberboy1122 wrote:awesome tutorial but where it says code okay, how do you replace that? Do you leave the okay and just put in the routine?

    Rename ''SonicSD_okay'' To name fitting with your things, like:
    [code]Objxx:
    ; do you have at least x ring?
    ; if yes, branch to Objxx_okay
    Objxx:
    ;your code here

    So if I was trying to add this to the double jump move and I named the double jump sub routine to Sonic_DoubleJump, Would I just replace SonicSD_okay with Sonic_DoubleJump?
    avatar
    Green Snake

    Mensagens : 2093
    Data de inscrição : 2012-04-07
    Localização : I do not even know
    Current Project : nope

    Re: Tutorial: Rings Required to Preform Action

    Post  Green Snake on Wed May 23, 2012 3:05 am

    drumberboy1122 wrote:

    So if I was trying to add this to the double jump move and I named the double jump sub routine to Sonic_DoubleJump, Would I just replace SonicSD_okay with Sonic_DoubleJump?

    No, Sonic_DJ_okay.
    avatar
    drumberboy1122

    Mensagens : 20
    Data de inscrição : 2012-05-20

    Re: Tutorial: Rings Required to Preform Action

    Post  drumberboy1122 on Wed May 23, 2012 12:45 pm

    Green Snake wrote:
    drumberboy1122 wrote:

    So if I was trying to add this to the double jump move and I named the double jump sub routine to Sonic_DoubleJump, Would I just replace SonicSD_okay with Sonic_DoubleJump?

    No, Sonic_DJ_okay.

    And do I keep my subroutine name the same?
    avatar
    Green Snake

    Mensagens : 2093
    Data de inscrição : 2012-04-07
    Localização : I do not even know
    Current Project : nope

    Re: Tutorial: Rings Required to Preform Action

    Post  Green Snake on Thu May 24, 2012 2:06 am

    drumberboy1122 wrote:
    And do I keep my subroutine name the same?
    On the main routine where you put your check on, could be Sonic_DoubleJump.
    avatar
    drumberboy1122

    Mensagens : 20
    Data de inscrição : 2012-05-20

    Re: Tutorial: Rings Required to Preform Action

    Post  drumberboy1122 on Thu May 24, 2012 4:55 am

    Green Snake wrote:
    drumberboy1122 wrote:
    And do I keep my subroutine name the same?
    On the main routine where you put your check on, could be Sonic_DoubleJump.

    So it would look like this

    cmpi.w #X,($FFFFFE20).w ; do you have at least X rings?
    bcc.s SonicDJ_Okay ; if yes, branch
    rts
    Sonic_DoubleJump:
    avatar
    Green Snake

    Mensagens : 2093
    Data de inscrição : 2012-04-07
    Localização : I do not even know
    Current Project : nope

    Re: Tutorial: Rings Required to Preform Action

    Post  Green Snake on Fri May 25, 2012 5:25 am

    drumberboy1122 wrote:
    So it would look like this

    cmpi.w #X,($FFFFFE20).w ; do you have at least X rings?
    bcc.s SonicDJ_Okay ; if yes, branch
    rts
    Sonic_DoubleJump:

    You are not understanding this at all.
    it would look like:

    Sonic_DoubleJump:
    cmpi.w #X,($FFFFFE20).w ; do you have at least X rings?
    bcc.s SonicDJ_Okay ; if yes, branch
    rts
    SonicDJ_Okay:
    avatar
    drumberboy1122

    Mensagens : 20
    Data de inscrição : 2012-05-20

    Re: Tutorial: Rings Required to Preform Action

    Post  drumberboy1122 on Fri May 25, 2012 12:27 pm

    Green Snake wrote:
    drumberboy1122 wrote:
    So it would look like this

    cmpi.w #X,($FFFFFE20).w ; do you have at least X rings?
    bcc.s SonicDJ_Okay ; if yes, branch
    rts
    Sonic_DoubleJump:

    You are not understanding this at all.
    it would look like:

    Sonic_DoubleJump:
    cmpi.w #X,($FFFFFE20).w ; do you have at least X rings?
    bcc.s SonicDJ_Okay ; if yes, branch
    rts
    SonicDJ_Okay:

    Ok I am so sorry. I thought you put it above the subroutine. I am really sorry.

    josephAndSonicTeam

    Mensagens : 7
    Data de inscrição : 2013-08-02

    Re: Tutorial: Rings Required to Preform Action

    Post  josephAndSonicTeam on Fri Aug 02, 2013 8:43 am

    clown clown clown 
    avatar
    hacker___

    Mensagens : 1967
    Data de inscrição : 2013-05-06
    Localização : Antarctica
    Current Project : Sonic Random Hax

    Re: Tutorial: Rings Required to Preform Action

    Post  hacker___ on Thu Aug 08, 2013 7:59 am

    josephAndSonicTeam wrote:clown clown clown 

    XD
    avatar
    SESIN KOLIN

    Mensagens : 108
    Data de inscrição : 2013-07-30
    Localização : yes
    Current Project : Sonic the Hedgehog 2 Loco Remasterde SHC2014 coming soon betatestigova

    Re: Tutorial: Rings Required to Preform Action

    Post  SESIN KOLIN on Thu Aug 15, 2013 9:14 pm

    hacker___ wrote:
    josephAndSonicTeam wrote:clown clown clown 
    XD
    Yes.
    avatar
    hacker___

    Mensagens : 1967
    Data de inscrição : 2013-05-06
    Localização : Antarctica
    Current Project : Sonic Random Hax

    Re: Tutorial: Rings Required to Preform Action

    Post  hacker___ on Thu Aug 15, 2013 9:22 pm

    SESIN KOLIN wrote:
    hacker___ wrote:
    josephAndSonicTeam wrote:clown clown clown 
    XD
    Yes.
    avatar
    SESIN KOLIN

    Mensagens : 108
    Data de inscrição : 2013-07-30
    Localização : yes
    Current Project : Sonic the Hedgehog 2 Loco Remasterde SHC2014 coming soon betatestigova

    lol?

    Post  SESIN KOLIN on Thu Aug 15, 2013 9:24 pm

    hacker___ wrote:
    SESIN KOLIN wrote:
    hacker___ wrote:
    josephAndSonicTeam wrote:clown clown clown 
    XD
    Yes.
    wat rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer
    avatar
    hacker___

    Mensagens : 1967
    Data de inscrição : 2013-05-06
    Localização : Antarctica
    Current Project : Sonic Random Hax

    Re: Tutorial: Rings Required to Preform Action

    Post  hacker___ on Thu Aug 15, 2013 9:25 pm

    SESIN KOLIN wrote:
    hacker___ wrote:
    SESIN KOLIN wrote:
    hacker___ wrote:
    josephAndSonicTeam wrote:clown clown clown 
    XD
    Yes.
    wat rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer
    -_-''
    avatar
    JoshDP

    Mensagens : 1009
    Data de inscrição : 2014-10-05
    Current Project : S3K and S1 Coop hax

    Re: Tutorial: Rings Required to Preform Action

    Post  JoshDP on Tue Jul 19, 2016 2:15 pm

    hacker___ wrote:
    SESIN KOLIN wrote:
    hacker___ wrote:
    SESIN KOLIN wrote:
    hacker___ wrote:
    josephAndSonicTeam wrote:clown clown clown 
    XD
    Yes.
    wat rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer rendeer
    -_-''
    6" penis

    Sponsored content

    Re: Tutorial: Rings Required to Preform Action

    Post  Sponsored content


      Current date/time is Wed Jun 28, 2017 3:05 pm