Free SNES assembler

0. Contents

This is the documentation of snescom-1.0.0.
   1. Purpose
   2. Supported syntax
      2.1. Mnemonics
      2.2. Addressing modes
      2.3. Operand size control
      2.4. Expression evaluation
      2.5. Comments
      2.6. Command separation
      2.7. Preprocessor
      2.8. Object file format
   3. Examples and more documentation
   4. Copying
   5. Downloading

1. Purpose

This program reads symbolic 65816 or 65c816 machine code and compiles (assembles) it into a relocatable object file.

The produced object file is binary-compatible with those made with XA65.

2. Supported syntax

2.1. Mnemonics

The following mnemonics are supported:

ADC, AND, ASL, BCC, BCS, BEQ, BIT, BMI, BNE, BPL, BRA, BRK, BRL, BVC, BVS, CLC, CLD, CLI, CLV, CMP, COP, CPX, CPY, DB , DEC, DEX, DEY, EOR, INC, INX, INY, JML, JMP, JSL, JSR, LDA, LDX, LDY, LSR, MVN, MVP, NOP, ORA, PEA, PEI, PER, PHA, PHB, PHD, PHK, PHP, PHX, PHY, PLA, PLB, PLD, PLP, PLX, PLY, REP, ROL, ROR, RTI, RTL, RTS, SBC, SEC, SED, SEI, SEP, STA, STP, STX, STY, STZ, TAX, TAY, TCD, TCS, TDC, TRB, TSB, TSC, TSX, TXA, TXS, TXY, TYA, TYX, WAI, XBA, XCE

2.2. Addressing modes

All the standard addressing modes of the 65816 cpu are supported.

2.3. Operand size control

The pseudo ops .as, .al, .xs & .xl are used to decide what size accumulator and index mode for the assembler to use. .as and .xs are for 8bit operands, and .al and .xl are for 16 bit operands.

I've found it handy to define these macroes:

#define SET_8_BIT_A()   sep #$20 : .as
#define SET_16_BIT_A()  rep #$20 : .al
#define SET_8_BIT_X()   sep #$10 : .xs
#define SET_16_BIT_X()  rep #$10 : .xl

#define SET_8_BIT_AX()  sep #$30 : .xs : .as
#define SET_16_BIT_AX() rep #$30 : .xl : .al
In addition to these modes, there are several operand prefixes that can be used to force a certain operand size/type.

2.4. Expression evaluation

Expressions are supported. These are valid code:

2.5. Comments

Comments begin with a semicolon (;) and end with a newline.
A colon is allowed to appear in comment.

2.6. Command separation

Commands are separated by newlines and colons (:).

2.7. Preprocessor

snescom uses GCC as a preprocessor.
You can use #ifdef, #ifndef, #define, #if, #endif and #include like in any C program.

2.8. Object file format

Currently snescom only produces relocatable object files.
The file format has been documented by André Fachat for the XA65 project.

3. Examples and more documentation

In the source distribution there are some C++ modules that can be used to handle the o65 files.
There are also some example assembler files (copied from Chronotools).

4. Copying

snescom has been written by Joel Yliluoma, a.k.a. Bisqwit,
and is distributed under the terms of the General Public License (GPL).

If you happen to see this program useful for you, I'd appreciate if you tell me :) Perhaps it would motivate me to enhance the program.

5. Downloading

The official home page of snescom is at http://iki.fi/bisqwit/source/snescom.html.
Check there for new versions.

Generated from progdesc.php (last updated: Sun, 28 Sep 2003 03:42:21 +0300)
with docmaker.php (last updated: Thu, 13 Feb 2003 15:11:29 +0200)
at Sun, 28 Sep 2003 03:42:23 +0300