Next Previous Contents

3. Input format

The assembler accepts the standard 6502/65816 assembler syntax. One line may contain a label (which is identified by a colon), and, in addition to the label, an assembler mnemonic, a macro, or a control command (see section Control Commands for supported control commands). Alternatively, the line may contain a symbol definition using the '=' token. Everything after a semicolon is handled as a comment (that is, it is ignored).

Here are some examples for valid input lines:

        Label:                          ; A label and a comment
                lda     #$20            ; A 6502 instruction plus comment
        L1:     ldx     #$20            ; Same with label
        L2:     .byte   "Hello world"   ; Label plus control command
                mymac   $20             ; Macro expansion
                MySym = 3*L1            ; Symbol definition
        MaSym   = Label                 ; Another symbol

The assembler accepts all valid 6502 mnemonics when in 6502 mode (the default). The assembler accepts all valid 65SC02 mnemonics when in 65SC02 mode (after a .PC02 command is found). The assembler accepts all valid 65816 mnemonics with a few exceptions after a .P816 command is found. These exceptions are listed below.

In 65816 mode several aliases are accepted in addition to the official mnemonics:

        BGE is an alias for BCS
        BLT is an alias for BCC
        CPA is an alias for CMP
        DEA is an alias for DEC A
        INA is an alias for INC A
        SWA is an alias for XBA
        TAD is an alias for TCD
        TAS is an alias for TCS
        TDA is an alias for TDC
        TSA is an alias for TSC

Evaluation of banked expressions in 65816 mode differs slightly from the official syntax:

Instead of accepting a 24 bit address (something that is difficult for the assembler to determine and would have required one more special .import command), the bank and the absolute address in that bank are separated by a dot:

        jsl     3.$1234         ; Call subroutine at $1234 in bank 3

For literal values, the assembler accepts the widely used number formats: A preceeding '$' denotes a hex value, a preceeding '%' denotes a binary value, and a bare number is interpeted as a decimal. There are currently no octal values and no floats.


Next Previous Contents