News: 11 March 2016 - Forum Rules

Author Topic: Is there an easy way to find the pointer table address in a GBC rom?  (Read 610 times)

Nebba

  • Jr. Member
  • **
  • Posts: 14
    • View Profile
Is there a way to find an easy way to pointer table in a GBC rom? knowing the pointer table address will help me will help me in my ENglish translation project

Cyneprepou4uk

  • Hero Member
  • *****
  • Posts: 688
  • I am the baldest romhacker
    • View Profile
Re: Is there an easy way to find the pointer table address in a GBC rom?
« Reply #1 on: June 16, 2021, 04:28:34 pm »
Pointers are usually located right before the things they point at.

Is there a way to find an easy way

 :D

MysticLord

  • Full Member
  • ***
  • Posts: 195
    • View Profile
Re: Is there an easy way to find the pointer table address in a GBC rom?
« Reply #2 on: June 16, 2021, 08:00:05 pm »
Is there an easy way to find a pointer table in a GBC rom? knowing the pointer table address will help me will help me in my ENglish translation project
I don't know if GBC is little or big endian - most things are little endian - but if you know the address, open the file in a hex editor with a Count function (I use XVI32 hex editor), and count all instances of the address in little endian.

So if the address is 0x3aa, Count "aa 03".

I don't know what sort of bank switching scheme the GBC uses, if any, but I guess that most pointers will be to things within their own bank. You can use that to narrow down your search a bit, both in the range of locations you need to search and the number of bytes in each pointer.

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7183
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Is there an easy way to find the pointer table address in a GBC rom?
« Reply #3 on: June 16, 2021, 10:33:37 pm »
On GB/GBC, you can pretty much expect that $0000-3FFF is mapped to the first 16KB of the ROM, and all other ROM banks get paged in at $4000-7FFF.
I'm not sure if there's some odd mapper that doesn't follow that.
"My watch says 30 chickens" Google, 2018

343

  • Jr. Member
  • **
  • Posts: 97
  • Gameboy Color Rules!
    • View Profile
Re: Is there an easy way to find the pointer table address in a GBC rom?
« Reply #4 on: June 17, 2021, 11:58:25 pm »
On your other post you said that you are translating sakura wars and your text start at  0x106091 if that is the case, this is my explanation.

As KingMike have said each gbc bank have $4000 bytes

0x106091/0x4000=0x41
Your text is at bank 41

0x41*0x4000=0x104000

your bank start at the offset 0x104000 and ends at 0x107FFF (108000 is bank 42)

your pointer table have to be between those offsets.

0x106091 this is you text offset.

take the last four digits of the offset, and cut off the rest.

6091

now a couple of rules:
If the offset is from 0000-3FFF, add 4000 to the offset.
If the offset is from 4000-7FFF, do not add anything to the offset.
If the offset is from 8000-BFFF, subtract 4000 from the offset.
If the offset is from C000-FFFF, subtract 8000 from the offset.

6091 is from 4000-7FFF, so do not add anything to the offset.

Because Game Boy is little endian, switch the first two digits with the last two

9160 this is your pointer.

You can go to your bank offset 0x104000
and do an hex search for 0x9160 value. the hole blocks is your pointers table:

Take in care that sakura is an MB5C game. and have a lot of text.
and probably the pointers are in 3 Byte Pointers mode.

The same logic apply to other games if your question isn't about sakura wars.

To do this math you have to use a calculator in hexadecimal mod.
there is gameboy calculator pointer out there too.

Nebba

  • Jr. Member
  • **
  • Posts: 14
    • View Profile
Re: Is there an easy way to find the pointer table address in a GBC rom?
« Reply #5 on: June 18, 2021, 06:10:33 pm »
On your other post you said that you are translating sakura wars and your text start at  0x106091 if that is the case, this is my explanation.

As KingMike have said each gbc bank have $4000 bytes

0x106091/0x4000=0x41
Your text is at bank 41

0x41*0x4000=0x104000

your bank start at the offset 0x104000 and ends at 0x107FFF (108000 is bank 42)

your pointer table have to be between those offsets.

0x106091 this is you text offset.

take the last four digits of the offset, and cut off the rest.

6091

now a couple of rules:
If the offset is from 0000-3FFF, add 4000 to the offset.
If the offset is from 4000-7FFF, do not add anything to the offset.
If the offset is from 8000-BFFF, subtract 4000 from the offset.
If the offset is from C000-FFFF, subtract 8000 from the offset.

6091 is from 4000-7FFF, so do not add anything to the offset.

Because Game Boy is little endian, switch the first two digits with the last two

9160 this is your pointer.

You can go to your bank offset 0x104000
and do an hex search for 0x9160 value. the hole blocks is your pointers table:

Take in care that sakura is an MB5C game. and have a lot of text.
and probably the pointers are in 3 Byte Pointers mode.

The same logic apply to other games if your question isn't about sakura wars.

To do this math you have to use a calculator in hexadecimal mod.
there is gameboy calculator pointer out there too.

Thank you very much for your help