Saturday, October 25, 2014

How to Make an NES Reproduction Cartridge

Nintendo enthusiasts, myself included, know the value of playing a game on the actual hardware, rather than on an emulator. There exist USB adapters to take your NES controller and make it work with emulators on your PC and try to mimic playing the real hardware, but it just doesn’t give you that authentic NES experience. Don’t you wish there was a way to play some of those classic games on a true NES without spending exorbitant amounts of money? Or some Japan-only games without having to learn how to speak Japanese? Or your very own (or someone else’s) ROM hack or homebrew games?

This tutorial will teach you how to reproduce (almost) any NES game, provided you can find a suitable ROM file. I know there are a handful of these tutorials out there, but I had yet to find one that was as comprehensive as I'd like it to be. Also, since I try to teach a bit of electronics to people who read these tutorials, hopefully you’ll learn some basic electronics principles and more about how EPROMs work.

 Even games like these! If you don't want to spend a few hundred on getting copies of these, you can just make them yourself!

Things you will need (specifics detailed further in tutorial):

1) A donor game. Usually a game that is pretty cheap, or that you don't care about anymore (please don't destroy your copy of Megaman 3). You'll need a specific donor depending on what game you want to reproduce.
2) EPROMs. The heart and soul of the NES game. This is where the game data is stored, on two separate chips. You'll typically need at least two of the same size, as most games use two, which are called a program (PRG) and a character (CHR) ROM. Some games only use the PRG ROM. I buy these chips in groups of 10 on eBay for about $15.
3) EPROM programmer. This is what you use to... program the EPROMs. I got mine on eBay for about $42. It's a TL866CS MiniPro programmer. It's worked flawlessly for me, and it's pretty easy to use.
4) EPROM eraser. This is for prepping your EPROMs, and fixing your inevitable screw-ups. Got it on eBay for $16 (can you tell I like eBay?). You can forgo this one if you're really hurting for $16, but it'll be a lot less hassle if you just get one. Many sellers claim that the EPROMs they sell are empty, but you don't want to take the chance that you get some that have random data stored on them. Plus, if you mess something up during programming, you'll be able to start over.
5) Miscellaneous hardware. At the bare minimum, you'll need wire (I prefer smaller gauge), solder, and a soldering iron. You'll also probably want a screwdriver that can open NES cartridges (called an NES Security Bit), or if you're cheap and really like making things harder for yourself, you can try to use pliers to remove the screws. But for $6 on Amazon or $1 on eBay (you'll have to wait about a month for shipping, though), it's really worth it. Trust me, I've been there. I used to melt the ends of old mechanical pencils to try to make a mold of the screw and use that. Not worth it.
If you do go and buy the security bit, be sure to get the 3.8mm size, and not the 4.5mm

Look at all the nerd cred you gain from this project!

I spent around ~$60 for all the necessary equipment, not including things like my soldering iron (which I already had). Each game you make will cost about $10. Not extremely cheap, but all this equipment gives you the power to make a ton of different games for which you could be spending upwards of $40. As such, I don’t recommend using this method to make games like Super Mario Bros., because you’re apt to find them for a few bucks. Reserve this method for the rare, wallet-emptying gems.

So let’s get cookin’ (or rather, brewin’) some good ol’ NES games.

Introduction to NES Cartridges

Before we start making all these games, there are a few things we need to determine about the game we want to make. NES games were produced spanning nearly a full decade, so it’s natural that the games both made technical leaps throughout its lifetime. For example, games like Balloon Fight don’t take up nearly as much space as a game like Super Mario Bros. 3 does. Also, ROMs can come in many different sizes, which require different PCB layouts with different supporting circuitry (most notably, a chip called a “mapper”). A game like Balloon Fight doesn’t use the same mapper (or even use the same kind of ROM chip) as a more complex game like Super Mario Bros. 3 does, so it follows that you wouldn’t be able to use a Balloon Fight PCB to make SMB3. 

This, of course, means you must choose a compatible donor cartridge for the game you wish to make. This can prove tricky for some games, as a few (such as Mike Tyson’s Punch-Out!!) are either the only game or one of a few that uses a certain PCB class. Or you might get some really weird layouts that are pretty much impossible to replicate without making your own boards from scratch. It's possible for some types of PCBs to be reworked for other games, but they need to already be pretty similar. I'll go into more detail about this later, for now, let's get started prepping your game.

Punch-Out is so special, it's the only one to use the PNROM PCB class. Guess you'll just have to buy it, cheapo!

Step 1: Find a suitable donor cartridge.

So how does one find which cartridge is right for them? Personally, I've relied on the amazing website NesCartDB. This website is so extremely detailed and a very powerful tool for all your repro needs.

IMPORTANT NOTE: NesCartDB is hosted on a private server. Sometimes the website goes down from time to time for various reasons. For three months in the summer of 2016, the server was offline due to hard drive issues. In the downtime, the great community at NesDev had been working to provide an alternate, and tech support to try to revive the database. I recommend you use this website if NesCartDB is ever non-functional:

NesCartDB by MiemoNES

All you do is search your game, and it will tell you which are suitable donor cartridges to use! Super easy to use, but it does not provide all the information NesCartDB does.

If you run into issues on this website (I haven't explored everything myself), you can reference this website as well:

Bigass NES Mapper List

It has very basic information about the cartridges. It's mostly accurate, but I've heard of a bit of misinformation on some of the games.

So, on NesCartDB, simply look up the game you want to make on the database. Keep this page open in another tab as a reference. Now, find the “PCB type” of your game and click on it (examples include TLROM, SLROM, CNROM, etc). This type is determined by the kind of mapper it uses, among other things. It’ll bring up a list of suitable donors. Just sort through the games; you'll probably want to look at games that are in your region, since you'll be able to easily get them and use them in your NES without worrying about region locking. Sometimes NesCartDB lists the same PCB types slightly differently, for example TLROM and TL-ROM, so you can try searching those variants as well. There’s a search function on the top menu bar. Depending on the kind of game you choose, you might need to rewire your cartridge a bit, but we'll get into that later.

Click the thing in the red circle, if you didn't know what I was talking about.

You’ll want to be sure the donor cartridge and the game you want to make have nearly identical PCBs. Watch out for how many holes the PCB has for the ROM sockets! NesCartDB provides pictures of the PCBs for nearly every game in the database, so it's easy to compare. I have bought games before that won't work for my donor because they have a weird layout. I could've avoided that if I had just compared the PCB picturs on NesCartDB before buying it.

Also, if you are trying to reproduce a game that has a PCB class listed something like "KONAMI-TLROM" you'll still be able to use the regular PCB class. Sometimes different publishers produced their own boards, but they should still be interchangeable with Nintendo-produced boards.

Note: If you're using a UNROM board, you'll require 32 pins, but only have 28 available. Don't worry, I'll explain later. Just carry on.

Another thing to note is if you're planning on putting a ROM hack onto a cartridge, you'll have to do a bit more work. Some hacks change the kind of mapping that the game uses, so the board of the original game might not simply work with the hack. You'll have to find that information out for yourself. Usually, the game's author will readily have that information available to you. If you need help figuring it out, you can contact me and I'll see if I can give you any advice.

Anyway, most of the cheapest games I’ve found were $5 on eBay or Amazon. Or, you could be a weirdo like me, and print out a list of all the suitable donors and bring it to your local vintage gaming shop and get lots of suspicious stares from the employees as you pore through their collection.

Why hello, I'm looking for "Sesame Street: Big Bird's Hide and Speak" for the NES.
Step 2: Choose your EPROMs

What even is an EPROM?
EPROM stands for Erasable Programmable Read-Only Memory. Basically, it holds information that you can program to read later. You write information onto the EPROM using a programmer, and then that information can then be accessed later, but not rewritten (without an EPROM eraser).

The way data is accessed is through the data pins and address pins. To program the EPROM, the /CE (chip enable) and /PGM (program) or /WE (write enable) pins are tied to logic low (VSS or 0V), and the /OE (output enable) pin is tied to logic high (VCC or 5V). Note the bar above the symbols (which I indicate with a slash) - this means it's inverted logic, where a high voltage means disabled (OFF) and low voltage means enabled (ON). Some EPROMs might use non-inverted logic, but ours do.

An address is called out using high or low voltages on pins A0 to A16 (A17 or A18, for the larger EPROMs). Then, using data pins DQ0 to DQ7, a byte (eight bits of "1" or "0") is loaded parallel onto the data pins. In reality, only the 0's are written to the pins, because by default all the pins start as 1's. A 0 is written to the memory cell (actually a transistor, or a switch) by applying a high voltage onto the pin. Once enough voltage has been delivered to the data pin you desire to be 0, that data will be permanently "programmed" onto that address, until you reset it back to a 1 with UV light. It's similar to gluing a switch in one position so that it can't be moved. Once the byte has been written to the specified address, a new address is called out and new data can be written. This is done for each and every address, until it's filled up.

When you want to recall the data you programmed onto the chip, simply call the address you want to look at on the A pins, tie the /OE and /CE pins to logic low (to enable them), and read the voltages that are now applied to the data pins you programmed earlier. When the NES is playing a game, it's just reading the data on the different address locations. These data pins are what's known as bi-directional, with their function being controlled by the /OE, /CE, and /PGM pins.

Your basic EPROM. So much data shoved into one deceiving tiny little package. It'll have either 28 or 32 pins, and a little window on the top.
See the little window on the top? That's how the EPROM eraser deletes the information on the chip. You can't simply reprogram the memory like modern memory devices by writing over old data with new data (unless you just want to change a few of the 1's to 0's). The only way to erase the information is by blasting the window with a specific wavelength of UV light. "But can't I just stick it on the windowsill and let it get a sun tan?" Well, sure you could, but it might not effectively erase all the data in a timely manner. You should probably just get the eraser.

I swear, I don't work for eBay.

So why don't the EPROMs in my cartridge have those little windows? Well, they're not actually EPROMs, but what's known as a "mask ROM". The "mask" part basically means what it sounds like - it isn't erasable, because that functionality is "masked". Kind of a bummer, really, it'd be really nice to be able to just reprogram the game without having to buy new parts.

EPROMs (the chips) are defined in their sizes by bits instead of bytes (8 bits = 1 byte). ROMs (the game files) are defined in bytes. So, a 2 Megabit (Mbit) EPROM can hold code up to 256 Kilobytes (KB). A 1Mbit EPROM can hold code up to 128KB. This is a bit confusing, but very important! Check your CHR and PRG ROM sizes for the game you want to make on your NesCartDB page, and see how much space each needs.

The maximum size of ROM that you can store on a 28-pin EPROM is 64 Kilobytes. Any CHR or PRG file that is GREATER THAN 64 KILOBYTES NEEDS A 32-pin EPROM.

There are two different types of EPROMs that I use, which I got from eBay - a 4MBit and 512KBit model. I use the M27C512 for smaller games (512KBit, 28 pins), and the AM27C040 for larger games (4MBit, 32 pins). You can buy other models of EPROMs if you'd like, these are just the two specific models I use. If you choose different models, check your pinouts - if they are different than the ones I use in this tutorial, your wiring will be different!

Between these two EPROMs, you should be able to load most any game you want to make. The M27C512 is the largest EPROM size you can get with 28 pins, and the AM27C040 is the largest size you’ll ever need for 32-pin boards, as no NES game uses any ROM larger than this.

NesCartDB really is the bible of NES games.

For example, the game Little Samson's PRG ROM is 256KB, and the CHR ROM is 128KB, so I will need one EPROM that can hold at least 2MBits and another that can hold at least 1Mbits. You can use bigger EPROMs, though, which is why I recommend just getting a lot of the largest sizes since the price difference is usually trivial.

Protip: When searching for them on eBay, it's more economical to get groups of them, rather than single pieces. A lot of sellers use terms like "10pcs" or "x10" when they are selling groups of them. It's usually about $15 for 10 of them if you get them from China. I haven't had any problems with mine yet, so I'd say it's a safe bet. You'll just have to wait a bit longer to get them in the mail.

eBay, proud unofficial sponsor of the Poor Student Hobbyist.

Step 3: Find the ROM file for your game

I’m not going to tell you how to… acquire these files. Use Dr. Google – search “[name of game] ROM”. Be wary of sketchy websites, and whatever you do, don’t install a “downloader” to download your file. This could be malware. You’re looking for zip files of the actual game, not executables. Inside should be a .NES file, and possibly a readme or some other useless text documents.

Again -- don’t run any executables!

Also to note, if you're planning on making a foreign game, you'll want to see if you can find a patch for the ROM that will translate it into English. I'm not going to go into detail on how to patch the ROM, but any patch you find should be accompanied with instructions. It's usually as easy as running a short program.

Once you've readied your ROM, it might be a good idea to download an emulator and try it out a bit, just to make sure it downloaded/patched correctly and isn't corrupted. It'd be a shame to waste all this time and energy putting a corrupted game into a cartridge. I use JNes for all my emulation needs, but there are plenty other emulators out there that will work just fine.

Step 4: Split your ROM file into the CHR and PRG files

Before you do this step, make absolutely sure your EPROM can hold the ROM file. Remember, EPROMs are defined in BITS, where ROMs are defined in BYTES. Eight bits equal one byte. Reread the section above and make sure you picked the right EPROM.

Your .NES file you downloaded in Step 3 contains both the CHR and the PRG files (or just the PRG file, if your game doesn't utilize a CHR ROM). These two files will each go on a separate EPROM. I use ReadNES3 to do split the .NES file (here's the GitHub link).

Once you extract the Zip file, simply drag your ROM file and drop it on ReadNES3.exe that came in the folder. You should get two new .BIN files in your folder now, with the suffixes "Character" and "Program". These are the files we're going to load onto your EPROMs. You'll note that if your game doesn't use a CHR ROM, the file will be 0kB large, so you can ignore it.

Before we load them, though, we should make sure the EPROM is filled up. This is only necessary if your EPROM is larger than the ROM's CHR or PRG file. Don't really need to worry about the specifics, but basically it's to ensure if any of the extra data on the EPROM is accidentally accessed by the NES, it won't be random junk information.

Remember, EPROMs are listed in KBits, so you need to divide by 8 to get the size in KB.

Now, to fill up the EPROM, all we need to do is duplicate the .BIN file until it's large enough. This can be achieved by a simple line of code run in command prompt (press Windows+R, type "cmd" and hit "OK").

First, make sure the command prompt is working in the folder that contains your ROM files. You can use the "cd" command to change the directory. Here's an example of what I would type in:

cd C:\Users\Nick\Documents\

Just fill in the directory where your ROM is located. Your directory should switch to that on the next line.

Now, let's say I have a PRG file that is 128KB, but I have an EPROM that is 2MBit (256KB). So I need to double the PRG file. We do this with the following line of code:

copy /b gameProgram.BIN + gameProgram.BIN gameProgramFill.BIN
The "copy" command, obviously copies the data, and "/b" is to denote that the data is in .BIN format. The line of code essentially doubles "gameProgram.BIN" and stores it into the file "gameProgramFill.BIN".

Let's say I have an EPROM that is 4MBit (512KB). Instead of doubling it, you would quadruple it.

copy /b gameProgram.BIN + gameProgram.BIN + gameProgram.BIN+ gameProgram.BIN gameProgramFill.BIN

Now, compare the sizes of the PRG and CHR files, and the sizes of your EPROMs. They should be the same.

Ready to program them? Hell yeah you are.

I'm a lean, mean, programmin' machine. Slow down, ladies.

Step 6: Program your EPROMs

If you got the MiniPro programmer that I recommended above, you're in luck, because I can totally tell you how to use it. If you have a different EPROM programmer because you found a cheaper one or already had one because you're a nerd, you'll have to find the specifics elsewhere.

The MiniPro comes with a tiny disc that has the programmer. It's pretty self explanatory, but I'll run through the steps real quick-like.

1) Select your IC by using the "Select IC" menu option on the top bar (how cryptic!). The catalog here is pretty extensive, they should have your brand.

They don't have my brand! I have special EPROMs.
2) Do a blank check! Did you remember to erase your EPROMs in your UV eraser? Navigate to "Device > Blank Check" on the menu bar. Hopefully they're blank. If not, try blanking them again your UV eraser. If they still don't work, you might have a defective EPROM, or it's not connected to the programmer properly.

3) Get your PRG or CHR file loaded into the program. This is under "File > Open" (wow, these menu options are so hard to decipher.) The default load options should be correct, make sure the File Format is "Binary" and the Load Mode to be "Normal".

4) Program em! This is under "Device > Program".

5) To be safe, you should verify your program loaded correctly ("Device > Verify"). I've never run into a problem with it programming incorrectly, but if you do just blank your EPROM and try again.

6) Put some tape over the little window, and mark down what ROM is loaded onto it. You want to make sure you know which EPROM has the CHR file and which has the PRG file!

7) Repeat, if necessary, for the other EPROM.

Congratulations! Your game has a brain. Now to give it a body.

No, not that kind of a body! And no, I'm totally not trying to rip off the format of a Cracked article...

Step 7: Begin surgery on your donor cartridge

Open your donor cartridge (hopefully using that special screwdriver I told you to get). See the mask ROM(s)? These need to go.

Note: We do not want to remove any other chips. If your board uses RAM, do not remove it. RAM is non-volatile memory, which means when the RAM loses power, all memory on the chip is lost. Thus, there's no reason to remove the chip, because the ROM takes care of storing all the data.

If you can't tell which chip is which, look on NesCartDB. They do a good job of letting you know which chips are what.

Use the detailed chip info section to decipher what chip is what. Just match the model numbers, you'll be able to figure it out. I believe in you! This is actually the board to The Legend of Zelda. It only uses one mask ROM.
There are a few methods you can go about doing to removing your ROM chips.

1) Use a soldering iron and some copper wick to remove all the solder. This method is the worst one. It stinks. The solder on the games is old, takes a long time to get all of it out, and you'll probably end up burning yourself. 

2) Use a solder sucker to remove the solder. This one is preferable, granted you have access to a solder sucker. You can get a cheapo plastic one for a few bucks, but I've never had any success with using that. My employer, however, happens to have some actual pneumatic solder suckers, so I used one during my lunch break one day. Process goes really fast and clean, only took me a few minutes to get the chips off the board.

3) Cut the pins, remove the chip, and then remove all the remaining bits of metal stuck in the holes. You can cut them using some wire cutters, or better yet, a dremel. You have to be really careful if you decide to use a dremel, though. I have more than once accidentally taken out a few of the traces on the PCB using mine, which I had to go back and manually repair with wire. It's not fun.

See that little scratch right above the bottom row of pins on the right side of the board? That's where I cut one of the traces. I ended up having to painstakingly and very carefully solder an extension wire off of the trace.
Now you’ve hopefully got a nearly blank, undamaged PCB with ONLY the mask ROMs removed. Make sure the sockets are fully empty. If there's any residue solder left in those holes, it'll be a pain putting your new EPROMs in.

Step 7: Wiring up the PCB

This step is only necessary if your EPROMs are larger than 512KBit (if either of your EPROMs have 32 pins). If they are 28-pin EPROMs (except for UNROM boards!!), then go ahead and place them in the sockets and solder the corner pins down. You might have to bend the pins a little bit to get the EPROM to fit in the socket(s). Then you can skip ahead to Step 8. Lucky you!

If you're using a 32-pin EPROM or UNROM PCB type, you'll have to do a bit of work. 

So, Nintendo was clever. As the games got more advanced, and more memory was necessary, the memory management on the board (which was handled by the "mapper" chip) needed to become ever more advanced. Games started becoming larger, which is when you started seeing the 32-pin EPROMs crop up. The extra pins were necessary to make the leap from 64KB to 128KB games.

These new larger ROMs would require a new layout on the PCB. But, some games only required the CHR or the PRG ROM to have more space. They only required the 28-pin package. In order to keep the PCBs generally interchangeable, Nintendo decided to use 32-pin ROMs with a modified pinout so that the board would accept both the 32-pin and the 28-pin chips. Remember how I mentioned that games which don't utilize all 32 pins just let four of them alone? These four pins are the added pins to the larger ROMs. If the game developer didn't need to use all the extra space on the ROM, they could use a smaller one and still be able to place it in the same PCB. Clever girl, Nintendo, clever girl.

So, what does that mean for us? Well, since we're using standard EPROMs, we need to do a bit of rewiring. Again, this is only necessary if you're using the 32-pin EPROMs. The rewiring isn't too complex, but you need to exercise caution when doing this step - I've ruined a few EPROMs because I was hasty. I'd also recommend using thinner gauge wire. Thick wire gets in the way really easily (you'll have to route wire on top of your EPROMs), and can make your cartridge bulge in the middle.

This was my first reproduction. You can see the pins of the EPROM in the middle of the cartridge where it bulges the most, due to the larger gauge wire I used. The cartridge is also a bit harder to fit in the NES.
I'll list the necessary modifications depending on your PCB class. Here's the general steps you should take for rewiring your board. Use these steps with the modifications I list afterwards:

1) Bend up the necessary pins on the EPROMs. Be very careful doing this - go slow and make sure you're not putting the bend stress on the part of the pin closest to the package of the chip. I've broken off pins by not being careful, and let me tell you, it's a major pain in the ass to fix. Also, clip off the thinner part of the lifted pins, and just use the flat parts. They'll get in the way of the cartridge closing correctly otherwise. Note that these lifted pins might just stay lifted, they might not necessarily be wired anywhere.

2) Solder long wires into the necessary holes on the PCB before you put the EPROM in. Be sure to use long enough wire (8 inches or so), at least for the first reproduction you do, so you don't make your life difficult. As you get more experienced, you can cut back on the length of wire and make it look much cleaner.

3) Place your EPROMs in the corresponding sockets. Make sure the CHR and PRG EPROMs go in the correct place! Nintendo was nice and labelled which socket is which. You might have to bend the pins a bit to get the EPROM to fit correctly. Also, I wouldn't solder all the pins in just yet. You might have to reprogram them or change some wiring you missed. Just solder a corner or two in to keep it anchored in place.

4) Route the wires you soldered in step 2 to the correct pins.

5) Solder any extra wires, if listed.

This is how I start off a board. Solder the wires into the holes, and make sure they're long enough.
For reference, here's the pinout of the EPROMs. Find the notch in the EPROM, or the dot on the chip; this denotes the top of the EPROM, and the first pin is the top-most one to the left.

Now that you know the steps to take in your modifications, just what are the modifications you need to make? Here's the most popular PCB types - I will add more if requested. If they're not here, keep reading to learn how to wire it yourself if you want! Keep in mind some games, like the Konami boards I mentioned earlier, may have different wiring, so watch out for that.

Games that use MMC1 mappers (SxROM boards) and MMC3 mappers (TxROM boards), also applies to AxROM boards:

Bend up pins 1, 2, 24, 30, and 31.
Connect pin 1 to hole 30
Connect pin 2 to hole 24
Connect pin 24 to pin 16
Leave pin 30 and pin 31 disconnected

Bend up pins 1, 2, 24, 30, and 31.
Connect pin 1 to hole 30
Connect pin 2 to hole 24
Connect pin 24 to pin 16
Connect pin 30 to hole 1
Leave pin 31 disconnected

Bend up pins 1, 2, 24, 30, and 31.
Connect pin 1 to hole 30
Connect pin 2 to hole 24
Connect pin 24 to pin 16
Connect pin 30 to hole 1
Connect pin 31 to hole 2

Bend up pins 2, 22, 24, 30, and 31.
Connect pin 2 to hole 24
Connect pin 22 to hole 31
Connect pin 24 to hole 2
Leave pin 30 and 31 disconnected

Bend up pins 1, 2, 22, 24, 30, and 31.
Connect pin 1 to hole 30
Connect pin 2 to hole 24
Connect pin 22 to hole 31
Connect pin 24 to hole 2
Connect pin 30 to hole 1
Leave pin 31 disconnected

Reproducing a UNROM board:
This board is a bit weird. It uses a 128kB ROM, but doesn't have room for a 32-pin EPROM. There aren't any 28-pin 128kB EPROMs available, so that means you still have to use a 32-pin EPROM instead. It's... different. But not hard. Just be very careful when you're modifying the board.
On the PRG ROM:
Bend up pins 1, 2, 24, 31, and 32.
Connect pins 1, 30, 31, and 32 together.
Connect pin 2 to hole 22. (Hole 22 corresponds to the 22nd socket of the 28-pin socket on the PCB. It's the eighth hole from the bottom on the right side.)
Connect pin 16 to pin 24.
When you place the EPROM into the board, make sure that pin 3 is placed in hole 1 on the PCB. Pins 1, 2, 31, and 32 should overhang on the PCB.

Special case - boards that support batteries, but do not have one (like the game Spot):
This board has space for the battery, but does not utilize it. Therefore, some parts were omitted from the final production (some boards may have them in anyway, but if they don't, then you'll have to replace them yourself.) 

In D1 and D2, add regular or Schottky diodes (NOT zener diodes). Make sure they can handle at least 15V or so and at least 40mA just to be safe (this is probably overkill). A great, cheap one to use would be the 1N4148. When you put them in your board, make sure you put it in correctly, because orientation matters. On the 1N4148 the cathode is indicated with a black bar.

The diodes are to isolate the battery from the 5V coming from the NES while it's on. R1 and R2 should work fine with any value resistor between 1k and 10k.

In the spot labelled "CB", place an electrolytic capacitor (at least 10uF). Make sure the polarity is correct on this capacitor as well. This is to keep the RAM chip powered up just in case there's a random spike of voltage from switching the game on or off - if you don't want to put this in, it'll probably still work fine, but your saves might get erased sometimes. On old Zelda games, they used to say on the save screen to hold the reset button in before you turn off the game - this was to reduce spikes from the voltage line. They soon started putting in the capacitor to prevent you from having to do that.

If you're modifying a board I haven't listed (or just want to know why we're bending certain pins and changing the connections) follow these steps:

(Remember, this is only for 32-pin EPROMs!)

I will provide an example for each step, noted in italics - I'll be using Little Samson, which is on a TLROM PCB using the MMC3 mapper

1) Reference the EPROM layout below. If your PRG EPROM is 128KB and still 32 pins, refer to the 256KB size.
Little Samson uses a 32-pin 256KB chip for the PRG, and a 32-pin 128KB chip for the CHR

2) Compare each EPROM's pinout to the ones you are using, making sure to distinguish between the PRG and CHR EPROMs, and bend up any pins that differ from the PCB
Using 27C040 EPROMs:
For the PRG:
- Pin 1 (VPP vs A17)
- Pin 2 (A16 vs /CE)
- Pin 24 (/OE vs A16)
- Pin 30 (A17 vs 5V)
- Pin 31 (A18 vs 5V)
For the CHR:
- Pin 2 (A16 vs /OE)
- Pin 22 (/CE vs GND)
- Pin 24 (/OE vs A16)
- Pin 30 (A17 vs 5V)
- Pin 31 (A18 vs /CE)

3) Connect the pins to the correct holes (VPP is the same as VCC or 5V, and VSS is the same as GND). If you don't have an /OE hole, then connect it to a GND pin. If your EPROM has a /PGM pin (located as pin 31), connect it to GND. Do not connect any unused outputs (A17 or A18), instead leave them floating.
For the PRG:
- Connect pin 1 to hole 30 or hole 31

- Connect pin 2 to hole 24
- Connect pin 24 to pin 16
- Connect pin 30 to hole 1
- Leave pin 31 disconnected
For the CHR:
- Connect pin 2 to hole 24
- Connect pin 22 to hole 31
- Connect pin 24 to hole 2
- Leave pins 30 and 31 disconnected

So, finally, after all that work, here's how my boards usually turn out.

Not pretty, but it works. I used tape to keep the wires in place. I also used thinner wire so that the cartridge didn't bulge this time.
Go ahead and solder the rest of the pins in. If you're not confident, you can test out your game first and then solder the pins in if all is well. But you might not have a good enough connection on the pins. The advantage of keeping your EPROMs unsoldered is that if you made a mistake, it'll be easy to pull the chip back out.

Step 8: Test out your game

The moment of truth! Reassemble your cartridge, and make sure you're not pinching any wires (hence, the tape). Throw it in your NES, turn it on! Hopefully, it'll work. Play it for a few minutes, and make sure everything works fine. Take it back out and fully solder the EPROMs in, if you didn't already.

But, if your game isn't working, don't panic yet!

Some games have what's known as "mirroring". It basically controls how graphics wrap around the screen. Horizontal mirroring is used for games that scroll vertically (like Ice Climbers), and vertical mirroring is used for games that scroll horizontally (like Balloon Fight).

Here's the PCB for Balloon Fight.
See the little solder bead underneath the left mask ROM? It's connecting the wire used for vertical mirroring (denoted by the "V" on the board).

If your game is working fine, but the graphics just scroll the wrong way, then that means you have the wrong mirroring active. Just switch to the other pad on the PCB. An easy fix, but not all games use mirroring techniques.

If your solution isn't that easy, don't lose hope yet.
If you didn't solder the EPROMs in yet, you could try soldering the pins in. You might not have good enough connection from the pins to the board. But first I'd check the wiring to make sure you didn't make any mistakes. If you have a multimeter, do continuity checks on all the necessary pins and wires.

If your wiring is all good, check the board again and make sure you didn't accidentally cut any traces when removing the mask ROMs. If there are any damaged traces, you'll have to repair them with wire.

If your wiring is good and you've soldered in all the pins, try re-soldering them by heating them up with your soldering iron. Don't let the tip sit on the pin for too long, but get the solder "flowing" again. We want a good shiny surface that makes a concave structure onto the pin like this:

Look at that beaut.

If you still can't figure out what the issue is, you might have had a programming error, or your chip got damaged somehow through static electricity or some cosmic particles ruined your EPROM or some other voodoo excuse. You can always try removing your EPROMs and verifying the program again. Just keep analyzing your board, or post your problems to the NesDev or NintendoAge forums. They're usually pretty helpful. You can ask me, too, if you'd like. I try to get back to comments within a few days.

Step 9: Make your cartridge look pretty

So now you've got your game all made up and working, you can add the label to the cartridge. Personally, I haven't made a label yet, but when I finally get around to it I'll update this tutorial with how I did it. I'm usually more preoccupied with playing the game, rather than looking at it. There are plenty of resources online to help you find out how to make the labels.

Here's a quick and dirty tutorial:

1) Remove the old label. Use Goo Gone, or I've heard that baking soda and vegetable oil mixed together does a decent job of removing it.

2) Find the box art, or actual cartridge label, and fit it into a cartridge template. There are plenty of templates for the label size online.

3) Print your design(s) on a full sheet label. I recommend printing more than one cartridge label at a time, because the full sheets get expensive. See if you can mooch off of someone, or buy them in single pieces from your office supply store.

4) Use a full page lamination sheet to cover your full sheet label. That'll give it a nice shine.

5) Cut out your label and place it on your cartridge. Done!

Or you could use this guy's method to really bring out the magic in your NES reproduction.

Congratulations! You have successfully created your own reproduction NES game!
But remember, with this great power comes great responsibility. If you're going to make these reproduction cartridges, please be sure to mark that they are reproduction cartridges so they're not mistaken for genuine ones if you end up trading or giving it to someone else. Don't play it off like it's the original thing. That's called breaking the law, and being a jerk.

I hope this guide helped you out in your quest to play some rare NES gems! I tried to be as clear and comprehensive as possible, but I'm sure I missed something here or there. If you find any errors, let me know and I'll try to fix it. If you find some board instructions I left out, let me know and I'll add them to the tutorial. If you're still having trouble, don't hesitate to comment or email me! I'll try to update this with anything else I find.

Have fun!

I got a lot of information from the great people over at They have a lot more information than I posted, and if you're itchin' for more technical stuff, head on over there and check it out!