Darthatron

December 4th, 2012, 1:20 AM

A Beginners Guide To Hexadecimal

An Introduction To Hexadecimal

Let's begin by saying hexadecimal is a number system, not a computer language as it's referred to by some people on this forum. Hexadecimal, or hex, is a base-16 number system mainly used by humans to understand, in a logical way, how computers use and store data.

The number system you're most likely used to, decimal, is a base-10 system, meaning that we have 10 unique symbols (0-9) to represent each individual value. From this you can probably guess that this simply means that a base-16 number system, like hexadecimal, has 16 unique symbols (0-9, A, B, C, D, E and F) to represent each individual value. You can even convert between hexadecimal and decimal with some mathematics, but you don't need to understand the conversion process for hacking Pokémon ROMs.

Counting In Hexadecimal

As previously stated, hexadecimal is effectively an extension of the decimal number system we're used to, increasing the number of symbols from 10 to 16, so counting in hexadecimal is really quite simple. Let's count to 16 in hexadecimal and decimal together, just to see the difference.

Decimal:1234567891011121314151617181920

Hexadecimal:123456789ABCDEF1011121314

As you can see, counting in hexadecimal is very similar to counting in decimal, except when you get to 9, you go to A instead of 10, and then once you get to F you go to 10.

Don't worry if this is a tad confusing for you as it will be explained a little more further in to the tutorial.

Telling The Difference

"But, Darthatron, how can I tell if I'm meant to use hex or decimal?" you may be asking. And the answer should be pretty clear...

If the number is prefixed with 0x or &H then you are definitely dealing with hexadecimal. However, there is also some other, less clear, ways of showing hexadecimal notation, such as: Leading zeros (010, for example, is probably 10 in hexadecimal, which is 16 in decimal); or a suffixed h (63h, for example, would be 63 in hex, which is 99 in decimal.)

In the real world, however, you're more likely to see it expressed as Number16. For example: 1016 would be 16 in decimal.

Converting Hex To Decimal And Back Again (The Easy Way)

It's really easy! And rarely actually ever required in the Pokémon ROM Hacking scene.

First of all, open up Windows Calculator. This can be done easily by pressing the Windows Key (http://i.imgur.com/xGO9m.gif) + R, typing "calc" into the box and pressing "OK". Looks like this. (http://i.imgur.com/MJCGc.png)

Once you're in the Calculator go to the View menu and select "Programmer". In this mode, you can toggle between hex and decimal. Looks like this. (http://i.imgur.com/qa963.png)

Selecting the "Dec" option and entering a decimal number and then selecting the "Hex" option will show you the hexadecimal value of the value you entered. The same applies for the reverse.

Editing A ROM In A Hex-Editor

Coming soon...

Comments/criticism appreciated.

An Introduction To Hexadecimal

Let's begin by saying hexadecimal is a number system, not a computer language as it's referred to by some people on this forum. Hexadecimal, or hex, is a base-16 number system mainly used by humans to understand, in a logical way, how computers use and store data.

The number system you're most likely used to, decimal, is a base-10 system, meaning that we have 10 unique symbols (0-9) to represent each individual value. From this you can probably guess that this simply means that a base-16 number system, like hexadecimal, has 16 unique symbols (0-9, A, B, C, D, E and F) to represent each individual value. You can even convert between hexadecimal and decimal with some mathematics, but you don't need to understand the conversion process for hacking Pokémon ROMs.

Counting In Hexadecimal

As previously stated, hexadecimal is effectively an extension of the decimal number system we're used to, increasing the number of symbols from 10 to 16, so counting in hexadecimal is really quite simple. Let's count to 16 in hexadecimal and decimal together, just to see the difference.

Decimal:1234567891011121314151617181920

Hexadecimal:123456789ABCDEF1011121314

As you can see, counting in hexadecimal is very similar to counting in decimal, except when you get to 9, you go to A instead of 10, and then once you get to F you go to 10.

Don't worry if this is a tad confusing for you as it will be explained a little more further in to the tutorial.

Telling The Difference

"But, Darthatron, how can I tell if I'm meant to use hex or decimal?" you may be asking. And the answer should be pretty clear...

If the number is prefixed with 0x or &H then you are definitely dealing with hexadecimal. However, there is also some other, less clear, ways of showing hexadecimal notation, such as: Leading zeros (010, for example, is probably 10 in hexadecimal, which is 16 in decimal); or a suffixed h (63h, for example, would be 63 in hex, which is 99 in decimal.)

In the real world, however, you're more likely to see it expressed as Number16. For example: 1016 would be 16 in decimal.

Converting Hex To Decimal And Back Again (The Easy Way)

It's really easy! And rarely actually ever required in the Pokémon ROM Hacking scene.

First of all, open up Windows Calculator. This can be done easily by pressing the Windows Key (http://i.imgur.com/xGO9m.gif) + R, typing "calc" into the box and pressing "OK". Looks like this. (http://i.imgur.com/MJCGc.png)

Once you're in the Calculator go to the View menu and select "Programmer". In this mode, you can toggle between hex and decimal. Looks like this. (http://i.imgur.com/qa963.png)

Selecting the "Dec" option and entering a decimal number and then selecting the "Hex" option will show you the hexadecimal value of the value you entered. The same applies for the reverse.

Editing A ROM In A Hex-Editor

Coming soon...

Comments/criticism appreciated.