Before we start actually programming for the SNES, you will need a few things.
- An assembler
- A tile editor
- Photoshop or GIMP
- a text editor
- a good debugging emulator
- a tile arranging program
- a music tracker
I use ca65. It was designed for 6502, but it can assemble 65816 also. I am very familiar with it, and that is the main reason I use it. There is also WLA (which some other code examples and libraries use) and ASAR (which the people at SMWcentral use). For spc700 (which is another assembly language entirely) you could use the BASS assembler, by byuu.
(Click on Windows snapshot)
Why not use cc65 c compiler? It doesn’t produce 65816 assembly. The code generated is totally inapropriate. There is the tcc816 c compiler, which works with the PVSnesLib. It compiles to the WLA assembler. Frankly, I just didn’t feel like learning these tools. But they are here, if you are interested.
Link to the bass assembler.
These are command line tools. If you are not familiar with using command line tools, check out this link to catch up to speed. In windows 10, I have to click the address bar and type CMD (press enter) to open up a command line prompt. Watch a few of these tutorials to get the basics.
You might notice that I use batch files (compile.bat) to automate command line writes. You could use these or makefiles (which are a bit more complicated), to simplify the assembly process. I just double click the .bat file, and it executes all the assembling / linking commands.
I prefer YY-CHR for most of my graphics editing. For 16 color SNES, change the graphic format to “4bpp SNES…”. For 4 color SNES, change the graphic format to “2bpp GB”. The gameboy uses the same bitplane format as SNES.
The .NET version of YY-CHR has been improved, and can even do 8bpp SNES formats. Here’s the current link for the better version.
Another very good app is called superfamiconv. is a command line tool for converting indexed PNG (with no compression) to CHR files (snes graphic formats). it also makes palettes and map files. I don’t understand all what it can do, but you could use it to convert your pictures to SNES format without needing YY-CHR.
The command line options are a bit complex, but it really does a fantastic job.
Photoshop or GIMP
GIMP is sort of a free image tool like Photoshop. You can use any similar tool. If you convert to indexed color mode, reduce to 16 colors. You can cut and paste directly to YY-CHR in 4bpp SNES format. YY-CHR frequently screws up the indexing order, so likely you would need to use the color replace button to fix that.
Also, for 2bpp graphics, mode/indexed to 4 colors. Cut and paste to YY-CHR in 2bpp GB format.
Alternatively, you can save an indexed file to PNG (with NO compression), and then process it with Superfamiconv, which can also make maps and palettes. The palette in YY-CHR (3 byte RGB) is not at all like the SNES system palette (2 byte BGR), and won’t work interchangably. (see M1TE below). I actually think Superfamiconv does a much better job than any other method.
Or you could draw the graphics in a tile editor and skip GIMP altogether.
I use Notepad++. You could use any text editor, even plain old Notepad. You need to write your assembly source code with a text editor.
It has a Debugger with disassembly and breakpoints. Event viewer. Hex editor / memory viewer. Register viewer. Trace logger. Assembler. Performance Profiler. Script Window. Tilemap Viewer. Tile Viewer. Sprite Viewer. Palette Viewer. SPC debugger. I might write an entire page just on this emulator. It’s cool.
One note, for a developer. Make sure when you rebuild a file, that you don’t select it from the picture that pops up when you open MESEN-S, but rather always select the file from File/Open. Otherwise, it will auto-load the savestate, which is the old file before it was reassembled.
I also like to change the keyboard input settings. For some reason he has mapped MULTIPLE settings at the same time, and none of them exactly what I would choose. So Option/Input/Setup, click on each Key Setup and clear them all (clear key bindings button) and then manually set a keyboard key for each button. I like the ASZX for YXBA buttons and arrow for direction pad.
If this was the NES tutorial, I would point you to download NES Screen Tool. Nothing like that exists for the SNES, so I have been trying to make my own tools. They are not 100% finished (still only 8×8 tiles), but they are at least usable. M1TE (mode 1 tile editor) is for creating backgound maps (and palettes and tiles). SPEZ is for creating meta sprites that work with my own code system (Easy SNES). You may not need SPEZ, but definitely download M1TE.
One main benefit of M1TE is palette editing and conversions. It can load a YY-CHR style palette and output a SNES format palette. And the reverse. Remember not to name the SNES palette file as the same name as your CHR file and .pal extension, or YY-CHR will auto-load it as a RGB palette, and fail.
Perhaps in the future I will make other modes… Mode 3 or Mode 7.
I also use Tiled Map Editor for creating data for games. You might find it useful, even if this tutorial won’t cover that.
I have been working with the SNES GSS tracker and system written by Shiru. I have been told there was a bug in the code that causes games to freeze. You might want to download the tracker from my repo, which has been patched to fix the bug. (it’s the snesgssP.exe file).
and use the music.asm file here, since the original was written to work with tcc-816 and WLA.
I think I got the original from here.
…although it was written by Shiru, and not this gentleman.
You may want to use another music system. This one can NOT use brr samples from any other source. It can only make it’s own samples from 16 bit mono WAV files. I haven’t tried any other trackers / music drivers yet, so I’m not an expert.
I think that’s enough for today. Next time, we can discuss using the ca65 assembler.