




As the great Strongbad once said, '"technology"... means... "magic". It's basically anything that's really cool that you don't know how it works.'
And that's what early video games were to us as kids. We didn't have the faintest clue how they worked, what 8-bit or 16-bit meant, or why there were specific limitations and not others. They may as well have been magic. We did know though, that they were really cool. Instead of moving plastic pieces around a board, or watching the fixed animation of a television show, video games amazed us with the ability to actually be a part of different worlds, each with their own characters and rules. They'd wow us with their graphics and sound, and endear us with the fun they'd provide for us. However, as anybody who played those old video games know, they had an ability to enrage and frustrate like almost nothing else in nature. Sometimes that gaming magic was good, and sometimes, it was very, very bad.
Despite the fact that early video games were marketed directly towards kids, they were often merciless. Requiring absolutely perfect timing, or memorizing complex enemy movement patterns, and since losing all your lives would often require you to start all the way from the beginning, there was usually very little room for error.

So how do you outsmart gaming magic? Well, you go up the chain of command. You're going to need a genie. A Game Genie.
The Game Genie was a device created by the company Galoob to facilitate cheating in old Nintendo, and later Super Nintendo and Genesis games. You'd put the game inside the Game Genie, put the Game Genie in the system, and once you turn on the system you'd be presented with a screen to enter some codes. You'd enter some specific codes for that game and start the game, and suddenly now you'd start with 99 lives, or be invincible, or begin on the last level. Now the tables you were turned. You had a genie on your side.
The Game Genie originally came with a book of codes to use on the most popular games, and sometimes magazines would publish new codes, which was alright. And from what I understand there was a newsletter you could subscribe to that would send you new codes, though I never did sign up for it. If you didn't get the code from somewhere else, it was for the most part just a lucky guess if you managed to figure out one. They actively encouraged experimenting to try and find new ones. However, that could be an incredibly frustrating task. For the most part whenever I tried as a kid the codes just messed up the game. Sometimes the colours would be all wrong or things would flicker, but usually the codes wouldn't seem to do anything at all. We didn't have the faintest clue how these strange incantations worked to somehow give us extra weapons or stronger armour. It may as well have been an actual genie who only understood a foreign language (and probably only Ithkuil at that).
Well, it's time to break the sorcery down and look at the man behind the curtain. We're going to dig into how the game genie worked.
A lot of these early video game systems and technologies are great examples to learn the basics of computing from. They seem like unfathomable black boxes when you're a kid, but they're actually quite simple internally. The Game Genie was no exception, however I'll have to outline the basics of how games worked back then.
Those cartridge games were rarely electronically complicated. For the most part, they simply stored all the code and data for the game as a whole bunch of bytes across a bunch of fixed ROM chips. These chips for the most part just... sat there, connected to the system through the copper connectors at the bottom of the cartridge.
These connectors would connect to contacts inside the system that would connect it to the CPU in the NES/SNES/Genesis/Etc. This way the CPU could get the data from inside those ROM chips. It could make requests to the cartridge for specific data, and the cartridge would return the data requested.
Now, in order to be able to specify the exact data that the CPU wants at a given time, there has to be a way to say which it wants. This is accomplished by giving every byte of data in the cartridge a number, or 'address' so that the processor can communicate with it.
When the system would power up, it would begin by requesting the ROM to send it the bytes of code at a specific address to begin running it. That code, in turn, would have the processor fetch other code and data from the ROM to actually present graphics and sound and process the actual input and output to be the actual game itself.
So, in a very simple description, every piece of data resides at specific address in the cartridge. Every letter that gets displayed, every instruction to check if you were hit, and every initial value for your character's health sits around in ROM chips on the cartridge waiting to be retreived. There is some more complexity than that, involving such things as bank switching and whatnot, but that's far more complicated than I need to make it for this example. Just forget that I ever said the words 'bank switching'. You'll be happier that way (far, far happier).
So what would happen with the Game Genie is the system would power on, and begin executing the code stored in ROM inside the Game Genie itself. The Game Genie was essentially a 'game' which would run like any other. Its code was very simple, it would present a screen for the user to input codes, and take input from the controller to move the cursor around the screen and such. Once the user pressed the 'start' button to begin the game, it would store those codes internally, and then, very importantly, no longer respond directly to requests from the processor. Instead, since the attached game cartridge itself was directly connected to the Game Genie, it would now route all address requests back to the normal cartridge itself.
So now, the game would begin none the wiser, thinking that it had been just powered on, and the processor wouldn't know any different since all it sees, so to speak, is the data given to it from whatever is connected to the cartridge slot when it asks for the data from specific addresses. It doesn't know that it's now talking directly to the cartridge now. It always thought it was.
In effect, it picks up the phone when the "phone" first rings, then hands the call off to someone else (the game cartridge) without telling the other side (the system).
The 'magic' happens now. The Game Genie is almost entirely silent, except when the game system requests a few very specific addresses. It will no longer route the request directly to the cartridge, but will instead give its own data. Those addresses and pieces, you may have guessed, are in the codes. All those codes are, are memory address and the data which to override them with.
Using the phone analogy, it's as if the Game Genie, when it hears that the CPU is asking for specific information, puts its hands over the cartridge's mouth and instead shouts something different.
So when the system starts running the game's code, and it wants to load that initial value for your ammo or health from a specific address in the cartridge's ROM chips, the Game Genie would give that new value instead of the old, letting you give yourself 99 lives, or changing the amount of damage enemies cause to 0. Very sly and silently, it overrides very tiny portions of the game.
You can think of this all as a very, very simple patching system. It, in a way, 'overwrites' a few memory addresses with specific bytes of data.
So that's how the codes worked. Inside that small amount of data was the address it was overriding, and the data that it should give instead (well, the NES one had a little extra - but for simplicity let's forget about that).
Now, you can stop this right now if you're satisfied with that general overview. You now have the basic understanding of how early cheat systems worked. However... if you want something a bit more... technical, keep going.
...
...
...still here? Ok, if you look at the code entry screen, you'll notice the number of possible characters is 16, suspiciously similar to hexidecimal, which has 16 characters.
Let's look at a very simple code. We'll use one from the Super Nintendo Game Genie just because it's simpler:
The code 14B4-6F07 gives you 99 lives in Super Mario World. Since each character has 16 values, it can be represented in 4 bits. Since there are 8 characters in the code, it's 32 bits, or 4 bytes. Now these values are in hexidecimal, which is a numbering system that has 16 possible characters for each digit. I won't be getting into that, but let's just say it's easier to display the value of a single byte (8 bits) this way. We can put that hyphen in the code a little earlier to make it easier to read.
14 - B46F07
The value 14 represents the value that will be used and the other 6 characters represent the address.
Unfortunately, Galoob decided that instead of just using exact values, they do some crazy math with these codes. I have no idea why. Perhaps to make it seem more magical. Fortunately, people have written up converters online, so let's put the code through it. There's no good reason why this has to be done, but I'm assuming management was involved.
Anyway, we end up with this if we run it through the conversion:
The address part is 009E25, and the value that is placed there is 62 in hexidecimal, which is actually the number 98 in our regular base-10 number system.
So what happens is when the CPU requests the address 009E25 from the cartridge, the game genie will instead give it the value 98. You may be wondering why it's 98 instead of 99 since it's supposed to be a 99 lives code. Well, in Super Mario World, having 1 life left actually acts as having 0 lives left, as you get a game over if you lose with one life left. So I seems it's just offset by 1.
Now that we've taken a code apart, let's try to build one.

At the start of Final Fantasy III you can't change the names of Vicks or Wedge in your initial party. Let's try to make some changes ourselves. How about... we change Wedge to... Wedgie. I am a man of... simple humour.
I'll save you the work, and let you know that the address that stores the name of Wedge in all that mess of data is C47980. That address points at the first letter. We don't want to change the first letter, but the 5th and 6th. So we add 4 and 5 to get the addresses of those specific letters, which gives us C47984 and C47985. Phew. Well, internally Final Fantasy 3 stores the letter I as 88 (in hexidecimal, and) the letter E as 84 (in hexidecimal). So, we need to put 88 in address C47984 and 84 in address C47985. We can use a tool such as ggencoder to do the math to create the actual code and we end up with the following two codes:

6656-5FF4 - Puts the I in the name
6056-5F94 - Puts the E in the name
Now if you start the game, go through the intro text, and open the party screen once you have control, you'll notice the name Wedge has now become Wedgie. Teehee. Teehee, indeed.
So that's how the Game Genie works. In short, the player enter values for given addresses, and it secretly gives the system that data for those addresses instead of the data from the cartridge.
Hopefully that wasn't too much to digest at once, if you stuck it out to the end of this post. And don't be afraid if you didn't understand all that. It can be intimidating. It's also not particularly useful knowledge unless you plan on making more codes.
Oh, and yes, it did take a bit of work figuring those things out about Final Fantasy 3. I wouldn't recommend digging into it unless you have a lot of time on your hands.
...I must have too much time on my hands...