This is what you will need to program an NES game…
1. An assembler (or compiler)
2. A tile editor
3. A text editor, like Notepad++
4. A tile arranging program
5. A good NES emulator
6. a music tracker
7. a test cartridge
For my examples I will exclusively work with cc65. It is part of a suite of software, and is one of the best compiler/assembler programs available for 6502 (i.e. NES) programming. Although, the learning curve is a bit steep, I will help get you started.
(Click on Windows snapshot)
NOTE: the version that I use is V2.15 (in command line type…
to see your version). Files from different versions of cc65 can sometimes give error messages (especially much older versions of cc65 may not compile). I believe the newer versions 2.16-2.19 work also.
I am using the neslib library (by Shiru), and my own support library. You can get both from any of my NES examples. Such as, here…
You need a tile editor to create the graphics. I personally prefer YY-CHR. You can get it here…(this is the updated and improved version).
I prefer to work first in GIMP/Photoshop, convert to indexed (4 color), then copy/paste over to YY-CHR later. You should be working in the 2bpp NES format (the default).
Here is a link where you can download GIMP.
Notepad++ is a tool for writing programming code. You could use any text editor, if you like. Notepad++ is available here…
The great thing about Notepad++ is you can set it to highlight your code, which makes it easier to read. And it has the line # on the left. If you get error messages while compiling, it will tell you the line of the error. If you double-click on a word, it will highlight every instance of that word. It has a find-and-replace feature which I use a lot, also find-in-file to search an entire folder’s files for a word.
Or, I’ve heard of people using VSCode to write their C code. It is a bit more advanced, and can do syntax error checking and code completion, which notepad++ can’t do.
To make background maps, we need a tile arranger app. I highly recommend, NES Screen Tool. It shows the NES color limitations very well, and is good for making single screen games. It also gives you nametable addresses and attribute table addresses, which comes in handy. I think I used 2.51, and if you have an older version, it won’t open the .nss files in my source code. Get it here…
And, if you are making a scrolling game, I would also pick up Tiled map editor. I will go into more detail later, but you can make a data array out of the exported .csv files from Tiled.
Why do I need all these programs?
You could probably make your entire game with NES Screen Tool and a Text Editor. But you will have much better drawing tools if you use another graphics editor / pixel editor.
Here’s the tool chain I have been using.
- GIMP – get an image, and resize to a reasonable NES size. Here I’m using 128 x 128 pixels.
- Then reduce to 4 colors, by changing image mode to indexed and # of colors to 4 colors.
- Select the graphics and copy.
4. Open YY-CHR – make sure it’s set on 2bpp (NES). New File.
5. Paste the graphics.
6. You may have to use the color replacement tool, in YY-CHR, if it got the color indexing wrong…
It doesn’t matter what palette settings you give it in YY-CHR.
7. Save your graphics as a .chr file.
8. Open NES Screen Tool and load the .chr file (tiles).
Use the NES Screen Tool to create backgrounds, palettes, etc. Save a nametable NAM file (can be compressed as RLE, and also can be formatted as a C array). Save the palette PAL file (or copy to clipboard as a C array). CHR file should also be saved. These files will be added to the game source code, but, more on that later.
The newest version of NES Screen Tool can also import graphics (BMP indexed 16 color) as a tileset, or import it as a nametable (auto generates tiles). Kasumi has explained this process better than I could, here…
And, next is an NES emulator. I use FCEUX 90% of the time because it has excellent debugging tools, PPU viewer, Nametable viewer, Hex Editor, etc. However, it is not the most accurate emulator. You may wish to test your game on multiple emulators, to assure that other people will be able to play your game without issues. (I’ve used Nintendulator, Nestopia, and Mesen). Actually, Mesen is probably better than FCEUX now (it definitely has more debugging tools). Get that too.
FCEUX is here…
Mesen is here…
You may have to change the video display to display every pixel. I’ve seen people say “the NES is 256×224 pixels”, but that is not true. Older TVs tended to cut off a few pixels from the top/bottom of the picture, but the NES generates a full 240 pixels high. One of my TVs displays nearly the entire 240 pixels. You should assume that some users will see the entire picture, so in FCEUX go to Config/Video/Drawing Area, and set the output to the full 0 to 239.
I don’t want to go into too much detail yet, but you will also need to get Famitracker for making music and/or sound effects for your game.
I use the famitone2 music code (by Shiru), which works well with neslib library, and is much smaller/faster than the famitracker driver. But you still need to write the songs in famitracker.
Playing the game in an emulator is nice, but the real test is playing on a real NES with a flash cartridge.
I have a PowerPak, but if I were buying one today, I would probably get a N8 Everdrive from krikzz (directly or from their Amazon page or from StoneAgeGamer). The PowerPak uses a compact flash card, and the N8 uses an SD card. I needed to buy a special attachment to connect a compact flash drive to my computer, but most computers have SD card slots.
OPTIONAL… I have been writing simple python 3 scripts to process some of the data into C arrays. You don’t need to, but it might be helpful if you installed python 3, to use my tutorial files. I just use simple scripts for “automating the boring stuff”.
cc65 – in more detail.