Jump to content

16-bit Conditional Help


Zanoab

Recommended Posts

I have created my own code where I enter how much exp. I want the pokemon to give when defeated into the calculator, press L+R, and then fight a pokemon to get the experience I want.

This is the code I came up with:

94000130 FCFF0000

B2101D40 00000000

D9000000 00111D10

D6000000 00000090

D2000000 00000000

52240FB4 DBEF42AE

62101D40 00000000

B2101D40 00000000

D9000000 00000090

D6000000 00044914

D0000000 00000000

It works even though the value is stored in the money's address.

I then wanted to create a conditional that is determined by the options. If the options are my normal settings, then the code will be inactive. If the options are different from my normal settings, then the code will be active.

I have determined my normal options (and confirmed from creating a code that sets my settings to what I want) and tried to insert a 16-bit conditional but it always assumes true no matter how I change my settings.

94000130 FCFF0000

B2101D40 00000000

D9000000 00111D10

D6000000 00000090

D2000000 00000000

52240FB4 DBEF42AE

62101D40 00000000

B2101D40 00000000

A0000078 00004582

D9000000 00000090

D6000000 00044914

D0000000 00000000

Can anybody help me fix the code so it works how I want it?

The options that should determine the conditional false are:

Fast, Stereo, Off, Shift, Start = X, Type 18

Link to comment
Share on other sites

I see your problem.

The description of the AXXXXXXX ZZZZYYYY code-type from the official manual is (emphasis added):

If the value at (XXXXXXX or 'offset' when address is 0) masked by ZZZZ != YYYY then execute the following block of instructions,

Your code is looking at the value at the address 0x00000078, rather than (offset + 0x00000078) where it should be looking. And since odds are good that the value there isn't what you want, it'll inevitably return True.

Here is my revised code:

94000130 FCFF0000

B2101D40 00000000

D9000000 00111D10

D6000000 00000090

D2000000 00000000

52240FB4 DBEF42AE

62101D40 00000000

B2101D40 00000000

DC000000 00000078

A0000000 00004582

D9000000 00000018

D6000000 0004489C

D0000000 00000000

The DC codes add 78h to the offset, and I reduced the later two memory addresses by the same amount to compensate.

Link to comment
Share on other sites

Thank you so much for correcting the problem and explaining how the offset is applied to the offset. I didn't know about that happens to the offset when using the conditionals but I just made the corrections to my personal notes on the code types which will save me hours (or even days) of figuring out the problem with the conditionals.

It is a few hours before my flight for vacation out of the US so no internet for two weeks meaning two weeks of rebooting my DS just to enable/disable that code. Now I can begin making a code that sets the battle music depending on what window style I selected in my options (20 styles = 20 different battle music or more if I take in the other settings). I can also separate my codes from numerous button combinations (most are repeats) and set them to different option combinations in game to change them in game.

Once again, thanks. Also there is a slight typo in the last line of the code (D0 instead of D2) because I missed that change during the revision from an earlier attempt.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...