Purpose of r13?
What is the purpose of r13? Is there any documentation for r13 in mkw?
r13 is used as a small data area global pointer. It's set at the very early stages of the booting process of the Game. This address will vary per game. Do NOT modify this value at any time. If for whatever reason you wanted to, be sure interrupts are off and you restore its original value at the end of your code.

Wii games will use r13 as a pointer when it needs to reference important or common constants. Like for Super Smash Bros, r13 minus 32400 points to the ascii byte of "r" which is used for SD file writing and r13 minus 32384 points to ascii byte of "w" for SD file reading. Knowing this can cut down on code size because you won't need to write out "w" or "r" in a custom table.

Example code using r13 - https://mariokartwii.com/nonmkwcodes/bra...ritesd.txt

For actual technical explanations, this document does a good job - http://refspecs.linux-foundation.org/elf...ec_ppc.pdf

Forum Jump:

Users browsing this thread: 2 Guest(s)