Cross-Platform Assembler Next page:
    Assembler Syntax

This is an assembler for arbitrary assembly languages and chips. This is achieved through a config file specifying a map from op mnemonic/addressing mode to op-code and a list of addressing modes with a perl regular expression showing how to recognise their use and a specification of what bytes then follow the op-code.

Currently, only single-byte op-codes are supported, but this is being updated. Also, branches are assumed to be single byte branches (so back up to -128 or forward up to +127), though this will also be fixed. Branches are also assumed to count from the next op-code. this will be updated for other formats.

Otherwise, given a suitable specification file for a chip/assembly language, this script should be able to create object code. Currently, there is a spec file available for the 65C02 (except for the BBS0-7 commands) which will also be usable for the 6502, though a slightly modified version should be used to be sure that 65C02 features cannot be used.

The script takes the following options:
-d <config dir>
Specify an alternate directory to search for machine spec files.
-m <machine arch>
Specify the machine architecture to assemble for. The spec must appear in a file of this name (with an optional .spec extension) in the config directory.
-s <start address>
Specify the address that the assembled code is intended to start at.
-b
The architecture is big-endian.
-o <out file>
Specify a file to leave the assembled code in (goes to STDOUT by default).
-D
Turn on debugging output (can produce quite a lot of output!).

Errors with the input are listed on STDERR and will usually abort further processing. Line numbers of errors along with the fatal command are printed.

See the sample ROM pages for examples of code style supported by this assembler.


  Cross-Platform Assembler Next page:
    Assembler Syntax