User guide

Introduction
6502asm is a simple assembler for 6502 code. It supports a variety of assembler commands to control output
and extend the 6502 instruction set.
The instruction set provided is the legal NMOS 6502 set, and the CMOS 65C02 instruction set according to
the Western Design Center W65C02S datasheet (not the MOS 65CE02 variant).
The NMOS “undocumented” instructions are not supported.
The command syntax is:
6502asm <input file> <output file>
Purpose
6502asm is part of the Amélie project. It was written in order to allow the BIOS code to be written and
compiled without requiring the use of a BBC microcomputer (or emulator). While it is primarily intended for
this purpose, it is flexible enough to be used for the assembly of 6502 code for other environments, such as
the BBC micro (or compatible) or other 6502-based devices.
6502asm fits in with Amélie’s philosophy of “keep it simple”.
6502asm assembles in two passes, much as code is usually assembled under BBC BASIC. Currently,
6502asm does not support macros or conditional assembly, though these features are “in planning”.
If you are used to Acorn systems, you may be pleased to know that 6502asm considers ‘&’ to mean “this is a
hex number”, which is one of the main reasons I wrote this instead of using one of the many other 6502
assemblers available. If, however, you are not used to Acorn, you can use the Pascal prefix ‘$’ or the C prefix
‘0x’ to denote a hex number.
The DOS-like (an ‘h’ suffix) and the VisualBasic-like (‘$H’ prefix) methods are not supported.
The Amélie project source code uses ‘&’ throughout.
The format of a source file
The source code provided to 6502asm is a plain text file consisting of a number of lines. These lines can be
comments, directives, compiler commands, label definitions, or instructions.
The only thing you must note right from the outset is that the assembler only understands one entity per line.
If, for example, the line is a label, then any code following must begin on the next line. Furthermore, the use
of the colon to write multiple statements on one line is not supported. In difference to the BBC BASIC
assembler, you should use ‘;’ for comments and not ‘\’ or ‘REM’; though the assembler reads only what is
necessary so there is some leeway.
Don’t write code like this: .zeroregs LDX #0 : LDY #0 : LDA #0 : RTS
The assembler will see: .zeroregsldx (a label called “zeroregsldx”)
6502asm user guide – prerelease version
page 2