Simple Questions (SEARCH BEFORE ASKING A QUESTION)
View Single Post
August 10th, 2008, 10:53 PM
Join Date: Oct 2007
Originally Posted by
I am a little confused by definition what is a mapheader and a pointer.
A pointer is a numerical reference to data or a piece of code. The game uses pointers to know where data is located.
If the offset ≥ 4000, then we can get its pointer by ((offset % 0x4000) + 0x4000). Say our offset is 0x034BB1:
0x034BB1 % 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
To calculate a pointer to a given offset, take the offset (say, 0x135276), modulus divide by 4000 (modulus division gives the remainder instead of the quotient, and is usually the “MOD” or “%” key on a calculator), add 0x4000, and switch bytes to get the two‐byte pointer. Then take the original offset and divide by 0x4000 to get your bank number, if needed.
Explanation of mapheaders
If you want me, please contact me
If you want to hack Pokémon RBY or GSC, read, read, and read some more.
This has tons of valuable information.
Pokémon Red disassembly project
Rules that should be rethought:
Bad posts are bad posts, regardless of how many words are in them or how old the thread is.
Good posts are good posts, regardless of how old the thread is—and brevity is underrated.
Last edited by IIMarckus; July 5th, 2009 at
View Public Profile
Send a private message to IIMarckus
Find all posts by IIMarckus
Find threads started by IIMarckus