Testing Code

[[!redirects Running your programming on Hardware]]

Once you've programmed a game or other bit of data for SNES, you'll probably want to try to, well, test it.


Although for most software these choices are, mostly, about preference. Most games which require [[Expansion Chips]] o ...

65c816 Code Snippets

65c816 Code Snippets

Hopefully useful code snippets for the 65c816.



Unsigned 16bit * 8bit operation

; 符号無し16bit*8bit演算
; Unsigned 16 bits * 8 bi ...

How to Write to DSP Registers Without any SPC-700 Code

How to Write to DSP Registers Without any SPC-700 Code


ca65 manual_dsp.s
ld65 -C lorom128.cfg -o manual_dsp.smc manual_dsp.o


# ca65 linker config for 128K SMC

# Physical areas of memory
# Names need not match, but it makes it  ...

Compression Formats

Compression Formats

LZ77 Algorithm and Variations

http://www.krista.cc/posts/48 http://en.wikipedia.org/wiki/LZ77_(algorithm)

RLE / Run-Length Encoding



http://en.wikipedia.org/wiki/Huffman_codin ...

BS-X Memory Map

[[!redirects Satellaview Memory Map]] Those infos are from bsnes source code (there's only differences from Original Mapping) :

$00-$1F $8000-$FFFF : ROM/PSRAM/Data Pack
$80-$9F $8000-$FFFF : ROM/PSRAM/Data Pack
$00-$0F $5000 : MMIO
$10-$17 $5000-$5FFF : SRAM
$20-$3F $600 ...


Gau_Veldt (formerly gau@netbistro.com) I'm now gau_veldt and on hotmail instead of netbistro.com

  • Wrote one of the original SPC-700 tutorials (it appears to be well-mirrored)
  • Now dabbling with HDMA and SA-1 code. Working on a unified ROM setup wit ...

Initializing the SNES

Initializing the SNES takes LOTS OF CODE. Now, resources for SNES are hard to come by, so I forced myself to dive into Neviksti and Marc's initialization files. Now, believe me, it's a lot to deal with, so what I'll do is try to provide you with some important things that Neviksti's Init SNES file d ...

Widespread Myths

[[!redirects Widespread Myths on wheels]] These are myths that frequently show up that mislead people into writing bad code based on false perception of what the system actually does.

Myth: The PPU steals cycles from the CPU if there are a lot of sprites on-screen.

Fact: The PPU does not stea ...

General Advice

The most important thing to know about 65816 optimizations is to not try to emulate other CPU architectures. A lot of games (games with a lot of slowdown) have this programming style where the programmer pretends that a couple memory locations are 68000 registers or high-level local variables, and ...


XBand Source Code

Quote: Krazystyle
To the Xband Community... I've been pretty hard pressed to release these files into public domain. I wouldn't be doing this if I honestly didn't feel like maybe one day the right group of people getting ahold of these files could potentially bring justic ...

Breath of Fire 2

Breath of Fire 2

Breath of Fire 2 Dictionary Compression

Not as simple as it seems. Notes from KingMike's text dumper, haven't looked at the code in years.

01    : End of String
02    : Line Break
03 xx : Di ...


SA-1 (Expansion Coprocessor Chip)


The SA-1 is a coprocessor capable of running at four times the base speed of the SNES main CPU when access does not conflict with that of SNES CPU, DMA or HDMA processing. It provides ad ...

Transferring Data from ROM to the SNES APU

Transferring Data from ROM to the SNES APU The method of transferring data to the sound module of the SNES is a bit screwy, but it works. I've read many docs, looked at a lot of code, and nothing I've seen seems to explain the method to this madness in a straightforward way. I'm hoping I can shed s ...

Markdown Cheat Sheet

# Header 1 #
## Header 2 ##
### Header 3 ###             (Hashes on right are optional)
#### Header 4 ####
##### Header 5 #####

## Markdown plus h2 with a custom ID ##         {#id-goes-here}
[Link back to H2](#id-goes-here)

This is a paragraph, whi ...

ASM Tutorial Part 1

So... you want to make a block that freezes Mario only when he's small? Or perhaps make a block that kills him if he has zero coins because you've played through SMW and well, there are no more gimmicks? Well... with ASM, you can easily create these type of blocks - ASM basically lets you do custom ...

Useful Ruby Snippets

Useful Ruby Snippets

These are useful code snippets I've used when working with SNES data and don't want to forget them. Some examples are not optimized as much as they could be in order to help keep the functionality clear.

Command Line Script Template

Useful for running a script fro ...

Old BBS Messages

Old BBS Messages

Old BBS messages can be fun and interesting, so here are some I've come across.

Job Postings

Seeking Awesome Programmer

Catapult Entertainment, Inc. is looking for a top-notch, real-time,
low-level programmer to join a world-class software team creating the fi ...

Learning 65816 Assembly

I trust that you have learned some other kind of assembly language. If you have not, I'm afraid that learning 65816 as your first assembly language may be extremely hard. However, I won't stop you from trying. You will need other 65816 documents, because I do not teach much in this tutorial. These t ...

Finding free VRAM spots for 32x32 and 16x16 sprites

[[!redirects Find free VRAM spots for 32x32 and 16x16 sprites]] [[!redirects How to automatically find empty places in VRAM for random 16x16 and 32x32 sprite graphics]] This code will allow you to automatically find an empty space in VRAM so you can fit a 16x16 or 32x32 sprite pattern as needed. ...

Writing the Header

[[!redirects Writing the Header]] Before writing your actual program's code, you need a header to describe WLA the SNES' memorymap. This is basically just a file you will include into your source. It contains all of the basic information about your ROM. The following is a basic header file for a 2 ...

Basic ca65 Usage for SNES Programming

Basic ca65 Usage for SNES Programming

First Example

The first example is a minimal example of setting up the ROM header, vectors, etc.


ca65 ca65.s
ld65 -C lorom128.cfg -o ca65.smc ca65.o


# ca65 linker config for 128K SMC

Using the NMI-VBLANK

Earlier we made an interrupt table which assigned addresses for the SNES interrupts. We assigned the address to an empty handler that just returned for every interrupt except the NMI (VBLANK) interrupt. This interrupt occurs whenever the T.V.'s tracer is not tracing to the screen, making it safe to ...



PHP is a mnemonic for an instruction that pushes the lowest 8 bits of the of the [[P register]] to the [[stack]]. An immediate consequence of this is that there is no specific instruction for pushing the [[emulation]] (9th) bit of [[P]]. [[XCE]] is the only instruction capable ...

Working with VRAM - Loading the Palette

I'm getting right down to business in this tutorial, because this is a BIG topic to cover. Seriously, get ready for a ton of new registers to be introduced to, and a lot of theory. Ok, no more time for chatter, let's get started.

What We're Covering

Today we'll make a tile, write that tile t ...

ASM Tutorial Part 2

Are you familiar with all the previous lessons yet? If so, that's great.. with all of that knowledge, you can do a lot of cool stuff - but you can always get better at ASM and make awesome stuff by learning more. So here's Part 2 of the tutorial, which for now only explains a bit of intermediate stu ...

Writing Your First SNES Program

Writing Your First SNES Program

Now it is time to get your hands dirty. You will be making your first SNES ASM program today. It's about time, huh. So let's get on with it!

What this program will do:

Well it will basically fill then entire screen with one color. MAN is that EXciting ...

Working with VRAM - Initializing Tiles and Tile Maps

Now in this part of the series, we'll actually be.. Working with VRAM. :)

What We're Covering

Now we're going to actually upload data to the Video RAM. Now, there's 2 things that need to go to VRAM, and that's the tile data itself, and the tile map, which says where specific tiles will be di ...


xkas (acronym for: cross-knight assembler) is a cross-assembler for the WDC G65816 processor, specifically tailored for use with SFC/SNES programming and translations but also supports GBA Thumb CPU (ARM7TDMI Thumb). The documentation below is for the most recent version of xkas.


  • S ...

Making a Small Game - Tic-Tac-Toe

When you have finished this tutorial, you will have written a small game. Things you have to know before you start:

  • 65816 assembly
  • Interrupts (What are NMI and VBlank)
  • What is VRAM, CGRAM, and their basic structures
  • What is DMA and how to use it
  • Video modes (mode 0), using backgroun ...


Translucency is a cool effect, an example would be the water effects in Secret of Mana. I'm just not in the mood to chat, so let's get right into it.

We normally set things to the Main Screen register ($212C) in order to see them on the screen. ...

Bit Rate Reduction (BRR)


Due to the requests of several people, the lack of documentation in this area, and a hope to spring the SNES emulation "scene" forward, I am going to try to describe the BRR encoding scheme in this doc. Everything here, I either read in publicly available documentation, or disc ...

Polling Controller Input

In this tutorial, you'll learn to read the joypad registers and react to player input ;). We're going to need to store the player's input somewhere, so we'll declare some variables in the system's RAM ($0000-$1FFF). If you make your own variables later in this part of RAM, keep in mind that the st ...


Ok, here is my explanation on pointers. Some documents out there don't make any sense what so ever so I'm writing my own. This document is exclusively on Low-ROM SNES pointers and related. It is suggested that you become familiar with basic rom hacking before you read any further. If you begin to re ...

Super Wild Card

Hardware Specification to SWC & SMC Programmer Only

  1. DRAM - 28 Mega Bits Maximum Available.
  2. SRAM - 256K Bits. (Battery Backup)
  3. ROM - 128K Bits. (Firmware)
  4. Floppy Drive Interface
  • Motorola MCS3201 Chip. (NEC 765a Compatible)
  • Compatible With IBM PC/at and XT Disk Drive Syst ...

SNES Sprites

This was very large and I had to write more sections in different parts of the tutorial, so please tell me if anything is confusing. I have not proofread any of this.

Sprites are important to every game. They are coined after the objects that move in a game, and there are ALOT of moving objects i ...

Space Funky B.O.B.

Space Funky B.O.B.

Space Funky B.O.B. Source Code

This was originally posted on eludevisibility.org when I ([[Matthew Callis]]) originally bought these disks off eBay, but I'm consolidating all SNES related things down to superfamicom.org.


GD Leen

GD Leen

Below is a decompressor and recompressor for GD Leen. This has been updated to compile with GCC, below that is the original unmodified file.

// Decompressor and  ...

Setting Up a Programming Environment

Before you dive into writing Super Nintendo programs, you need the necessary utilities and other things that will simplify your journey of learning how to program this beast.


  1. One great assortment of files was gathered by Qwertie, it contains documents on the cpu, graphics, ...

Jay's ASM Tutorial


This is a tutorial on 65816 ASM used in the SNES, made easy for dumb people to understand (sorta). In case you are wondering, I don't program in this language, so it is possible that I will write something incorrectly in this tutorial. If so, you can e-mail me at tennj@yahoo.com, ...


As stated in the title, this document try to document the S-DD1 chip's algorithm and, up to certain point, the chip itself, but you have to take in mind that the main target is to describe the algorithm, not his implementation. Due to that, there are details that obviously have to be present in a re ...


About the Super Nintendo Development Wiki

Welcome to the SNES Development wiki. For many years information has been literally scattered across the world, in old text files, in aging and now disappearing web sites, in dead forums, in some wiki's that never quite made it happen, in books... b ...

Game Doctor

Bung Game Doctor SF3, SF6, SF7 Headers

Version 1.0 - Copyright 2003: The Dumper

The Game Doctor SF3/SF6/SF7 backup units for the SNES use a 512 byte header.

The format is as follows (all numbers are hexadecimal):


`47 41 4D 45 20 44 4F 43 54 4F 52 20 53 46 20 33 ...

Tototek Flash Cart

Super Flash Cart 64M for NTSC/PAL SNES

The Super Flash Cart 64M (SFC) is an 8MB SNES cartridge with flash memory and battery RAM. It comes with a separate programmer. I obtained the following information by hot-swapping the cartridge into an already-powered SNES running probing programs, and ...

Mega Man X3

Mega Man X3

Decompression Routine

People always assume "OMG MMX3! this game uses a [[C4]] chip, the [[C4]] chip does the decompression blah blah blah" well I proved them WRONG! [[C4]] chip is ONLY responsibl ...

SPC and RSN File Format


SPC is an audio format for playing native SNES audio.

SPC File Format

| | Offset | Size | Description | |:--------------------------|:--------:|------:|:-------------------------------------- ...


This is a document intended to describe various aspects of SNES timing. It will probably not be useful unless you already know a good bit about the SNES.

BTW, special credit to byuu for the critical observation that the SNES returns to a known timing position on reset. Thus, a deterministic ROM ( ...

Mode 7 - Scaling

Mode 7 is a BG mode that allows a background to be rotated, scaled, and skewed. There are more possibilities when HDMA gets involved, Mario Kart. Let's get started with the basics.


You need to understand fixed point comple ...

ASM Hacking for Dummies

[[!include asm_hacking_sidebar]]

Introduction ### {: #introduction}

This document was written for the aspiring ROM hacker with little to no experience in 65c816 programming. The basics have been thoroughly covered and I believe this should prove a significant aid to anyone interested in 65c8 ...

Mode 7 - Rotation

You really need to know fixed point complementary math for this one. Now time for a trig overview. In the 'real' world, we have 360 degrees of rotation, and the results of sin and cos of any angle fall in the range of -1 to 1. Now this works a little differently on the SNES, at least the way I ende ...

Memory Pack Commands

[[!redirects Data Pack Commands]] [[!redirects Data Pack Registers]] Those commands were figured out and tested on real hardware by ikari_01.

All references to Memory Map are based on the HiROM memory map from BS-X. There are also Memory Packs that are only ROM and does not support those comman ...

Grog's Guide to DMA and HDMA on the SNES

Introduction to DMA

Most computer systems have some form of Direct Memory Access controller, which is basically a piece of hardware that allows I/O devices to copy to and from main memory independently of CPU control. In the SNES, as usual, Nintendo came up with an odd design for their DMA ...

Capcom Music Format

This article has Japanese translations that need to be checked for correctness and have the Japanese portion removed.

This explains the structure of the SNES Capcom Sequence format / Capcom SPC format. Used by many Capcom games, this document focuses on [Mega Man X](https://superfamicom.org/inf ...

SPC700 Reference


System Overview


8-bit SPC700, runs at ~1Mhz ...with the effective speed being half (each instruction takes a minimum of 2 cycles)


64KB (NOT 32KB), shared with everything.


4 8-bit I/O ports to transfer data to/from the ...

Sluggo III

Sluggo III SNES Memory Emulator




Apple II RoundTable: Sluggo III - Nintendo Development System for the Apple IIgs

Real Time Conference Transcript

Guest: Bill Heineman, Programmer

Company: Interplay ...

BS-X Satellaview Header

The header will be at 0x7xxx (for LoROM) or 0xFxxx (for HiROM) for the downloaded content. There may be more than one in a single Memory Pack.

xFB0-xFB1 = Licensee / Maker Code
xFB2-xFB5 = Program Type
xFB6-xFBF = Reserved
xFC0-xFCF = Title
xFD0-xFD3 = Block Allocation ...


The ST-0010 is a DSP chip from Seta; it is actually a NEC uPD96050, as confirmed by decapping. It's only used, and barely so, in 1 game:

The development PCB for this chip has the se ...

Nintendo Music Format (N-SPC)

N-SPC Player is a common SPC player included in many SNES games. The actual player N-SPC itself seems to vary slightly from game to game. Secret of Mana's internal music format can be thought of as a counterpart to N-SPC, as can [Seiken Densetsu 3]( ...

SA-1 Registers

SA-1 Write Registers

Register Address Name Notes
SA-1 CPU Control ...


BG Modes

The SNES has 7 background modes, two of which have major variations. The modes are selected by bits 0-2 of register $2105. The variation of Mode 1 is selected by bit 3 of $2105, and the variation of Mode 7 is selected by bit 6 of $2133.

Mode    # Colors for BG

Capcom Cx4 - Hitachi HG51B169

[[!redirects CX4]] [[!redirects C4]] A DSP chip from Capcom; it is actually a Hitachi HG51B169 as confirmed by decapping. There are 1024K words of 24-bit instructions, running as 20.000MHz. and it is used in 2 games:

65816 Reference

Internal Registers

Mnemonic Friendly Name Description
A Accumulator The accumulator. This is the math register. It stores one of two operands or the result of most arithmetic and logical operations.
X, Y Index The i ...


Emulation History

The decompression was completely cracked on Saturday, July 19th, 2008.

[[DecompTest0.c:file]] [[DecompTest1.c:file]] [[DecompTest2.c:file]]

SPC7110 Info, Reverse Engineered by & (c) Dark Force 

New data added by The Dumper 

SPC71 ...

Daikaijuu Monogatari 2

This is information pertaining to hacking or translating Daikaijuu Monogatari 2.

Compression Methods

Complex and not well explained by default and so many (only more compressed code)


Data length, Addr ...

Star Ocean

Star Ocean Memory Map

Below are the known and unknown offsets for Star Ocean, feel free to expand upon these.


| Memory Address | Description (English / Japanese) | Values | |-------- ...



The SNES has 2 controller ports on the front of the unit, and an "expansion port" on the bottom. Little is known about the expansion port.

A number of peripherals could be plugged into the controller ports: