ASM Hacking for Dummies

This document was written for the aspiring ROM hacker with little to no experience in 65c816 programming.

BS-X RAM Map

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
 $7E1433 - Seconds before timeout
 $7E1437 - Ticks before timeout

 $7E1C00:$7E1E20 - ...

Bit Rate Reduction (BRR)

BRR, or Bit Rate Reduction, is the sound encoding scheme used by the SPC700, the sound chip in the SNES.

Copiers

Copiers were the original way to pirate games.

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):

0000-000F

47 41 4D 45 20 44 4F 43 54 4F 52 20 53 46 20 33 "GAME DOCTOR SF 3"

This is the ID string for a Game Doctor SF header.

0010

SRA ...

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 the accumulator is only there as an operand buffer. Please avoid this style of programming. It is

Kirby Super Star

Also known as Hoshi no Kirby Super Deluxe and Kirby's Fun Pak.

Memory Pack Game Support

A few games on Super Famicom supports Memory Pack and Satellaview content.

Games

Derby Stallion 96

Check for Additional Content

Joushou Mahjong Tenpai

Memory Pack can be accessed through the 3rd menu from the top and left.

Check for Additional Content

Content must be at the start of Memory Pack, must be HiROM and 4M.
$A080E0 (0x80E0): "JYAN-OH TOHRYUMON SFX (SAT-VIE ...

Palettes

The Super Nintendo / Super Famicom stores its palette in 512 bytes in a 15-bit BGR format.

SA-1

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 additional shared RAM, visible to both the SNES CPU and the SA-1, and optionally backed up by battery referred to as BW-RAM with a maximum install RAM size of 256 KB (2 Mbit).

SNASM

A SNES 65816 Cross Assembler for the IBM PC

Version 1

Introduction

SNASM is a 65816 Cross Assembler which produces SNES code in Super Magicom format.

SNASM is a fast 2 pass assembler, supporting source and binary include files, generation of listing files and labels files, generation of executable or object files and support for all 65816 instructions and addressing modes.

C ...

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 evident in the following diagram, the selector's internal circuit can be divided in three discrete units, ...

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.

Documents

  1. One great assortment of files was gathered by Qwertie, it contains documents on the cpu, graphics, etc: snesbase.7z
  2. Yoshi's docs - Oh wait, that's in the zip above. :) (i ...

Stunt Race FX

Stunt Race FX / Wild Trax

The following information is for the US version of the game.

Track Data

Locations

Offset Description
1F4A5 - 1F4F8 Track Data pointers (3 bytes per track, 28 tracks)
28000 Menu "Track" Data
28074 00- ...

Super FX cycle times

Number of cycles each SuperFX instruction takes depending on where it is run from

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 System.
  • Supports 3.5" or 5.25" Floppy Disk Drive.
  • Db-25 Female Connector. (Non-Standar ...

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 Register Select
$21E3 - Sony CXD1800Q Interface
$21E4 - Interrupt Enable
          d1 =  ...

Testing Code

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

Methods

Although for most software these choices are, mostly, about preference. Most games which require Expansion Chips other than the DSP-1 may require less than favorable methods of testing (either emulation or reproduction cartridge).

Emulators

...

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 making minor modifications to its mapping scheme.

Memory Mapping

The SNES has a 24-bit a ...

Using DMA Effectively

So you're making a Super Nintendo game, (or demo) and you run into a problem. You want to animate sprites and BG tiles, but you ran out of v-blank time with all the heavy DMAing you're doing. What this tutorial covers is how to avoid the dreaded v-blank limit, without blowing your brains out with frustration.

Making a table for DMA updates

You might at first take the "hardwired" appr ...

Widespread Myths

Widespread Programming Myths, These are myths that frequently show up that mislead people into writing bad code based on false perception of what the system actually does.