|[ << ]||[ >> ]||||||||[ ? ]|
This chapter describes the module-independent part of the assembler. It documents the options and extensions which are not specific to a certain target, syntax or output driver. Be sure to also read the chapters on the backend, syntax- and output-module you are using. They will likely contain important additional information like data-representation or additional options.
vasm is run using the following syntax:
vasm<target>_<syntax> [options] file
The following options are supported by the machine independent part
Issues a warning when a label matches a mnemonic or directive name in either upper or lower case.
Defines a symbol with the name <name> and assigns the value of the expression when given. The assigned value defaults to 1 otherwise.
Print all dependencies while assembling the source with the given
options. No output is generated. <type> may be ‘list’ for
printing one file name in each new line, or ‘make’ for printing
a sequence of file names on a single line, suitable for Makefiles.
When the output file name is given by ‘-o’ then
vasm will also print
outname: in front of it.
Note that unlike with ‘-dependall’ only relative include
file dependencies will be listed (which is the common case).
Prints dependencies in the same way as ‘-depend’, but will also print all include files with absolute paths.
Automatically generate DWARF debugging sections, suitable for
source level debugging. When the version specification is missing
DWARF V3 will be generated. The only difference to V2 is that it
.debug_ranges section, with address ranges for all
sections, instead of a bad workaround by specifying
Note that when you build vasm from source, you may have to specify
your host operating system with
-Dname in the Makefile to
include the appropriate code which can determine the current
work directory. Otherwise, the default would be to set the current
work directory to an empty string. Currently supported are:
Enable escape character sequences. This will make vasm treat the escape character \ in string constants similar as in the C language.
Use module <fmt> as output driver. See the chapter on output drivers for available formats and options.
Define another include path. They are searched in the order of occurence on the command line.
When the same file is included multiple times with the same path this is silently ignored, causing the file to be processed only once. Note that you can still include the same file twice when using different paths to access it.
Enables generation of a listing file and directs the output into the file <listfile>.
Set the number of lines per listing file page to <lines>.
Do not emit any form feed code into the listing file, for starting a new page.
Do not include symbols in the listing file.
Defines the maximum number of errors to display before assembly is aborted. When <n> is 0 then there is no limit. Defaults to 5.
Defines the maximum of number of recursions within a macro. Defaults to 1000.
Disables case-sensitivity for everything - identifiers, directives and instructions. Note that directives and instructions may already be case-insensitive by default in some modules.
No escape character sequences. This will make vasm treat the escape character \ as any other character. Might be useful for compatibility.
Perform no automatic alignment for instructions. Note that unaligned instructions make your code crash when executed! Only set when you know what you do!
Strips all local symbols from the output file and doesn’t include any other symbols than those which are required for external linkage.
Disable warning message <n>. <n> has to be the number of a valid warning message, otherwise an error is generated.
Write the generated assembler output to <ofile> rather than ‘a.out’.
Try to generate position independant code. Every relocation is flagged by an error message.
Do not print the copyright notice and the final statistics.
Sections are no longer distinguished by their name, but only by their attributes. This has the effect that when defining a second section with a different name but same attributes as a first one, it will switch to the first, instead of starting a new section.
The shift-right operator (
>>) treats the value to shift as
unsigned, which has the effect that 0-bits are inserted on the
left side. The number of bits in a value depend on the target
address type (refer to the appropriate cpu module documentation).
Hide all warning messages.
The return code of vasm will no longer be 0 (success), when there was a warning. Errors always make the return code fail.
Show an error message, when referencing an undefined symbol. The default behaviour is to declare this symbol as externally defined.
Note that while most options allow an argument without any separating blank, some others require it (e.g. ‘-o’ and ‘-L’).
Standard expressions are usually evaluated by the main part of vasm rather than by one of the modules (unless this is necessary).
All expressions evaluated by the frontend are calculated in terms of target address values, i.e. the range depends on the backend.
The available operators include all those which are common in assembler as well as in C expressions.
C like operators:
+ - ! ~
+ - * / % << >>
& | ^
< > <= >= == !=
Assembler like operators:
+ - ~
+ - * / // << >>
& ! ~
< > <= >= = <>
Up to version 1.4b the operators had the same precedence and associativity as in the C language. Newer versions have changed the operator priorities to comply with the common assembler behaviour. The expression evaluation priorities, from highest to lowest, are:
+ - ! ~(unary +/- sign, not, complement)
<< >>(shift left, shift right)
^ ~(bitwise exclusive-or)
| !(bitwise inclusive-or)
* / % //(multiply, divide, modulo)
+ -(plus, minus)
< > <= >=(less, greater, less or equal, greater or equal)
== != = <>(equality, inequality)
Operands are integral values of the target address type. They can either be
specified as integer constants of different bases (see the documentation
on the syntax module to see how the base is specified) or character
constants. Character constants are introduced by
and have to be terminated by the same character that started them.
Multiple characters are allowed and a constant is built according to the endianess of the target.
When the ‘-esc’ option was specified, or automatically enabled by a syntax module, vasm interprets escape character sequences as in the C language:
Produces a single
The bell character.
Produces a single
Produces a single
Escape character (27).
One character with the code specified by the digits as octal value.
One character with the code specified by the digits as hexadecimal value.
Note, that the default behaviour of vasm has changed since V1.7! Escape
sequence handling has been the default in older versions. This has been
changed to increase compatibility with other assemblers. Use ‘-esc’
to assemble sources with escape character sequences. It is still the
default in the
std syntax module, though.
You can define as many symbols as your available memory permits. A symbol may have any length and can be of global or local scope. Internally, there are three types of symbols:
These symbols are usually not visible outside the source, unless they are explicitely exported.
Labels are always addresses inside a program section. By default they have local scope for the linker.
These symbols are externally defined and must be resolved by the linker.
Beginning with vasm V1.5c one expression symbol is always defined to allow
conditional assembly depending on the assembler being used:
Its value depends on the selected cpu module. There may be other symbols which
are pre-defined by the syntax- or by the cpu module.
Vasm supports include files and defining include paths. Whether this functionality is available depends on the syntax module, which has to provide the appropriate directives.
On startup vasm will define at least one default include path: the current working directory, where the assembler program was launched from. When the input file is loaded from a different directory, i.e. the input file is a relative or absolute path and not a single file name, then the path to the input file name will be added as another include path.
Include paths are searched in the following order:
Macros are supported by vasm, but the directives for defining them have
to be implemented in the syntax module. The assembler core supports 9
macro arguments by default to be passed in the operand field,
which can be extended to any number by the syntax module.
They can be referenced inside the macro either by name (
\name) or by
\9), or both, depending on the syntax module.
Recursions and early exits are supported.
Refer to the selected syntax module for more details.
Vasm supports structures, but the directives for defining them have to be implemented in the syntax module.
Has to be provided completely by the syntax module.
Some known module-independent problems of
vasm at the moment:
All those who wrote parts of the
vasm distribution, made suggestions,
answered my questions, tested
vasm, reported errors or were otherwise
involved in the development of
vasm (in descending alphabetical order,
under work, not complete):
The frontend has the following error messages:
|[ << ]||[ >> ]||||||||[ ? ]|