GameGenie Patching
GameGenie was a device created by codemasters and galoob that
let you make cheats for games. It was plugged in the console like a normal
cartridge, and in its top the desired cartridge was plugged. These cheats are
possible because what GameGenie do is edit the RAM that stores values used by
the ROMs, setting these values to a constant that can be, for example, the
number of lifes you have!
Genecyst was the first Genesis emulator to have support
for GameGenie then, with Kgen98, Steve Snake started to use this neat feature
in his great emulator. No ROM image of a GameGenie is necessary, as some may
imagine, to use them with console emulators, these programs themselves have a
built-in feature that acts like a GameGenie, writing the codes in the emulated
RAM.
The GameGenie code consists of a eight-bytes long string, and
the valid characters are A, B, C, D, E, F, G, H, J, K, L, M, N, P, R, S, T, V,
W, X, Y, Z, 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9, all in uppercase. Each character
have a binary repressentation, which is 5-bits long.
Char |
Value |
A | 00000 |
B | 00001 |
C | 00010 |
D | 00011 |
E | 00100 |
F | 00101 |
G | 00110 |
H | 00111 |
J | 01000 |
K | 01001 |
L | 01010 |
|
Char |
Value |
M | 01011 |
N | 01100 |
P | 01101 |
R | 01110 |
S | 01111 |
T | 10000 |
V | 10001 |
W | 10010 |
X | 10011 |
Y | 10100 |
Z | 10101 |
|
Char |
Value |
0 | 10110 |
1 | 10111 |
2 | 11000 |
3 | 11001 |
4 | 11010 |
5 | 11011 |
6 | 11100 |
7 | 11101 |
8 | 11110 |
9 | 11111 |
|
The cheat code should be firstly converted directly using the
table above, and then the bits should be reordered. For example, the GameGenie
code SCRA-BJX0 is translated to:
|
S | C | R | A |
01111 | 00010 | 01110 | 00000 |
ijklm | nopIJ | KLMNO | PABCD |
|
|
B | J | X | 0 |
00001 | 01000 | 10011 | 10110 |
EFGHd | efgha | bcQRS | TUVWX |
|
Then rearrange (using the id) as...
|
00000000 | 10011100 | 01110110 |
ABCDEFGH | IJKLMNOP | QRSTUVWX |
|
|
01010100 | 01111000 |
abcdefgh | ijklmnop |
|
Which give us, in hexa, 009C76:5478. This means that
H5478 will be written at H009C76 memory offset.