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, to complain about how I suck at tutorials. Learning ASM language isn't easy. If ...

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 programming and add hacks to your rom. It's going to be fun to add custom stuff to your hack, isn't ...

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 tutorials are for teaching you how to use [65816](/65816-refe ...


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.


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


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 (i.e. it doesn't depend on user input or any other randomness) will always give the same results on r ...

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

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 will carry into the next bank.
Absolute Indexed Y -- a,Y
  • Adding Y may carry into ...



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 of switching back and forth between native and emulation mode.



PHP and **PLP ...

ASM Hacking for Dummies

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 65c816 ROM hacking. Hopefully this proves true. If you benefit from this document or have suggestions for changes to make to it, please eMai ...