User guide

Don’t write code like this: LDX #0 : LDY #0 : LDA #0 : RTS
The assembler will see: LDX #0 (only the first instruction, the “LDX”)
The source file is always read from the start to the end. It is possible to assemble in any location in the &FFFF
(64K) addressing space at any given time by setting the address with the org command, however over-use of
this can lead to messy code and other complications.
Where execution starts depends on what you are assembling. Typically a program is entered at the beginning
of the code; while a(n) (EP)ROM image is entered at the location of the processor’s reset vector.
The format of a line
There are three types of line:
a. Labels
.<label>
Labels are on a line by themselves, and consist of a period followed by the label name. The names
are unique to forty-seven characters. Label space is allocated as the label is encountered, so there
shouldn’t be any restrictions other than available memory. It is perfectly valid to define multiple
labels at the same location, for example:
ORG &A000
.via
.via_base
.via_iorb
DCB 0
After that, any reference to via or via_base or via_iorb will be treated as a reference to &A000.
This is how the memory-mapped hardware is set up in Amélie’s source code. The DCB inserts a
‘dummy byte’ (as only the EPROM code is actually saved). It is a lot tidier to do that than to alter
the address with org for every label we define (the VIA has 16 of them...).
Labels are unique to 47 characters. Anything longer will be truncated.
It is currently possible to define the same label multiple times. If this happens, only the first will
be used when referring to that label.
b. Assembler commands
<command> [<parameters>]
Assembler commands are special commands understood by the assembler. More on these later.
6502asm user guide – prerelease version
page 3