You are not logged in.
I'm having trouble with this. Could someone give me a link, or an explanation as to how pointers work. (Calculating as well as un-calculating).
Thanks, pointers make a lot more sense now.
I've got two videos about pointers, you can find the link to both of those in one of the sticky threads in Gen II section.
Okay, I understand how to find pointers, but how do I get the offset from a 2 byte pointer?
[effective address] = [bank ID] * 0x4000 + [pointer (big endian)] % 0x4000
Without the bank ID, you don't know where that pointer points (well, if there isn't a part in the code where the bank is specified, it is usually the same bank as the bank where the pointer is, so to get the bank ID just use the address where the pointer is), unless the pointer is less than 0x4000, in which case you know for sure it points to bank 0x00 (the fixed bank).
To get the bank ID from an effective address (real address):
[bank ID] = [effective address] / 0x4000
Use the steps I put above.
2-byte pointers don't point outside of their bank so their [zz] value (bank value in hex) is the bank of where the pointer is located.
Example: Pointer is 5A 4E and it starts at hex offset 32410.
1. Flip [xx][yy]: so result is 4E 5A.
2. Subtract x4000, so youll get: 0E 5A
3a. Since it has no [zz], you have to get it from where it's located: so it's located at 32410. Divide that by x4000 to get its bank = 0C
3b. Now you have the [zz], you can multiply it by x4000 = 30,000.
4. Add #2 and #3b which are: 0E 5A + 30,000 = 30E5A.
That's the offset where 5A4E points to.
* To verify my statement that 2-bytes don't point outside, divide 32410 by x4000 and 30E5A by x4000.
They are both in bank x0C, or the 12th bank.
Okay, I finally get it! Thanks. :)
You should post that new tool agentgeo. Just include the bank part as well, and it'll be the best there is, better than the one I posted.
EDIT: Nvm, I see it. Still, my recommendation would work wonders.
Last edited by tysonrss (2011-12-30 06:36:42)
Pokemon Blue DX is reborn!