- 4
- Posts
- 7
- Years
- Seen Feb 21, 2019
The main question I have is how do I make a pointer to an address in another bank work?
For the past couple days I've been fiddling with an Hex Editor and checking the inner workings of Pokémon Gold. With the help of this very forum, I found the type effectiveness chart in address 0x34D01. The type chart is composed of three bytes for each type effectiveness to consider. (Those not in the list are assumed by the game to be normal effectiveness.)
Problem
In normal circumstances this list has length of 332 bytes, which includes a "Foresight demarcation" byte FE and a termination byte FF, totalling 110 type interactions. The two pointers that make use of this list, as far as I can tell, are in addresses 0x34891 and 0x34935 in the same memory bank. It's attractive to add more types into the engine, which is what I am looking into. Adding the Fairy-type, for example, would yield 12 more type interactions to consider, which would mean adding 36 new bytes to the list. This is impossible where the list stands in the memory since it's tightly surrounded on both ends by relevant engine data.
Possible solution
The bank this list is allocated in is unusually tight and not flexible at all. There is no space at the end to copy the list and expand it. The only other option is to write it in another free space in a different bank and have the pointers point to them. This is where I hit a brick wall. Doing so in, for example, the free space in the bank right after (address 0x3B6A0) means setting the pointers to A0 76, which does not work at all. Am I missing something in doing this? I'm guessing it needs another byte to specify the bank number, but this would write over bytes right after the pointers.
For the past couple days I've been fiddling with an Hex Editor and checking the inner workings of Pokémon Gold. With the help of this very forum, I found the type effectiveness chart in address 0x34D01. The type chart is composed of three bytes for each type effectiveness to consider. (Those not in the list are assumed by the game to be normal effectiveness.)
Problem
In normal circumstances this list has length of 332 bytes, which includes a "Foresight demarcation" byte FE and a termination byte FF, totalling 110 type interactions. The two pointers that make use of this list, as far as I can tell, are in addresses 0x34891 and 0x34935 in the same memory bank. It's attractive to add more types into the engine, which is what I am looking into. Adding the Fairy-type, for example, would yield 12 more type interactions to consider, which would mean adding 36 new bytes to the list. This is impossible where the list stands in the memory since it's tightly surrounded on both ends by relevant engine data.
Possible solution
The bank this list is allocated in is unusually tight and not flexible at all. There is no space at the end to copy the list and expand it. The only other option is to write it in another free space in a different bank and have the pointers point to them. This is where I hit a brick wall. Doing so in, for example, the free space in the bank right after (address 0x3B6A0) means setting the pointers to A0 76, which does not work at all. Am I missing something in doing this? I'm guessing it needs another byte to specify the bank number, but this would write over bytes right after the pointers.