Make Nintendo 64 GameShark Codes

From en64 wiki
Jump to: navigation, search

Nintendo 64 Game Shark (Action Replay Pro) Handbook
9/22/98
Mail Cheatmaster (dlucas@inlink.com) with questions or additional info


Acknowledgments

Before anything else, let me profusely thank the Game Shark Code Creators
Club (currently http:\\www.cmgsccc.com\) for its information on code
prefixes. These are an essential part of making or editing codes. Thanks to
Datel (sorry, I refuse to thank InterAct for my own reasons)for designing
not only the Game Shark but also its predecessor, the Pro Action Replay.
Let's see... Thanks to Nintendo for providing us with the N64 in the first
place. MANY thanks to Enhanced Software Design, the now defunct Canadian
company that produced Game Wizard 32 Pro, the major source of my information
and experience. Finally, thanks to Corel for WordPerfect 8, my word
processor of choice.

What you need

First, this is not a course in number theory. I assume that you are already
familiar with hexadecimal and binary numbering systems. If not, your local
library probably has at least one computer or math book with such
information. Second, and I cannot overstate this, you must not be afraid.
Let me emphasize: 

THERE IS A SMALL RISK OF CRASHING THE SHARK WITH A BAD CODE AND RENDERING IT
USELESS. PROCEED ONLY IF YOU ARE WILLING TO TAKE THIS RISK. (You can send
the Shark back to InterAct or Datel for a replacement, if you don't mind a 2
or 3 month wait)

Beyond that, you only need an N64, a Game Shark or PAR, a game, any keycodes
that the game requires, and possibly this guide. Oh, I almost forgot... To
add to my first point, this is also not a manual. I assume you already know
what keycodes are and how to use them, how actually to enter codes, etc.

Game Shark codes

(I know what you're thinking. 2.5?! Ok, so I went back and decided to add
it, but I was too lazy to change the numbers)

Game Shark/PAR codes work by changing the value of a specific piece of the
N64's memory, or by freezing a part of memory at a certain value. Memory
contains current game conditions, not the game code itself. Thus, unlike a
Game Genie, the Shark is mostly capable only of pure cheat codes and not
"cool" codes like walking backwards.

This handbook will refer often to terms such as address, data, byte, etc.
Once again, this is not a computer science seminar and these terms will not
be defined here. Just as a quick idea, addresses in the N64 are pretty
similar to the address of your home; they just tell the game where to go.

Basic code format

GS/PAR codes are essentially just address-data format. The first part of the
code is the code itself; changing this changes the effect the code produces.
The second part is the number that the code inserts, like "Always have 5
lives." Both parts of the code are just regular base-16 numbers. 

The very first two digits of the code, however, are not part of the address
of the code. This prefix tells the Shark how to treat the code.
     80 - Continuous 8-bit replacement (range 0-255)
     81 - Continuous 16-bit replacement (0-65535)
     88 - GS Button-activated 8-bit replacement
     89 - GS Button-activated 16-bit replacement
     A0 - 8-bit replacement only on startup
     A1 - 16-bit replacement only on startup
     D0 - 8-bit read (checks the address given for the specified value)
     D1 - 16-bit read (checks the given address and the one after for the
specified value)
Again, many thanks to the GSCCC for the above info. More on prefixes will be
in section 5. For now, keep in mind the range of the code. If you want a
code to give you 400 kills, a code that only goes up to 255 will not do.

Notes on the code format

Previously, I had stated that the N64 stores values in reverse order (30C5
becomes C530, etc.) This was in error. I checked the Star Fox code I
modified to give 400 kills--a code I know works--and the given value was
190h (400 decimal). If you want to enter a specific value, just convert it
to hex and punch it in.

16-bit codes span two addresses. 8116F5422:FFFF actually occupies 16F542 and
16F543 at the same time. Do not enter 8116F542:FFFF and then try also to
enter 8016F543:001C. The Shark won't know quite what to think and may mess up.

Putting these two ideas together produces a way to turn an 8-bit code into a
16-bit code. Obviously, you must change the prefix to match the new range of
the code. However, you must also subtract 1 from the address; because the
N64 doesn't store values in reverse order, the beginning of the number is
actually one position before the code itself.

To enter a *really* big number (65536-16777215; most games will never have a
variable that can go this high), you need three addresses. Use a 16-bit code
covering the first two, and an 8-bit code for the third. For example, use
8107C48A:FF03 and 8007C48C:00A5.

Codes defined by their prefixes as continually replacing values do just
that. If you use one of the GSCCC's controller trap codes (a.k.a. Master
Bryan's Activator), keep in mind that the code that it is meant to activate
will, if it begins with 80 or 81, be active whether you are pressing the
button or not (or at least, that or some other oddity happened to me every
time, regardless of how I entered it. Maybe I'm just doing it wrong?).

Odd codes

These are special codes whose operation may not be obvious. Some codes'
values in memory are not the same as the number within the game. Others are
interpreted in special ways by the game.

The most common "odd" code by far is a flag. This is a number with only two
possible values, representing on and off, yes and no, etc. The most common
values are 0 for off and either 1 or 255 for on. However, this does not
necessarily have to be true. For example, in Dragon Lord on the PC (Game
Wizard 32 Pro and the Game Shark are incredibly similar), the flag that
represents whether or not you can access your lab is either 2 for yes, or
211 for no. If you are not looking at an existing code, there is no way to
know when this is the case. Don't worry; 99.9999999% of all flags use 0 and
either 1 or 255 (In N64 games, 255 seems to be more common. PC games use 1
more).

A related code, and probably the least common, is the bit flag. This is
similar to a regular flag, but it looks only at one bit instead of the
entire byte. To simplify: One byte (0-255) is made up of 8 bits. While a
byte holds only one flag, it can hold up to 8 bit flags. It works by
breaking a number into binary and checking to see if a particular power of 2
is on or off. For example, 13 breaks down into 01101. The "1," "4," and "8"
bits are on and the others off. If each of the 5 bits represented a weapon
in your inventory, you would have the 1st, 3rd, and 4th weapons (counting
from the right), but not the 2nd or 5th. The Doom 64 code that gives all
artifacts is a bit flag. The artifacts are given values of 1, 2, and 4. To
give yourself some or all, add the values of the ones you want. To get all
three, add 1 + 2 + 4 = 7. To get only the 1st and 3rd, add 1 + 4 = 5. You
may recognize bit flags if you work with programs or especially with the PC
game Quake. In programs, (x & 4) tells the computer to look at "x" to see if
the "4" bit is on.

The hardest odd code to work with is one that simply does not appear to
correspond with its actual value. Another PC game comes to mind in which the
amount of oxygen you have left is given by the game in real-world hours and
minutes, but the value in memory is 70 when you have 15 minutes left. In
Doom 64, you can create a code to freeze your health percentage in order to
be invincible without god mode, but you still die after taking so much
damage. Doom and Doom 64 apparently have *two* values for your life, and the
other is not at all obvious (I still can't find it, even in GW32).

If an existing code is throwing you off, remember that the value of the code
is sometimes one more or less than what the game reports. Actually, I have
never noticed this on the N64.

Ways to get codes

Well, you could go to the G[S/G]CCC, but the whole point of this handbook is
self-reliance... Seriously, there are three or four ways to find new N64
codes. There is supposedly a Shark Link or PC Com link or something that
lets you do Game Wizard-style searches in the N64's memory. However, I don't
have one and can't say anything about it (mail me if you know something
about the link that belongs in here). Besides, who wants to pay another
third of the cost of their N64 for a cable? You can try making up codes from
scratch. Once again, however, keep in mind that a code too early or too far
in the N64's memory has the potential to crash the Shark. The easiest way in
some cases is to modify or to study existing codes. If there are multiple
versions of the game, try porting codes.

If you are making the code by yourself, you first need to decide what the
prefix will be. Stick to 80/81 and 88/89. The others are practically useless
to us mortals. Next comes the address. Punch in anything you want, although
0 and 1 are usually good for the first digit (3rd digit of the entire code).
The theoretical maximum for the first address digit is 4 (Do the math; the
N64 comes standard with 4MB memory). Once you have an address, make up a
number for the data. 255 (FF), 100 (64), 0, and 1 are often good. If you
decided on a 16-bit code, try larger numbers like 400 (190) and even 65535
(FFFF). Now, as my math teacher says, "Plug 'n Chug." Try it out and see
what you get. Remember that a code may be valid but may only take effect
late in the game or when used with other codes.

If you have the same code for two different versions of a game, try
converting the codes for the other version into the N64 version. If
invincibility on the PlayStation version of Mortal Kombat 4 has an address
of 200000 and the same for N64 has an address of 100000, chances are
excellent that most codes for the PSX version will be 100000 bytes ahead of
their N64 counterparts... Do the math! I have actually used this method
successfully to share codes between the PC and N64 versions of Doom.

You can try modifying an existing code slightly to find a new effect. Add 5
to the address and see what happens. If you get something, try adding 10. To
make a more unique code, try a larger change, such as adding 32768 (not as
big as it sounds) to the address.

The above trick opens up the possibility of analyzing existing codes to find
where others may be. To find the Doom 64 artifact code, I actually just
looked at the existing codes for inventory items, weapons, and other such
power-ups and noted a 3-byte gap. At first, I thought "3 bytes, 3 artifacts,
cool!" On actually testing the code, it turned out to be a bit flag
occupying only 1 byte. However, the hole in the code list was an ideal, and
in the end, successful, place to look for any code that may have been
missed. Another thing you may notice is that codes are offset from each
other by the same amout every time. In Doom 64, all weapons and inventory
items are stored 5 bytes apart except for the laser (in the PC version,
there are no exceptions to this 5-byte pattern). If there were another
weapon that did not have a code, the best place to start would be 5 bytes
after the last weapon, or maybe 5 before the first if nothing else was there.

That's all, folks

Once again, feel free to ask me to explain something in more detail, to send
more information, or to laugh at my atrocious spelling and grammar. Oh, and
this handbook was in no way an attempt to one-up the GSCCC or to make like
kudzu and swallow them whole. It was written simply to give a fighting
chance to those of us who don't have the tools to actually hack into the game.


Taken from: [1]