IF/NOT IF button functions

Many Action Replay DS codes can freeze the game, if they are activated at the wrong time. Action Replay DS comes with no tool (or 'trainer') to deactivate or enter new codes after starting the game, although there are built in IF, and IF NOT features when changing the values denoting whether a button is held down or not for two addresses which serve the same purpose in any legitimate Nintendo DS game.

Button mappings
The known button mappings in hexadecimal originally documented by Kodewerx are as follows.

Combining button mappings
There are valid identifiers for when two buttons are held down, which can easily be found via the bitwise AND function. To find one, take for example B and A; go into Windows Calculator and set it to "Scientific" mode on the View option. Set to 'Hex' and then enter "FFFD" And (in red font) "FFFE" to get "FFFC", which should be the identifier if you want the player to hold (or not hold) both A+B to activate the code. You can repeat this method with other identifiers above to find the identifiers for other button combinations.

Adding an IF function to an Action Replay code
For a simple IF function consider the format:
 * 1) 94000130 XXXX0000
 * 2) YYYYYYYY YYYYYYYY
 * 3) D2000000 00000000


 * The first line tells the game to activate the value of the next addresses only if the button or button combination defined by XXXX is held. For example, if you wanted to activate the code by holding L use FDFF.
 * The middle line(s) denote the actual Action Replay code itself, enter your previous code (which would activate regardless of a button query) here. Multiple lines can be used.
 * The final line is a terminator which deactivates the code after the button(s) are released.

Adding a NOT IF function to an Action Replay code
For a simple NOT IF function consider the format:
 * 1) A4000130 XXXX0000
 * 2) YYYYYYYY YYYYYYYY
 * 3) D2000000 00000000


 * The first line tells the game to activate the value of the next addresses only if the button or button combination defined by XXXX is not being held. For example, if you wanted to deactivate the code by holding L use FDFF.
 * The middle line(s) denote the actual Action Replay code itself, enter your previous code (which would activate regardless of a button query) here. Multiple lines can be used.
 * The final line is a terminator which deactivates the code after the button(s) are released.