Site hosted by Build your free website today!

A Beginner's Guide to NES ROM Hacking.

Version 1.5

by Sliver X

Best viewed at 800x600 resolution.  

This document is geared towards ROM hackers with little or no experience at ROM hacking, and therefore won't hold anything new for those who know what they're doing. But if you've got some ideas and just can't seem to figure out how to make them a reality, then this should help you get started.

Table of contents:

The Hex Editor: Your new best friend


Graphical Hacking

Altering Text

Palette Modification

Useful Resources


The Hex Editor: Your new best friend.

Hacking NES ROMs will make you learn alot: Not only about how the NES works and how the games are set up and function, but also about Hex Editing, which will quickly become one of your most useful skills to have. What you need  is a good Hex Editor program, (if you have a PC, then Hex Workshop is your best bet, hands down),  NESticle, which is one of the best debugging emu's I've seen, some ROMs, and a lot of patience.

Hexadecimal is a way of representing information in a computer file in a way other than the actual source code or in binary. Hex digits are based on powers of 16, rather than 10 like pure decimal, and have a few extra digits which are A, B, C, D, E, and F. Also it takes two digits to represent one byte, or number. It may sound confusing at first, but you'll eventually get the grasp of it.

Example 1:

Let's say you want to convert decimal numbers into hex. Since hex is based on powers of 16, you have to count a little differently than with decimal. Let's say you want to count to 20 in hex. Here's how the order would go:

00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E  0F 10  11  12  13  14
0   1   2   3   4   5   6   7   8   9   10  11 12  13  14  15  16  17  18  19  20
Decimal Equivalent

This pattern is repeated as you go higher, such as if you started counting past 20, you would get 15, 16, 17,  18, 19, 1A, 1B, 1C, 1D, 1E, 1F, 20. You may be confused, but that's ok. It'll take some time and practice messing around with it to get it down. However, when hacking NES ROMs, the range of hex numbers you'll be messing with primarily will be between 00 and FF, which is 0 to 255 in decimal. A really big help to you is available if you have Windows 95. Win 95's calculator can convert regular decimal numbers to hex. Just type in the number, and click the circle that says Hex. It should show the number in it's hex equivalent.

Ok, I hope that this really rudimentary explanation of hex helps you out. Now that you have a vague understanding of it, we'll start to get into ROM hacking itself.

(Back to the Table of Contents)


NESticle... sure, it can't run alot of ROMs, has a crappy palette, and hasn't been updated in ages, but when it comes to ROM hacking, this is one of the best damn tools you can get, and for one reason: The Magical F2 and F4 Buttons. Using F2 has many useful purposes, from graphics editing to getting hex values for text and tiles. F4 let's you view the palettes that are currently being used, which I'll go into later in this document. You're gonna need this program for most of the procedures below, so do a search for it on the net, or get it  at the bottom of this doc in the Resources section.  (however, depending on when you read this, the URL's might not work.)  Now it's time to get into actual ROM hacking, starting with...

(Back to the Table of Contents)  

Graphical Hacking

Changing a games graphics can be fun and tedious at the same time, especially if you have limited artistic abilities (such as myself). There are two main ways of going about this: using NESticle's F2 button to bring up the Pattern Tables, or by using a kick ass program called Tile Layer. Here's the pros and cons of each:

1:Allows you to do real time editing, so you can see the changes as you do them on screen.

1:You can't save your changes unless the game has VROM (Video Rom).
2:You're screwed if the game can't be emulated by NESticle.

Tile Layer:
1:Let's you save your changes on almost ANY game, regardless if it has VROM or not.
2:Allows you to arrange the tiles in order so you can see them as they appear in the game. (more on this in a minute).
3:Allows you to open two ROMs at once, so you can cut and paste graphics from one into the other.
4:Also let's you edit Gameboy, Sega Master System, Virtual Boy, and Super NES ROMs.

1:You can't edit in real time, so you have to make your changes, then load the ROM to see what it looks like.

That's about it. A conjunction of the two is the best way to get what you want done, so get Tile Layer as well. There's a link to it in the Resources section at the bottom of this doc.

Ok, now we're gonna start some actual ROM hacking by screwing around with some of the graphics in Super Mario Brothers

What you need:
Tile Layer
A ROM of Super Mario Brothers

Load NESticle, then click on File, then click Load Rom. You'll be given a listing of the directories in your computer. Go to where your Super Mario Brothers ROM is located and load it. Now, hit F2, and you should see a screen like this come up.

This may look like a bunch of garbled shite to you, but this is actually the graphics being used by the game. (In Super Mario Brothers, these are actually ALL the graphics in the entire game.) The ones on the left are the sprite tiles, such as Mario and all the enemies. The ones on the right are the background tiles. See, most ROMs don't store their graphics in order, but have their tiles jumbled around. Tile Layer can help with that, but I'll get into that in a second. Anyway, click on the very first tile on the left side, which you might be able to tell is the back of Mario's head. Another screen like this should pop up.

This is where you can edit the graphics, in this case the back of Mario's head. (The numbers at the top aren't important for this kind of stuff, but will be useful later on when you get into text editing.) The tile is composed of an 8x8 grid with 4 colors, which are the boxes on the right. (Note that the top color is transparent.) You can right click on the tile or the pattern tables to change the colors shown, although usually NESticle doesn't show the correct palette. The best thing to do is to get the graphic you want to change, such as Mario standing, on the screen, pause the game, then get into the pattern tables and start messing around with a tile that's a part of Mario standing. You'll be able to see the changes as you do them, which is useful as hell. As far as editing the tile, just pick your color by left clicking on it, then start painting like any other paint program. Once you've done the back of Mario's head, click on some more tiles and mess around if you want.

Ok, so now you've changed some crap, but there's still one more important thing left to do. Go to File, then click Write VROM. This'll save your work to the ROM.

However, there are alot of ROMs that don't have VROM, such as Final Fantasy and The Legend of Zelda, so any graphics you change in NESticle won't be able to be saved. Or maybe all those jumbled tiles are confusing the hell out of you. What if you're wanting to hack a game with no VROM, or want to see the tiles like they appear in the game? Easy, it's time to break out Tile Layer.

For the sake of making things slightly easier, put your Mario ROM into the same directory as you have Tile Layer. If you're using Win95\98, you need to go into MS-DOS Prompt. Go to the directory where Tile Layer's at and type

tlayer.exe xxx.nes   (xxx is the name of the ROM)

You should now see this:

Yup, more garbled crap. However, this isn't the game's graphics. Hit either down on the arrow keys or page down a few times until you see the jumbled tiles, which in Super Mario Brothers is at the very bottom of the file. Here's where one of Tile Layer's coolest features comes into play. Click on the back of Mario's head, then go over to the clip board and hit right click on your mouse. The tile should now be on the clipboard. Now click the front of Mario's head and put it in front of the tile of the back of his head. Doing this you can arrange the tiles to where they actually look like they do in the game, like this.

Doing this makes it a hell of a lot easier to do graphic hacks. The way it works is identical to NESticle's tile editor. Just remember that you have to re-insert the tiles back to where they came from. Such as if you changes Mario's face, you need to left click the altered tile on the clipboard, go over to the left screen where the ROM data is, then right click it over the original tile of Mario's face. As always, remember to save before you quit!

That about covers basic graphic hacking. But wait, what's that? You'd like to know how to change words and such in a game? Well, that's a whole new subject, which is covered in...

(Back to the Table of Contents)

Altering Text

Changing a game's text is a little more complicated than you would think at first. Changing the graphics of the letters in the Pattern Tables or Tile Layer into other letters is definitly not the way to go, as it doesn't change the order of the letters, and makes most of the words become gibberish. Some real damn bad examples of this can be found in some hacks from a year or two ago. Also, opening up a ROM in a text editor like Notepad won't accomplish anything either. So how do you do it? First you need to get a program called Thingy, which you can also find in the Resources section at the bottom of this document. You don't need to do anything with it yet however.  It's time to fire up NESticle again, and for this example we're going to use a more text heavy game than Super Mario Brothers,  Dragon Warrior 1.

What you need:

A Dragon Warrior 1 ROM
A text editor, such as Notepad

Load Dragon Warrior in NESticle, and hit F2 to bring up the pattern tables. On the left pattern table you'll see 0 through 9 and all the letters of the alphabet. Click on 0. It'll say #00 on the top of the tile grid, just like the one with Mario's head from earlier. Remember how I said they weren't important for graphic hacking? Well, they're important now. Open up Notepad or whatever text editor you have (although programs like WordPad and Wordperfect are probably bad ideas. Stick with crap that does plain ASCII, like DOS EDIT or Notepad.) and type this:


Or if you're using a non multitasking OS like MS-DOS, just write it down on paper for now. Keep clicking the other numbers and letters and keep writing down the numbers that show up on the blue bar above the tile grid. These are the hexadecimal values for the letters and numbers as they're stored in the game. Once you get all the values down, (including the ones for punctuation, and the one that means space, which is F5) you should have a list that looks something like this:


And so on...  If you've been typing this into a text editor, then save it as dw1.tbl
If you've been writing it down on paper, open up your text editor and put all the values down just like shown above, then save it as dw1.tbl

What this file is is a table file for use with Thingy, a program that'll save you countless hours of hassle.  See, NES ROMs almost never use the ASCII system to store their text, so viewing them in a text editor won't show them at all. What this tbl file you just made does is it tells Thingy what values stand for what letter, so you can see them in plain text, which is alot better than searching for 37 11 18 1D (Thou in Dragon Warrior) in a hex editor and replacing each letter byte by byte with other hex values, unless you LIKE doing that crap. When I first started messing around with ROM hacking 4 years ago, that was the only way, by god, and it sucked in the worst of ways. Anyway, put the Dragon Warrior ROM and dw1.tbl in the same directory that you put Thingy in. Run Thingy. You'll be prompted for your file's name: just type in what your Dragon Warrior ROM's name is, with the extension, such as dragw1.nes
Then it'll ask you for your table's name. Type dw1.tbl
When it says Second Table, just hit enter. You should now be in the main program, which'll look like this.

The left screen is the hex values of the information in the ROM, and the right screen is what your table file has listed as meaning for those hex bytes. Hit S, and type in art and hit escape.

You'll see something like this. (some of the byte definitions are missing because I didn't feel like writing out the whole table, but you get the idea.)

You can now actually see the words as they are, instead of as hex bytes. Here's how this same part of the ROM would look without a table in Thingy, or in any hex editor for that matter.


Pretty heinous. Now you see why Thingy kicks so much ass. But before you start changing anything there's a few things you need to know about text hacking. For one thing, most games use pointers, which is a subject I'm not going to go into in this document. Basically what it means is that you can't make a line of text any longer than it already is without screwing up something, unless you remap it to somewhere else, which is a bitchy process. So sticking with the set length of your text lines is the best thing to do at first, at least until you start to learn more about ROM hacking. Here's an example of what I'm talking about.

Let's say you've got a line of text that says  I'm the king of Dank Land! 

That gives you a total of 26 bytes to work with, since you count the spaces too.
Putting more than 26 letters, numbers, ect in this line will cause strange and weird shit to happen more than likely, so here would be a few examples that would and wouldn't work.

Things that would work:

So now we must journey.  23 bytes long.
Bleah, you make me sick! 24 bytes long.
Today sucks. 12 bytes long.
Things that wouldn't work:
I'm going to run really fast now. 33 bytes long.
Mmmmm, frozen cow pies! Yeah! 29 bytes long.
You get the idea. Ok, now to change some text. (Finally!)

Hit J, which is Jump to Position in Rom. Hit enter on Manual Address, and type in 0. You should now be back at the beginning of the file. Hit S, and type listen then hit escape.

You'll be at the line of text at the beginning of the game where King Lorik is talking to you, shown here.

Alright, now to change what the king's saying. Move your arrow keys until you've highlighted the first letter of listen. Click space. Now move and highlight the last letter of words, and hit space again. You'll now be in a screen where it'll ask you to type in your text. The cool thing about this is that it won't let you go over your byte limit. Let's type in something like, I want my Rage CD back
Now hit escape, and hit q. Now load the Dragon Warrior ROM up in NESticle and start a new game. When Lorik speaks to you, it'll look like this now.

There you go, you now know how to change a ROM's text. Just remember to stick to the original length for now, and you'll be ok. Now we're going to go into the last topic this document's going to go into,

(Back to the Table of Contents)

Palette Hacking

What's palette hacking? Well, when you're hacking a game's art, sometimes you might want to make your new graphics use different colors than the ones they already are using. For the sake of you not having to go on another ROM hunt, we're going to change some color palettes in Super Mario Brothers.

What you need.
A Hex Editor
A Super Mario Brothers ROM
Load up Super Mario Brothers in NESticle. Press start, and pause it as soon as you start on World 1-1. Now is where the other Magical Button in NESticle comes into play, the F4 key. Hitting it will bring up a screen that looks like this.

These are the colors currently being used by the game. They way this is set up is that each palette is a set of four colors, with two rows of four palettes each. Here's where we're gonna change some things around. See the first palette on the second row, the one that's light blue, red, rust, and brown? This's the palette Mario uses when he's in regular or Super form. Click on each of the colors and write down the hex values it'll show, which will be 22 16 27 18. Close NESticle now, and open your Mario ROM in your hex editor. (you can even use Thingy without a table as a hex editor if you want.) Now search for 22162718, that's right, don't use any spaces between the values. When you find it, change the 16 to 0C and the 27 to 2A. Save the file and reopen it in NESticle. Mario's colors will now look like this.

You've now changed Mario's palette. There's a side effect to this though. Any other sprite using this same palette will also have it's colors changed, like the Spiney's I think. Another thing to remember is that in alot of games the first match won't be the palette you're looking for, as the same thing might be in the ROM multiple times. So when it comes to this, you need to use trial and error, changing each one until you find the right palette. Remember to make frequent back ups though! One more note about palette hacking, sometimes the ROM won't list the first color (which is the transparent one), so say if you weren't finding any matches for 22 16 27 28 in the ROM, try searching for 16 27 28. Also, the NES has a total of 64 colors, which are shown here with their hex values on this chart. You might want to save this to your hard drive for future reference, as it's a big help in finding what colors you can use.

(I can't take credit for this image. I think Toma created it. Hopefully he doesn't mind me using it.)

That's it for palette hacking. By now you should have a decent idea of the basics of NES ROM hacking, although you may want to read this every now and then or any other docs on the subject to get more understanding. Remember, ROM hacking isn't something that is simple, so the best way to get better is to just experiment around and see what you can do. Anyway, have fun, and happy hacking.

(Back to the Table of Contents)

Useful Resources

Here's all the programs used in the above procedures. If one link doesn't work, try the alternate link for it.

NESticle    Tile Layer   Thingy

SITE 1       SITE 1        SITE 1

SITE 2       SITE 2        SITE 2

Oh yeah, if you find any errors, or some of the links don't work, ect, or just need to ask a question about something, you can email me at  this address.

  Page designed and created by Sliver X. 2000 The Pit of Shite.

(Back to the Table of Contents)