NES Game Genie Technical Notes

The NES Game Genie from Galoob is a device that allows a player to enter a variety of codes into a Nintendo Entertainment System game in order to cause the game to do things it would not normally do, e.g., grant the player extra (or fewer) lives at startup, give the player extra items, change the gameplay, or just cause crazy things to happen.

The NES Game Genie works by allowing the player to plug an NES game cartridge into it and then plug the Game Genie into the NES console in place of the cartridge. The Game Genie then allows the player to enter a code which consists entirely of letters. The codes come in two flavors: 6- and 8- character. The codes translate into addresses and data in a game's program space (upper half of address space, 0x8000-0xFFFF) which the Game Genie fools the CPU into using rather than the byte which is supposed to be there. Because of this method, there is no limit to the number of Game Genie codes that can be discovered.

6-Character Codes

To decode an NES Game Genie code, first translate each character into its hexadecimal equivalent using the following table:

A 0x0 P 0x1 Z 0x2 L 0x3 G 0x4 I 0x5 T 0x6 Y 0x7 E 0x8 O 0x9 X 0xA U 0xB K 0xC S 0xD V 0xE N 0xF

In order to decode the 6-character NES Game Genie code, name the 6 characters/hex values [n0 .. n5]. Follow the pseudocode (which assumes you know the C-style operaters for bitwise AND (&), bitwise OR (|), and the << and >> bit shift operators):

address = 0x8000 + ((n3 & 7) << 12) | ((n5 & 7) << 8) | ((n4 & 8) << 8) | ((n2 & 7) << 4) | ((n1 & 8) << 4) | (n4 & 7) | (n3 & 8);

data = ((n1 & 7) << 4) | ((n0 & 8) << 4) | (n0 & 7) | (n5 & 8);

n0 n1 n2 n3 n4 n5 G O S S I P 0x4 0x9 0xD 0xD 0x5 0x1 0100 1001 1101 1101 0101 0001 address = 0xD1DD, data = 0x14

8-Character Codes

The algorithm for decoding the address of an 8-character code is the same as decoding the address for a 6-character code. The algorithm for decoding the data byte changes a little:

data = ((n1 & 7) << 4) | ((n0 & 8) << 4) | (n0 & 7) | (n7 & 8);

compare = ((n7 & 7) << 4) | ((n6 & 8) << 4) | (n6 & 7) | (n5 & 8);

n0 n1 n2 n3 n4 n5 n6 n7 Z E X P Y G L A 0x2 0x8 0xA 0x1 0x7 0x4 0x3 0x0 0010 1000 1010 0001 0111 0100 0011 0000 address = 0x94A7, data = 0x02, compare = 0x03

- The Mighty Mike Master