’Cause all games were better on the GBC

You are not logged in.

#1 2018-05-14 23:34:37

New member
Registered: 2018-05-14
Post 1/9

Expanding a list by reallocating it [Gold]

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. 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.)

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.

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.

Last edited by ElectroMan (2018-05-14 23:38:16)


#2 2018-05-14 23:54:37

Registered: 2009-11-25
Post 3,547/3,665

Re: Expanding a list by reallocating it [Gold]

Is there any reason why you're trying to hack Gold and do it the old fashioned way instead of using the pokecrystal disassembly? Just curious, since this would be infinitely easier with Pokecrystal.

I am not very active on this forum. I only pop in from time to time.


#3 2018-05-15 08:36:10

New member
Registered: 2018-05-14
Post 2/9

Re: Expanding a list by reallocating it [Gold]

I'm thinking of programming a tool that directly accesses these bytes and flips some addresses, essentially to create a randomizer. Since I only need to find the addresses by having a lookup list and perform an action to them according to another list, I thought it'd be easier to just look into the data directly and do the randomizing from there. Additionally, I'd like to have an option to add another type to the game if the user wishes to, which would tell the tool to do the operations necessary for that.

What I can do is do it through the disassembler, look into what changes in the ROM, and then manually encode the instructions. I just thought there would be a way of quickly doing it as I said, manually.

EDIT: I've read through this tutorial. Indeed it is quite easy to do. So obviously it is possible to assemble the program to access a freer space to access the type chart. I will run pokecrystal on a Gold ROM, analyse the difference between an unchanged ROM and one where the type is added, and I will return with my findings.

EDIT2: My findings are posted here.

Last edited by ElectroMan (2018-05-16 11:43:38)


Board footer

Powered by FluxBB