Quote:
Originally Posted by azurile13
Hmm. Maybe I'm not being clear. I'll be more specific. As an example, in my rom, the base stats table begins at 0x72D8A4. Now let's say I'm trying to look at the egg groups a pokemon is in. So I know that Bulbasaur's table entry begins at 0x72D8C0. I know that egg group 1 for Bulbasaur in specific is at offset 0x78D8D4 and I know that egg group 2 is at 0x72D8D5, and reading the values at both of those offsets, perfect, egg groups Monster and Grass. The problem, of course, is that I don't want a script that reads Bulbasaur's egg groups. I want a script that reads the egg group of an arbitrary pokemon species. I know the offset locations of the six or seven hundred pokemon in my pokedex, but it doesn't sound at all efficient to make 1400 pointers. My question was about a script reading off of a table so I wouldn't need to make those 1400 pointers, but it sounds like there isn't a script solution, so I suppose I'll need to borrow a PC :/
|
You'll have to do the following in assembly then;
0x72D8A4 + [Index Nr. of pokemon?] * [Size of one table entry] + 0x14 (= difference between start of the table entry and the first egg group value]
There is probably a simple multiply asm instruction you can use for calculating "Index" * "Size of table". If not, you'll need to build a loop that does the following;
5x4 = 4 + 4 + 4 + 4 + 4
So basically, if multiply instruction doesn't exist in GBA engine (it probably does but it doesn't in GB/C that I'm hacking), you'll have to use multiple "add"s in a row in a loop. But I don't think you'll have to do this really.
So basically, all you have to do is to:
1. Load the index value of the pokemon of which egg group you want to figure out to some register
2. Load the "size of one table entry" to a register
3. Multiply these two together and store the result in a register
4. Add 0x72D8A4 + 0x14 to that result.
After these four steps, the register should hold the value of the first egg group number of the pokemon you wish to know.
Anyway... if you don't have any sort of assembler or asm editor for that matter either that you can use, you could search for byte opcodes for GBA asm instructions and find a way to write the code with a hex editor that way. In case this turns out too unconvenient, ask somebody to assemble it for you. :)