Code:
[Note: This guide was written in October 1996 with the Game Gear in mind.However, ALL of the following information applies equally to Gameboy and
Game Gear. In fact, I could remove all occurrences of the words "Game Gear"
and make it a two-system guide, but there's far too many. The Gameboy GG
is identical in every way to the information below.]


Game Gear Game Genie Programming for Dummies
Version 4


For anyone that actually owns a Game Gear....


Compiled by Cheatmaster
April 1999


WARNING! The following is mind-numbing and was written by an Insane Person!


************************************************************************


Contents:


	*Revision History
	I. Introduction to code making
	II. All the acknowledgments I could possibly think of
	III. Overview of Game Gear codes
	IV. Overview of addresses and data
	V. Characters 1 & 2
	VI. Characters 3, 4, 5, & 6
	VII. Characters 7, 8, & 9
	VIII. Hidden messages in GG
	IX. What to do when a code pukes on you
	X. Conclusion
	*Appendix: Code decoding
	*Glossary


************************************************************************


*Revision History


Version 1: Actually wrote the thing! Woo hoo!


Version 2: Moved that HUGE paragraph on hexadecimal to a separate appendix; 
should make for some easier reading. Moved vocabulary terms to a separate 
glossary, so that terms you may already know don't get in your way (terms are arranged in the glossary in the order they appear in the text). Added full text of hidden messages, and fixed the incorrect code. (Hopefully) fixed the awkward line breaks, where sentences would be broken about halfway through....


Version 3: This time, really fixed the line breaks!! Seriously, 3/4ths of
the information in the first 2 guides was ***WRONGGGG***. Almost the ENTIRE
thing must be re-written!!!!! If you actually learned from this guide,
un-learn it all now. MAN, I must have been guessing at half of this stuff. Oh, and deleted the paragraph on hexadecimal (you're not stupid) and replaced it with the code cipher (more useful, and I only just got it).


Version 4: Got more codes for the hidden messages in the code screen (thanx Jackal). No longer certain that the information in the Appendix is accurate (maybe for Game Gear, but it sure turned out to be wrong for Game Boy), but since most people have a natural tendency to avoid deep math, it probably isn't hurting to leave it in for now.


I. Introduction to code making


	There are two main ways of GG programming: random codes and altering 
existing codes. If you don't have any codes for a game, you have to start 
from scratch by making up your own sequence of letters and numbers. If you do have codes, you can try to make them better by changing some of the 
*characters* in the code.


	Let's get this out of the way now: words between *stars* are vocabulary terms and can be found in the Glossary section at the end of this handbook.


[Ed. note: Obnoxious rants are between **multiple stars** to keep them
separate from big words]


II. All the acknowledgments I could possibly think of


	Let's all give thanks to the GGCCC for distributing this guide and for 
making me a member (GGW! Yay!), to Galoob for inventing the Game Genie, to Sega for inventing the Game Gear, to Nintendo for inventing the Game Boy, to all the countless sources on the Net I got my info from, to the computer that put up with me while I wrote this guide (that makes four times, now), to Milton Bradley for inventing Battleship, and to you for putting up with me. Now, lets throw in some BIG thanks to a lovely fellow named The Jackal, who sent me the rest of the hidden messages' codes. What the heck, let's also thank PC Gamer for existing (BLATANT PLUG), and Enhanced Software Design, the now-bankrupt Canadian company that designed the **AWESOME** Game Wizard 32 Pro v. 3.0 (REALLY BLATANT PLUG)


	If you need to contact me, I'm Cheatmaster, and my e-mail is [email protected] (NOT tlucas anymore!!!!). I may not respond immediately-
-I don't check my stuff every 5 minutes, like a certain someone....


	Bob T. Layman is dead. He died in version 3. Don't look for him here.


III. Overview of Game Gear codes


	Game Gear codes are 9 characters long. They look like xxx-xxx-xxx. 
You can enter 3 of them at any one time. You can also turn off their effects 
at almost any time, but when you turn the effects switch off, all 3 codes turn off--you can't stop them independently in the middle of a game. I recommend using only the first 6 characters of each code when entering your own codes. That's right, you can leave the last 3 blank, and it still works fine. When do you use the last 3? [Practically never -- Ed.] More on that in another section....


IV. Overview of addresses and data


	The important parts of any Game Genie code are the *address* and the *data*. An address is a location in *ROM* where something, such as lives or ammunition, is stored. ROM is your entire game! Compare ROM to a Battleship grid, and addresses to points on this grid. If the front end of a Destroyer is located at B6 on this grid, the address of the Destroyer begins at B6. If 
you're playing Psycho Battleship (the one with the mines and torpedoes), and 
there's a mine smack dab in the middle of A4, the address of the mine is A4.


	This is the main reason why Game Gear is SO much easier to code for than the 16-bit systems: smaller ROM. Compare playing Battleship with 25 points worth of ships on a 10x10 grid to playing Battleship with 25 points worth of ships on a 100x100 grid.... Obviously, the smaller grid is easier because there's a lot less water for the amount of ship out there! The same applies to a game. There's a lot less useless space for the amount of good stuff in a small game cartridge than in a large one. You're more likely to score a hit.


	On to data. Data is exactly what is stored in each address. Back to the Battleship.... If part of a Destroyer occupies B6, and you call B6, you score a hit. Therefore, the data in B6 is "hit". If you call C8, and there's nothing there, the data in C8 would be "miss". The only difference between Battleship and a Game Genie is that in Battleship, each grid point can be 1 of 2 things: hit or miss. In a GG, each address can be one of 256 different things!!! This brings us to....


V. Characters 1 & 2


	In a Game Gear GG code, data is shown by characters 1 and 2: XXx-xxx-xxx. Each of these 2 characters can be 1 of 16 possibilities: 1234567890ABCDEF. Put them together and you get 256 different values. Yikes! How do these work? They tell the Game Genie what to *poke* into the specified ROM address.


	Anyway, the number characters 1 and 2 form tell the GG what number to 
substitute for the old number. How do chars. 1 and 2 form a number? Put them 
together, back to back. If char. 1 is equal to 3, and char. 2 is equal to E, 
the end result is 3E. What kind of stupid number is 3E, you say? It's not the decimal system that you're used to; it's a hexadecimal system. Because most people are familiar with the system, I have omitted the details. Just remember that A is 10, F is 15, and B-E are in-between. Also, the "tens" place is actually equal to 16.


	All of the numbers you will work with on your GG are 2-digit. All you have to do to figure out the exact value of chars. 1 and 2 is to multiply char. 1 by 16, and add to char. 2. To convert a decimal number (no greater than 255) to hex, figure out how many times 16 will go into it--this is char. 1. The remainder is char. 2.


[Ed. note--This isn't always true. Tetris on Gameboy actually uses regular
decimal values. If you use the code "xx number of lines in Game B" and put
20 in xx, you get 20, not 32.]


	Have I blabbered on about math enough? Let me give you some advice on the first 2 characters of random codes. The best values you can use are 00 and FF. Why? 0 and 255 are generally good numbers in games, for one. The other reason to use 00 is because it is a *no-op code* (actually good for Infinite this-or-that codes, may replace a bad effect with... nothing!).


VI. Characters 3, 4, 5, & 6


	I bet you're glad to get out of that last section alive.... What do chars. 3, 4, 5, and 6 do? They make up the address of your code. Just like B6 is an address (sort of) in Battleship, an address in your game might be $32F4h. Let's look at these characters: xxX-XXX-xxx. For your first random codes, put down anything you feel like for these. The only rule is that char. 6 must be equal to at least 8. REPEAT: Char. 6 must be a "number" from 8-F. Why? You **really** don't care to know. It gets messy. What happens if you decide to rebel and put down a 4? When you leave the code screen, you get that OBNOXIOUS, ANNOYING "Invalid Code Warning!" screen, and the GG just changes it to an C anyway. Spare yourself the trouble and do it right the first time.


	When tweaking your code, it helps to know the order of the characters, from smallest change to largest change. In Battleship, going from B2 to B3 is a smaller change than going from B2 to C2. In GG, the characters are, in order from the smallest change in address to the largest change: 5 4 3 6. Look at it this way: if the digits of the address run 3210, the code looks like xx2-103-xxx. Therefore, when you want a tiny change in the effect of a code, change char. 5; when you want a huge change, change char. 6.


	BUT, there's a catch. As you would expect, if address position 0 (char. 5) is a 4, going up to 7 makes the code go up. Going down to 2 makes it go down. The same is true for address positions 1 and 2 (char. 4 and 3). The largest change you can make to a code, position 3 (char. 6), is DIFFERENT.


	Normally, numbers run like this: 0 1 2 3 4 5 6 7 8 9 A B C D E F.
In character 6 of your code, they do this: F E D C B A 9 8 7 6 5 4 3 2 1 0.
That means, dropping char. 6 from E to 6 makes the code go **up**!!! Keep
this in mind!!


VII. Characters 7, 8, & 9


[Ed. note: I am leaving this section in only for completeness. In all of
creation, there is NO reason for Joe Gamer to fool with these characters. It
is only meant for hard-core programmers with **waayyy** too much time on
their hands and codes needing to be debugged.]
	
	OK, now we're looking at these characters: xxx-xxx-XXX. At first, you may want to leave these blank--just make sure you have either 6 or 9 characters in your code, not 5, 7, or 8.


	Look at the code screen. More specifically, look at the two rows of 
characters at the top:


0 1 2 3 4 5 6 7
8 9 A B C D E F


	Whatever character you use for char. 7, char. 8 will be the one opposite it on that table. For example, if you use 2 for char. 7, char. 8 should be A. If you use E for char. 7, char. 8 should be 6. Char. 9 can be anything.


	These characters act like normal numbers: increase the "ones" place until it's at its max. Reset the "ones" place and increase the "tens" place by one. Just remember that chars. 7 and 8 must correspond. Therefore, 080 increases to 081, 081 increases to 082....08E increases to 08F, but 08F has to increase to 190--when you change char. 8, you must change char. 7 accordingly!


	What char. 8 does is **far** beyond the scope of this guide. In extremely short, it hides the Genie from the system so that anti-Genie games don't see it and lock up. Nothing you can do anything with. Characters 7 and 9 are also fairly useless. They represent a check value that makes the code work only if the game is in a particular area (also waayyy beyond this document). Not only do you not know the check value for your specific code, but it is encrypted even if you did. If you have LOADS of time on your hands, you can try every single possibility (255, no less) for this set of 3 characters to find the one for your code, and repeat the process for each code. Don't even bother unless the code works fine in some parts of the game, but glitches in others.


	What, other than bug fixes, are these characters good for? Making the 
last 3 characters 080 is almost guaranteed to make the code do absolutely 
NOTHING. But that can be good! When testing a set of 3 codes 1 code at a time, it is far easier to add 080 as the last 3 characters of the 2 codes you don't want than it is to erase and re-type, erase and re-type, erase and re-type...... Just remove the 080 for a code you want active, and add it for one you want to turn off temporarily. Very handy if you can't write down the 3 codes in the code screen at the moment, and you don't want to lose them....


VIII. Hidden messages in GG


	Hidden messages? WHAT hidden messages? That's right, there are 9 cute little messages hidden in the code screen! You access them by pressing directions and buttons in special sequences. Timing is NOT important. HOWEVER, directions may not be registered if the cursor does not actually move. Take, for example, RUDULUDU. The first and third Up motions won't even count if the cursor didn't start on at least the third line.


[Ed. note: The following was phrased for a Game Gear-only crowd. It applies
to both systems. Game Boy codes are included for completeness.]


Game Gear:
1.  UDLR          U=Up    D=Down    L=Left     R=Right    1=1      2=2      2.  21LR1        (st)=Start
3.  UU121DD
4.  RUDULUDU
5.  212RLDU
6.  11112221
7.  RLRLDDUU
8.  12122111
9.  [Happens on its own after 5 minutes or so of inactivity]


Game Boy (For all the good it does you):
1.  UDLR       U=Up  D=Down  L=Left  R=Right  A=A  B=B  (se)=Select    
2.  BALR(se)   (st)=Start
3.  UUABADD
4.  RUDULUDU
5.  BABRLDU
6.  AAAABBB(st)
7.  RLRLDDUU
8.  ABABBAA(se)
9.  ALLABRRB


Messages:


1. Congratulations! You've found the easy secret! Now find the hard ones!


2. Help! I'm a prisoner in a Game Genie factory!


3. Game Genie built by: Richard Aplin code by: Jon the Programmer managed by: Paul Ranson [Game Gear]


3. Game Genie built by: Richard Aplin programmed by: R. Fred N. managed by: 
Ted Carron [Game Boy]


4. Poems have, rhymes, sometimes.


5. There's rain outside, and that is why a, laundry day, needs a clothes 
dryer.


6. Washing, washing on the line, who's the fairest of the fine? Bluey 
Whiteness!


7. Provocation is not a job for amateurs.


8. 'Breezy':- Fresh air from the Alps! Comes in an easy-to-use aerosol can!


9. [Game Genie resets and displays an advertisement for itself, offering infinite lives and more power. Game Gear only?]


9. [This one isn't actually a message. Everything below the words "Code 
Screen," but above the copyright notice, is flipped UPSIDE DOWN!! The codes 
are still in their proper order, but the characters are upside down! Game Boy only?]


IX. What to do when a code pukes on you


	Yes, occasionally a code will just barf all over you. The game may 
lockup/freeze/crash/burn/hang, or the code may have a HORRIBLE AWFUL effect. 
What do you do when this happens (trust me, it WILL happen!)?


1. Change the first 2 characters of the code. Some codes don't like 00, some 
don't like FF, and some REQUIRE FF. Yes, some codes only function if they 
begin with FF. The same is true for Game Boy. In SNES, some codes require EE, which is equal to FFh anyway. Why do they do that? There are some codes, 
called flags, that accept only Off (0) or On (255=FF). However, these are not the only codes that behave this way. Some codes are not numbers at all, but *opcodes*. That is, the first 2 characters of the code must be one or two veerrryyy specific things. 00 and FF are often acceptable to such codes. If a code begins with anything but 00 or FF, try changing it to FF. If it still doesn't work, change it to 00. If it STILL doesn't work.....


2. Change the 5th character of the code. Sometimes, you just need to change 
the 5th char. a little--you got a bad address that needs to be adjusted a bit.


3. Change the last 3 characters of the code. This is EXTREMELY time-consuming, however, and doesn't always work. Use as a last resort, and even then wait for a rainy day.


	If the little bugger STILL won't work, scrap the code--it's beyond salvation. Move on to bigger and better game. There's other fish in the sea.


X. Conclusion


	Another day, another revision. It seems that this guide is never done. Maybe Version 5 will see some more tricks, some more bugs squashed, some more secrets found. Or, maybe somebody will just write in to rant that the appendix is based on erroneous information and needs to be deleted again. Personally, I'm impressed that anyone even reads these guides. I didn't think that many people even had Game Gears. Well, until next time... Hopefully there won't need to be a next time, though!


-CM
(P.S. Sick of Battleship yet?)


*Appendix-Code decoding


[Ed. note: This section involves MATH **shudder** and SCARY STUFF. Be warned]


[Ed. note 2: Testing shows this information to be wrong for the Game Boy. Game Gear, I have no idea. Use at your own risk]


	Sorry, but there really is no way to simplify this. It's pure binary math. If you aren't familiar with that, this is NOT the time to try to learn it. First, there's three nasty tricks that need to be mastered. 
	
	The first is to "rotate" a number. The number is first broken into its
binary form (again, if you don't understand that much, stop now). You may
end up with this:
	01100011
The Game Genie uses rotating to the left. You just move the 0's and 1's to
the left, and any that fall of the edge are crammed back on at the right
side. To rotate the above to the left by 1:
	11000110 <-- The 0 got pushed off and glued back on
To rotate the original number by 2 (the same as rotating the above 1):
	10001101 <-- Now the 1 got pushed off and shoved after the 0


	The second hoop to jump through is inverting a number or a bit. This is pretty easy: 0 turns into 1, and 1 turns into 0. If you are working with an entire number, break it into binary and flip every 0 and 1 in the number. So:
	01100011 flips into 10011100


	The third is the "XOR" (even the name is scary). This involves two numbers at a time. Let's use these:
	01100011 and 11100101
It helps to write one above the other and draw a line under them, just like
adding two numbers together:
	01100011
	11100101
	--------
Leave room under the line for the result. You should have a number of columns (on the Game Genie, there may be 5 or 8, depending on what you're doing). Take each column individually. Under any one column, write a 0 if the two numbers in it are the same, and a 1 if the two numbers in that column are different. Like so:
	01100011
	11100101
	--------
	10000110
Turn the result into a real number and you've done it.


	Now, for the actual procedure. This covers going from the original hex code that the Genie uses to do its job into the format that you gave the Genie in the first place. To go backwards, perform the steps backwards. Note that to "undo" the XOR step, you simply do it again. D XOR 8 equals 5; 5 XOR D gives back the original 8.


Look at this hex code: 3210?KL:DE-C (The punctuation here is grossly inaccurate and highly made up, based on NES codes) 3210 are the positions of the code's address. KL is a number ranging from 0 to 255 that the Genie looks for before it will activate the code (necessary for those really big RPGs--runs the code only when it will do what it's supposed to). DE is the code's data value, from 0 to 255. C is the cloak value (hides the presence of the Genie so that adverse games can't stop themselves because they see it) and is equal to 8 in 90% of all games.


Now look at a GG code: 123-456-789
1 and 2 of the above code are the data, DE in the hex code.
3, 4, 5, and 6 are the address.
	Hex: 3  2  1  0
	GG:  6  3  4  5
STOP NOW. Take character 6 of the GG code in progress and invert it. That is, flip all of its bits. (That's why increasing char. 6 actually decreases the address--it's been flipped) Note that char. 6 alone only has 4 bits, not 8. 7, 8, and 9 of the GG code are tricky. FIRST, take KL from the hex code and do the following:
		Lay it out as a binary number. You should have 8 bits.
		Invert bits 0, 2, and 6. 0 is the farthest **right** bit.
		Rotate it left by 2 bits. See above if you need help.
		Invert the entire number.
These operations on KL give you a new number that we'll call AB.
Char. 7 of the GG code will be A, and Char. 9 will be B (from AB, NOT the values A and B!!) Take C in the hex code and XOR it with A. This becomes Char. 8 (hence the relationship between characters 7 and 8).


That's it! Hard, ain't it?


*Glossary


CHARACTERS: Any letter, number, or other symbol. For example, 1, e, Z, and 
even ج are characters. In the case of the Game Gear GG, characters can be any of 1234567890ABCDEF.


ADDRESS: A specific location in ROM. Think of a Battleship grid... A3 is a 
specific location on the grid. Thus, you could call A3 an address in the grid. ROM addresses are MUCH uglier than Battleship addresses (which do you prefer, A3 or $4AD7h)... But don't worry about it--the Game Genie does for you!


DATA: The specific contents of a given address. Think of 5 birthday presents. The second present contains a new hat. Thus, the data (if you could really call it that....) of present 2 is Hat. Again, video game data is nowhere near as simple as Hat, but you don't need to worry about it.


ROM: The game itself. ROM contains every address in the game, and all the data in the addresses. Just like a Battleship grid!


POKE: To change the contents of a given address to something else. Re-think of 5 birthday presents. The second one contains a new hat. You don't WANT a new hat. So, you pull out your magic wand, and magically transform the contents of Present #2 from a hat to a new N64 (BLATANT PLUG!!!). By changing the contents of Present #2, you poked new contents into it. Now go play with your newly poked N64.


NO-OP CODE: An op-code that tells the game to do nothing at all. See OP-CODE.


OP-CODE: A very, very simple instruction that your video game follows. The 
command "Tie your shoes" is actually rather complex. If someone didn't know 
how to tie their shoes, this would only confuse them. Thus, you give them very simple, broken instructions: "Lift your hands", "Move your hands towards the shoe laces", "Close your hands", "Lift your hands", and so forth. A video game doesn't know how to do much of anything by itself, so it must be given simple instructions such as these.