Working with Audio and Video

Managing Media Files


brew install ffmpeg mediainfo mkvtoolnix mp4box

Handbrake Subler

mv SublerCLI /usr/local/bin/SublerCLI

Identifying Problems in Files

mediainfo source.mkv

Co ...

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 ...

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 ...

ikari_01's SNES Debugging - Drakkhen II Text Compression

The text is taken from the video pages.

Part 1

This is just a little experiment and totally unrelated to sd2snes.

I was asked to figure out the text compression used in Dragon View (Drakkhen II). Another user suggested that I record the process to show him the way I approach something l ...

Satellaview AV selector

Satellaview AV Selector

The satellaview AV selector was conceived in order to prepare the decoded satellite signal for the satellaview, prevent the super famicom from monopolizing the TV's AV input, and allow for the use of a second BS decoder along with the one provided by ST. Giga. As is eviden ...

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 ...

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 ...

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 ...

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 ...

Schematics, Ports, and Pinouts

[[!redirects Ports & Pinouts]] [[!redirects SNES Ports]] This is a document intended to describe the various hardware ports on the SNES. It will not describe how these ports are used by what may be plugged into them.

In the doc below, "active", "1", "logic-1", and ...

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 ...


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 ...

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 ...


XBA - Exchanges B with A


XBA swaps the values of the two 8-bit accumulators A and B. It should be noted that A and B don't swap position - it's only their values that exchange. If they swapped positions that would add a lot of confu ...

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 ...


The masking windows are pretty simple. The windows can be used to mask off a portion of any BG on the scanline. With [[HDMA]], they can be adjusted per scanline. They can be combined in various ways, per BG. Each can be used to select either the region of the BG to keep, or the region of the BG to h ...


Address Bus B Registers

TODO: note on fast access time

Register Address Name Style Access Timing
Screen Display ...

Instruction Wrapping

Program Counter Increment
  • Always wraps within the bank, at any point in the opcode.
Absolute -- a
  • Word reads in native mode will carry into the next bank.
Absolute Indexed X -- a,X
  • Adding X may carry into the next bank.
  • Word reads in native mode ...

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 ...

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 ...

Rendering the Screen


The mosaic filter is applied after the BG is rendered and scrolled but before it is clipped, combined with other BGs, pseudo-hiresed, or mathed. Each XxX block of pixels is replaced with the upper-leftmost pixel of the block. The 'blocks' are such that the upper-leftmost block is at th ...


DMA, or "direct memory access" is found in a number of computer systems, not just the Super Nintendo. It's basically a way for a peripheral or coprocessor to read data directly from memory, instead of requiring the main CPU to do a number of reads and writes. This is typically faster, if o ...


15-Bit BGR Format

The Super Nintendo / Super Famicom stores it's palette in 512 bytes in a 15-bit BGR format. Each BGR word is 2 bytes, thus it is 512 bytes for 256 colors (256 x 2). The format for each BGR word looks like this:


Bit 15 is unused and should be set ...

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. ...


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

BS-X BIOS Functions

All those documented BIOS functions are based from the SRAM Map; In case of an updated version, I'll put it with the original.

Function names are based on nocash's doc:

1059A4 init_port_2199_registers


  JML $80C36D //init_port_2199_registers


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 ...

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, ...

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 ...

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 ...

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 ...


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. ...



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 ...

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 ...

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 ...

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

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 ...

SuperDisc Registers

Super Disc Expansion Drive

This drive uses the EXT port for communication (while not directly plugged). Because this uses the B-Bus Memory, it can only use $21xx registers.

$21D0 - ? (Always zeroes it)
$21E0 - ?
$21E1 - NEC D75P308GF Interface
$21E2 - Sony CXD1800Q Reg ...

SNES Development Hardware and Software

SNES Development Hardware / Software

  • [[Sluggo III]]

Psygnosis PSY-Q Development System for SuperNES

To enter a diagnostics mode, hold the Left Trigger + Right Trigger + Start + Select and a diagnostics screen will appear.

The cart PCB has the following labels:

  • SNES Cart v ...

SA-1 Registers

SA-1 Write Registers

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


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 ( ...


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 ...


The transparency on the SNES, while documented properly, made me have some headaches understanding how it works. Now that I've figured the truth (or at least I'm pretty damn close to), I'm writing a small document to spare someone else the headaches I've had if if could be useful to someone wanting ...

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 ...

BS-X Satellaview Header

The header will be at 0x7xxx (for LoROM) or 0xFxxx (for HiROM).

xFB0-xFB1 = ID
xFB2      = ?? Unknown, gets compared to 0001
xFC0-xFCF = Title
xFD0-xFD3 = Block Allocation flags (for 32 blocks of 128Kbytes each bit, 32Mbits max)
xFD4-xFD5 = Limited Starts
xFD6     ...



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:

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 ...


This page contains the RAM Map of the BS-X.

 $7E00AC - BS-X Token Interpreter Current Address (24-bit)
 $7E0725 - Text Settings

 $7E13C5 - Error Number

 $7E1427 - Copy Type
 $7E1430 - Current Month
 $7E1431 - Current Day
 $7E1432 - Data Type



The BS-X cartridge has a MMIO included in Memory 00-0f:5000. (Info taken from bsnes and sd2snes' verilog source)

They all do different things to the Memory, and is NECESSARY, to run games, and other stuff.

We will call them from r00 to r0f. Those have only one bit that can be set.

MCC ...

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 ...

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:

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 ...


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 ...