ASM Hacking for Dummies

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

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 stuff. Don't worry, everything will be explained easily.

Lesson 6: Indexing

So... you know ...

BS-X 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 $6000-$7FFF : PSRAM (From offset $6000 of PSRAM) (Direct Access)
$40-$7D $0000-$FFFF : Memory Pack [HiROM mode]
$40-$4F $0000-$FFFF : ...

Bit Rate Reduction (BRR)

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

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 Recompressor: GDLeen ver 1.0  //
//                                                //
// Coded By:   John C. (Bongo`) ...

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

Gau_Veldt

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 with SA-1 enabled, 8 MB (64 Mbit) ROM and audio streaming (like we got in Tales of Phantasia and Star O ...

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

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

PHP

All about the PHP instruction

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

ST010

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 serial SETA ESP-0019C SHVC PCB and the following chips:

DSP            Crystal
=========

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

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

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

...

Timing

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.

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

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.

XBAND

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 justice to the original device. Attached in the following link is a zip file containing documentation of i ...

xkas

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.

Features

  • Supports All 256 Opcodes
  • Supports Labels / Sublabels / +/- Labels
  • Supports Math
  • Supports ASC ...