(03-08-2019, 05:59 PM)Admentus Wrote: Just wondering darkludx
You can add a value to an AR Code by using 80 (8-bit), 82 (16-bit) or 84 (32-bit) as the two first digits for the code address. Is there also a method to subtract a value (not write, but subtract)?
That Code Type is signed.
Is for sure that you already know the following:
Addition
(80) 000000XX
8-bit Addition. Load the byte at the address, add X to it, and save resulting byte.
(82) 0000XXXX
16-bit Addition. Load the halfword at the address, add X to it, and save resulting halfword.
(84) XXXXXXXX
32-bit Addition. Load the word at the address, add X to it, and save resulting word.
Signed & Unsigned Numbers
Unsigned means:
For 8-bits: 0x00 -> 0xFF = 0 to 255.
For 16-bits: 0x0000 -> 0xFFFF = 0 to 65535.
For 32-bits: 0x00000000 -> 0xFFFFFFFF = 0 to 4294967295.
Signed means:
For 8-bits: 0x00 -> 0x7F = 0 to 127.
0x80 -> 0xFF = -127 to -1.
For 16-bits: 0x0000 -> 0x7FFF = 0 to 32767.
0x8000 -> 0xFFFF = -32768 to -1.
For 32-bits: 0x00000000 -> 0x7FFFFFFF = 0 to 2147483647.
0x80000000 -> 0xFFFFFFFF = -2147483648 to -1.
[color=#3333ff]The Legend of Zelda: Collector's Edition NTSC-U (PZLE01)[/color]
[color=#339933]Majora's Mask Press L Button to Add 1 to 2FC5[/color]
0AE4FAF4 00002000
80002FC5 00000001
[color=#339933]Majora's Mask Press R Button to Substract 1 from 2FC5[/color]
0AE4FAF4 00000010
80002FC5 000000FF
This Code Type is quite unstable; If you press the buttons for a fraction of a second, the code runs 3, 4 or more times and adds or subtracts more than you want.