Nana's PC98 Translations

Tutorials


Understanding PC-98 Pointers

What's the point?

Pointer hacking is an essential part of ROM Hacking. At its basest, pointer hacking allows one to choose where a game will decide to load text from -- usually to the extent of allowing a game more room to load certain lines, while also freeing up space elsewhere in code. While it is indeed possible to replace text in games without ever adjusting the pointers for them, this is highly inefficient.

As a simple rule, written Japanese is considerably shorter than English. Let's assume you're translating a game, and the script you want to insert must fit within the same space in code provided by the original Japanese script. If you are fortunate enough for the game you're toying with to accept half-width alphanumeric characters, then you should be able to fit roughly 2/3 of your translated script into the space provided. More commonly, if the game accepts only full-width alphanumeric characters, you may find yourself struggling to fit even half of what you want to say. This is where pointer hacking comes in handy.

Basic Formula

*This formula will not work for 100% of games.*

At their most basic, a pointer in a PC-98 game will usually be two bytes, or four hexadecimal characters. For the purpose of simplicity, I'll use the imaginary pointer 36 AD for these formulas.

In general, the two bytes of a pointer seem to be stored in reverse. Because of this, the hex character with the lowest value for this example pointer would be 6. So if you wanted to adjust a pointer to point exactly one byte ahead of where it was, you could change it to 37 AD.

Considering this, our pointer would have these values:

        16^1      16^0               16^3     16^2
        3          6                  A        D 
There are two basic steps in calculating pointers.
1: ADDING or SUBTRACTING 1 to the hex character with the value of 16^2
2: FLIPPING the bytes.

So where exactly do these pointers go? You can find out by converting the pointer to the offset it points to.

 
Converting from a Pointer to an Offset:

1: FLIP the bytes
Ex: 36 AD ----> AD 36.

2: SUBTRACT 1 from the hex char with the value of 16^2.
Ex: AD 36 ----> AC 36.

And ta-da, you have found that this pointer is pointing to the byte in code with the offset of AC 36.

Similarly, you will need to know how to look at characters in the game files, and determine what the value of the pointer is that would lead to them. This is simply the reverse of the formula we just used. So let's say the character you're looking at is located at the offset AC 36.

 
Converting from an Offset to a Pointer:

1: ADD 1 to the hex char with the value of 16^2.
Ex: AC 36 ---> AD 36
2: FLIP the bytes
Ex: AD 36 --> 36 AD

And just like that, you've calculated the pointer to your offset.