Seen September 8th, 2013
Posted March 11th, 2013
402 posts
14.7 Years
I'm feeling a little curious right now, and want to find out how to do something.
Let's say I didn't want to use a pointer calculator to get a pointer in Gold, how would I figure out the gold pointer? There would have to be some method, wouldn't there?
If the offset ≥ 4000, then we can get its pointer by ((offset Mod 0x4000) + 0x4000). Say our offset is 0x034BB1:

0x034BB1 Mod 0x4000 = 0x0BB1
0x0BB1 + 0x4000 = 0x4BB1

In the game it’s generally little‐endian: 0xB14B, but in documentation and the like I would recommend using normal big‐endian numbers.

Three‐byte pointers use the bank number as well. You get the byte number by rounding down to the nearest 0x4000 and dividing by 0x4000.

0x034BB1 → 0x034000
0x034000 ÷ 0x4000 = 0x0D

Thus, our three-byte pointer is 0x0DB14B. Generally in documentation we write it with a colon to differentiate it from an offset—0D:B14B or 0D:4BB1. In the ROM I have sometimes (but rarely) seen the bank byte come after the pointer and not before.

If the offset < 0x4000, then the offset is the pointer, little‐endian. If our offset is 0x3728, then the pointer is usually 0x2837. Offsets less than 0x4000 generally don’t have three‐byte pointers, because that would be redundant.