*******************************
* PART 10: HEX MARKS THE SPOT *
*******************************
<10.1> Introduction-----------------------------------------------------------
Note: The letter "h" after a number or the character "$" before a number
indicates that number is in base 16 (hexadecimal). It is not
actually a part of the value; it merely distinguishes it from a
decimal number.
Each Game Genie code is like an encoded hexadecimal number. Hexadecimal
is a base 16 number system, with the digits 0 through 9 and A through F.
Instead of "9" having the largest value like in our decimal system, Fh has
the largest value.
<10.2> Hex Counting-----------------------------------------------------------
If you were to count in hexadecimal, the sequence would be:
00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 0A, 0B, 0C, 0D, 0E, 0F, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 1A, 1B, 1C, 1D, 1E, 1F, 20, 21, 22, .... [all h]
Ah is equivalent to 10, Bh = 11, Ch = 12, Dh = 13, Eh = 14, and Fh = 15.
Because there are 15 numbers (excluding 0) before "10" in hexadecimal,
10h is equal to 16. Therefore, instead of having the "ones", "tens",
"hundreds", and "thousands" place like in base 10, we have the "ones",
"sixteens", "256s", and "4096s". The number "5" in the number 50h is actually
worth 16 x 5 = 80. "8" in 8A0h is worth 256 x 8 = 2048.
Let's try to decode the hex number 3E5h.
TWO-HUNDRED FIFTY-SIXES SIXTEENS ONES
----------------------- -------- ----
Hex Number 3 E 5
Dec Number 3 14 5
Dec Value 256 x 3 = 768 16 x 14 = 224 5 = 1 x 5
To get the total value of the number, add the decimal values
of all the places together.
Total Value = 768 + 224 + 5 = 997.
<10.3> What's in a Code?------------------------------------------------------
Why are we learning about hexadecimal? Because the a Game Genie code
is actually an encoded, 8-digit hexadecimal number. Before we get to what,
exactly, each digit of that number represents, we must break the GG's
encyphering scheme.
The "effect chart" mentioned in the above part is actually a substitution
cypher that the GG uses to encode memory addresses. This code is ALWAYS the
same; even though the effects chart can be reversed, this is due to the game's
setting a factor to "LOWER NUMBER = MORE EFFECT". Everything in a game is
controlled by a number, or a combination of numbers.
Here, now, is the Game Genie's encoding scheme. Since you will most often
use direct numerical substitution with the first two alphanumerics, there
are columns on the chart which indicate those digits' values.
In a code XY00-0000, X + Y = the value of the first two digits.
<10.4> Numerical Value Chart--------------------------------------------------
VALUES:
(X) (Y)
GG HEX DECIMAL 1ST 2ND
-- --- ------- --- ---
D 0h 0 0 0
F 1h 1 16 1
4 2h 2 32 2
7 3h 3 48 3
0 4h 4 64 4
9 5h 5 80 5
1 6h 6 96 6
5 7h 7 112 7
6 8h 8 128 8
B 9h 9 144 9
C Ah 10 160 10
8 Bh 11 176 11
A Ch 12 192 12
2 Dh 13 208 13
3 Eh 14 224 14
E Fh 15 240 15
<10.5> Examples of Decoding the First Two Digits------------------------------
E2 = 253 X = E = 240 | 17 = 99 X = 1 = 96
Y = 2 = 13 | Y = 7 = 3
X + Y = 253 | X + Y = 99
-----------------------------------------------------------------------
10 = 100 X = 1 = 96 | A6 = 200 X = A = 192
Y = 0 = 4 | Y = 6 = 8
X + Y = 100 | X + Y = 200