Purpose of r13? - Printable Version +- Mario Kart Wii Gecko Codes, Cheats, & Hacks (https://mariokartwii.com) +-- Forum: Hacks/Modding (https://mariokartwii.com/forumdisplay.php?fid=14) +--- Forum: Coding & Hacking General Discussion (https://mariokartwii.com/forumdisplay.php?fid=23) +--- Thread: Purpose of r13? (/showthread.php?tid=2048) |
Purpose of r13? - jawa - 05-08-2023 What is the purpose of r13? Is there any documentation for r13 in mkw? RE: Purpose of r13? - Vega - 05-08-2023 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/brawl/readwritesd.txt For actual technical explanations, this document does a good job - http://refspecs.linux-foundation.org/elf/elfspec_ppc.pdf |