• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Forum moderator applications are now open! Click here for details.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

A Beginners Guide To Hexadecimal Numbers

Darthatron

巨大なトロール。
1,152
Posts
18
Years
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 (
xGO9m.gif
) + R, typing "calc" into the box and pressing "OK". Looks like this.

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.

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.
 
Last edited:
3,830
Posts
14
Years
  • Age 26
  • OH
  • Seen Feb 26, 2024
Very nice. Well written, and you do a good job of explaining these foundational concepts.
 
4
Posts
11
Years
  • Seen Dec 6, 2012
This is seriously helpfull. I was just wondering...is this what's used to change offsets such as script offsets? Sorry if i sound noobish but everything I know about hacking was self taught so I thought I'd try this forum.
 

Darthatron

巨大なトロール。
1,152
Posts
18
Years
Very nice. Well written, and you do a good job of explaining these foundational concepts.
Thank you very much.
This is seriously helpfull. I was just wondering...is this what's used to change offsets such as script offsets? Sorry if i sound noobish but everything I know about hacking was self taught so I thought I'd try this forum.
Yes, offsets in the ROM are all stored in hex within the ROM, along with everything else in the game. When working with offsets and pointers, it can be a little confusing at first, but I will go in to more detail in the next part of the guide.

With scripts, it's mostly handled by the compiler so it's pretty easy. :)
 

Iacobus

sǝɯɐɾ
64
Posts
20
Years
First of all, why is this necessary?
I'm pretty sure there already is a thread like this somewhere. It is of course possible they are deleted or that their layout isn't as 'nice' as this one, but none the less.. I think you can find more useful and detailed documentation on the internet with a simple search.

Secondly, if you want to teach someone something, make sure you know what you want to teach.
Yes, offsets in the ROM are all stored in hex within the ROM, along with everything else in the game.
It's weird you're saying this, as in your 'tutorial' you correctly state that hexadecimal is just a number system, with a radix of 16.
Nothing is stored in hex, it's your editor that represents the data as such, because it's easier for humans to read, interpret and understand than a bunch of 0 and 1's.

Also, don't focus on a specific Windows OS, or any OS for that matter. I'm referring to that calc related paragraph.
Just get rid of it and learn them how to manually convert hexadecimal numbers to decimal, octal and/or binary.

It would be nice too, if people didn't post tutorials containing "Coming soon..." sections.
 

miksy91

Dark Energy is back in action! ;)
1,480
Posts
15
Years
First of all, why is this necessary?
I'm pretty sure there already is a thread like this somewhere. It is of course possible they are deleted or that their layout isn't as 'nice' as this one, but none the less.. I think you can find more useful and detailed documentation on the internet with a simple search.

Secondly, if you want to teach someone something, make sure you know what you want to teach.
It's weird you're saying this, as in your 'tutorial' you correctly state that hexadecimal is just a number system, with a radix of 16.
Nothing is stored in hex, it's your editor that represents the data as such, because it's easier for humans to read, interpret and understand than a bunch of 0 and 1's.

Also, don't focus on a specific Windows OS, or any OS for that matter. I'm referring to that calc related paragraph.
Just get rid of it and learn them how to manually convert hexadecimal numbers to decimal, octal and/or binary.

It would be nice too, if people didn't post tutorials containing "Coming soon..." sections.
Surely there are tutorials similar to this one (I can point out one straight out of head, a stickied thread in Zophar's Domain) and this may not turn out the best one of them. However, this "hacking" community is full of newbies playing around with tools who may not even realize to search for hex editing tutorials themselves. These beginners would more likely check out the tutorials section which we've got here (which really isn't the best possible it could be...) and see this tutorial that way. We got rid of the "Scrapbox" in the past, something similar could be done with the tutorials section by still keeping the "not so important" tutorials around to be found.

Yes, offsets in the ROM are all stored in hex within the ROM, along with everything else in the game. When working with offsets and pointers, it can be a little confusing at first, but I will go in to more detail in the next part of the guide.

With scripts, it's mostly handled by the compiler so it's pretty easy. :)
You're right about Darthatron talking "nonsense" here because "offsets being stored in hex within the ROM" means nothing but he clearly understands this as well. Would you assume a beginner who barely knows anything about programming or what bytes really are understand somebody explaining stuff in "language of programming" such as explaining everything based on binary instead? This would be a similar situation as running down people who think they know something about coding after studying programming languages in high school/university for a year or two.

Personally, I couldn't have explained what Darthatron did here better myself. Of course if you are talking to a more experienced person, you can try to convince him/her to understand what's really going on inside the CPU, why hex editors are much betters tools to use for hacking than binary editors, and such but no, not in a situation like this. And I have a strong feeling I said something here in a wrong way as well...

All of your points here are valid but my personal opinion is that proper explanations wouldn't be helpful for the majority of people around here. I learned the basics wrong myself and little by little, started to develop my knowledge about different kind of subjects related to coding, and haven't had any problems related to not learning everything correctly from the beginning (and the thing is that I don't think I would have gotten this far if there weren't "bad" but newbie-friendly explanations of different hacking related issues out there).
But what Darthatron could do with this thread is to expand it time after another and once enough is written, write in the end of the tutorial explaining how stuff really works out.
 
Last edited:

Darthatron

巨大なトロール。
1,152
Posts
18
Years
First of all, why is this necessary?
I'm pretty sure there already is a thread like this somewhere. It is of course possible they are deleted or that their layout isn't as 'nice' as this one, but none the less.. I think you can find more useful and detailed documentation on the internet with a simple search.
Because some people don't even know what to look for.
Secondly, if you want to teach someone something, make sure you know what you want to teach.
It's weird you're saying this, as in your 'tutorial' you correctly state that hexadecimal is just a number system, with a radix of 16.
Nothing is stored in hex, it's your editor that represents the data as such, because it's easier for humans to read, interpret and understand than a bunch of 0 and 1's.
I merely said it was "stored in hex" because the offsets and pointers referred to in every tutorial and piece of documentation, and the offsets and pointers handled by the games hacked by the users of this website are byte-based. It's a beginners guide, so why would I complicate things by explaining something they don't need to know?

I also resent you saying I don't understand what I am explaining.
Also, don't focus on a specific Windows OS, or any OS for that matter. I'm referring to that calc related paragraph.
Just get rid of it and learn them how to manually convert hexadecimal numbers to decimal, octal and/or binary.
The rest of the guide will also be windows based, since I don't have a Mac or run Linux.

Also, it's a guide called "A Beginners Guide To Hexadecimal".

And once again, the guide is targeted at beginners, so why would I complicate things with (somewhat) complex mathematics when a majority of the users on this forum are young? I plan on adding the less-easy way of converting some time soon, anyway.
It would be nice too, if people didn't post tutorials containing "Coming soon..." sections.
Thanks for the feedback.
 

Iacobus

sǝɯɐɾ
64
Posts
20
Years
@miksy91 and Darthatron (Warning: I might go slightly off topic here)
It's all about how you look at it. While it is true that there are lots and lots of newbies here whom don't know much about editing a ROM as they just click around in tools, we can't keep posting these 'beginners' guides/tutorials.

In my opinion a good tutorial should be written for everyone. Novice hackers start reading at the beginning where the basics are explained, while more experienced hackers can skip the basic stuff.
That way everyone can learn from it. Of course, once you are familiar with the topic, you would only use the tutorial as a reference for when you are uncertain about something.

Another reason for me disliking all these beginner tutorials is that they are just so.. TOO simple.
"Everything should be made as simple as possible, but not simpler." (Yes, pretty lame I use this quote, I know. Forgive me.)
While you don't want to overcomplicate things (a bunch of people writing tutorials here are good at that too), you too don't want to make it to easy. Give people a challenge! Let them discover something new. Learn them something they wouldn't think of learning on their own.

All of the above was in general, sharing how I think about it. Certainly not for writing off your guide.
I think you, Darthatron, should reconsider writing about manual conversion. You don't have to use scary numbers.

Trust me, there are a bunch of tutorials who are a lot worse. I just would like to see more detailed tutorials over here than the handful I can count. There are too many I-clicked-this-button-and-it-did-this-let's-write-a-tutorial-about-it-tutorial over here.

PS: If you want I can provide you with screenshots for Mac OS X, Windows XP and Ubuntu calculators.
 
Back
Top