Using the Exception Vector Area in ASM Codes
#1
Using the Exception Vector Area in ASM Codes

If you have started making ASM Codes recently and they are becoming less basic, you will eventually hit a point where you need to store values during one ASM code, to later utilize said values in another ASM Code. The simplest method to achieve that is to store the necessary data/values to what is known as the Exception Vector Area.

The Exception Vector Area is universal (same location within memory) for every Wii Game. Here are the address ranges:

0x80001490 thru 0x800016FF
0x80001798 thru 0x800017FF

This area is safe to store data/values to. Keep in mind that many many ASM codes utilize the Exception Vectors Area.

I would say that the most used region within this area is from High 0x800015XX to Mid 0x800016XX Range. So you might want to use the second portion (0x80001798 thru 0x800017FF) instead. Many users (noobs) of the game will use multiple ASM codes together in a GCT and not think twice to check them to see if a code happens to use the same Exception Vector region as another code. Thus causing both codes to malfunction and the 'noob' thinking there is something wrong with the code(s).

Now onto a demo code of how to utilize the Exception Vector Area. We have this code here...

https://mkwii.org/showthread.php?tid=889 (take a moment to thoroughly read thru the source)

The first ASM code has a register that holds the value of the in-race room size. We want to use this value for the next ASM Code (shared item code) to help determine whether or not the code should execute. The shared item code address has NO registers that hold the in-race room size value. 

So what the 1st instruction of the 1st ASM code does is establish the 1st half address of the Vector Area (lis r12, 0x8000). The next instruction stores the in-race room size value (byte) to the designated spot in the Vector Area at 0x8000164F. Now this allows the second ASM to load this byte value for use.

As you can see, pretty simple to do. Happy coding!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)