A New Numbering System

Binary: Ones and Zeroes
Computers use binary. Lots of binary.

What is binary you ask? Binary is a method of representing numbers and data using only two possible digits: 0 and 1. 0 means "false" and 1 means "true". By putting together a huge list of ones and zeroes, or "trues" and "falses", we can create the language of computers.

Computers see absolutely none of the things that you see. You may see text on a screen. You might see a video, or an image. You might be playing a game. The computer does not care. To the computer, every file that you have is just a long string of binary digits. A series of 1s and 0s arranged in a certain order.

Of course, when those binary digits are processed, they (amazingly) form together to create something as complicated as a video, image, or a game that you can view on your screen.

There is a huge problem with binary. Humans have trouble reading it. A lot of trouble. I'll give you an example. Read this:
Okay. You read it. "Zero, one, zero, zero, zero, zero, one, one, zero... blah blah blah." What does it mean? You probably have no idea.

The string of binary digits you just read simply creates the two words "Cave Story", as a computer might see it. If I change the 4th binary digit to a 1 instead of a 0, it will now say "Save Story". But only the computer knows that - you have no easy way of translating it.

Hexadecimal: Compressed Binary
Some smart person came along one day and said, "Binary is too long. I wonder if I can make it shorter."

And so he did.
0000 -> 0
0001 -> 1
0010 -> 2
0011 -> 3
0100 -> 4
0101 -> 5
0110 -> 6
0111 -> 7
1000 -> 8
1001 -> 9
1010 -> A
1011 -> B
1100 -> C
1101 -> D
1110 -> E
1111 -> F
(The -> thing is just an arrow.)

This is hexadecimal. In hexadecimal, each string of 4 binary digits can be represented as a single hexadecimal digit. Our normal counting system only uses the digits 0 through 9. But hexadecimal uses the digits 0 through F.

Yes, in hexadecimal, things like A, B, C, D, E, and F are considered numbers, not letters. That means that 200 is a perfectly valid hexadecimal number just as much as 2FA is also a valid hex number.
Hexadecimal: 43 61 76 65 20 53 74 6F 72 79
Text:        C  a  v  e     S  t  o  r  y
As you can see, hexadecimal still isn't really human readable. However, it's a lot better than binary, which is just too long.

Now you should know that each text character (at least the English ones) can be represented with 2 hexadecimal digits. Each group of 2 hexadecimal digits is actually a number known as a byte. Each character is worth 1 byte.

In assembly, we will usually use bytes to mean numbers, not text characters. Also, the only reason we're doing this is because OllyDbg represents (almost) all of its numbers as hexadecimal numbers.

Previous Lesson: Olly Debug
Next Lesson: Converting Hex and Decimal
Table of Contents