# Skeetendo

’Cause all games were better on the GBC

You are not logged in.

## #1 2011-12-29 00:43:56

agentgeo
Member
Registered: 2011-08-26
Post 4/14

### Pointers

I'm having trouble with this. Could someone give me a link, or an explanation as to how pointers work. (Calculating as well as un-calculating).

Offline

## #2 2011-12-29 00:49:39

tekcoR
Member
Registered: 2010-10-16
Post 96/165

Data Crystal

Cya

Offline

## #3 2011-12-29 01:03:03

Member
From: US, Ohio
Registered: 2011-08-27
Post 382/649

### Re: Pointers

Pointerberechner

Pokemon Blue DX is reborn!

Offline

## #4 2011-12-29 01:08:43

agentgeo
Member
Registered: 2011-08-26
Post 5/14

### Re: Pointers

Thanks, pointers make a lot more sense now.

Offline

## #5 2011-12-29 06:27:53

Miksy91
Member
Registered: 2010-10-16
Post 701/2,317

### Re: Pointers

I've got two videos about pointers, you can find the link to both of those in one of the sticky threads in Gen II section.

Offline

405/701

Looks correct.

## #7 2011-12-29 19:00:13

agentgeo
Member
Registered: 2011-08-26
Post 6/14

### Re: Pointers

Okay, I understand how to find pointers, but how do I get the offset from a 2 byte pointer?

Offline

## #8 2011-12-29 20:20:28

Sawakita
Registered: 2010-10-16
Post 250/364

### Re: Pointers

Or faster:

``[effective address] = [bank ID] * 0x4000 + [pointer (big endian)] % 0x4000``

Without the bank ID, you don't know where that pointer points (well, if there isn't a part in the code where the bank is specified, it is usually the same bank as the bank where the pointer is, so to get the bank ID just use the address where the pointer is), unless the pointer is less than 0x4000, in which case you know for sure it points to bank 0x00 (the fixed bank).

``[bank ID] =  [effective address] / 0x4000``

Offline

## #9 2011-12-29 20:20:59

agentgeo
Member
Registered: 2011-08-26
Post 7/14

### Re: Pointers

kkj1116 wrote:

Use the steps I put above.
2-byte pointers don't point outside of their bank so their [zz] value (bank value in hex) is the bank of where the pointer is located.

Example: Pointer is 5A 4E and it starts at hex offset 32410.
1. Flip [xx][yy]: so result is 4E 5A.
2. Subtract x4000, so youll get: 0E 5A
3a. Since it has no [zz], you have to get it from where it's located: so it's located at 32410. Divide that by x4000 to get its bank = 0C
3b. Now you have the [zz], you can multiply it by x4000 = 30,000.
4. Add #2 and #3b which are: 0E 5A + 30,000 = 30E5A.
That's the offset where 5A4E points to.

* To verify my statement that 2-bytes don't point outside, divide 32410 by x4000 and 30E5A by x4000.
They are both in bank x0C, or the 12th bank.

Okay, I finally get it! Thanks. :)

Offline

## #10 2011-12-30 06:35:31

Member
From: US, Ohio
Registered: 2011-08-27
Post 393/649

### Re: Pointers

You should post that new tool agentgeo. Just include the bank part as well, and it'll be the best there is, better than the one I posted.

EDIT: Nvm, I see it. Still, my recommendation would work wonders.

Last edited by tysonrss (2011-12-30 06:36:42)

Pokemon Blue DX is reborn!

Offline