A portable and retargetable assembler.
Valid HTML 4.01!
About vasm
Last release source
Daily source snapshot
Tagged source archives
Binary releases
Compilation notes
A small tutorial
vasm docs (html)
vasm docs (pdf)
Volker's vasm page
vbcc/Amiga home page

vasm is a portable and retargetable assembler to create linkable objects in various formats or absolute code. Multiple CPU-, syntax and output-modules can be selected.

Many common directives/pseudo-opcodes are supported (depending on the syntax module) as well as CPU-specific extensions.

The assembler supports optimizations (e.g. choosing the shortest possible branch instruction or addressing mode) and relaxations (e.g. converting a branch to an absolute jump when necessary).

Most syntax modules support macros, include directives, repetitions, conditional assembly and local symbols.

Currently the following CPUs are officially supported by vasm:
  • M680x0 family (including M6888x, M68851 and CPU32)
  • ColdFire family (all models of V2, V3, V4, V4e)
  • 80x86 family (IA32 8/16/32 bit, using MIT-syntax)
  • PowerPC family (POWER, 40x, 6xx, 7xx, 7xxx, 860, e300)
  • ARM (architecture ARMv1 to ARMv4, including THUMB mode)
  • Jaguar RISC (GPU and DSP instruction sets)
  • TR3200 (virtual CPU from 0x10c)
  • Z80 family (Z80, 8080, GBZ80, 64180, RCM2/3/4k)
  • C16x/ST10
  • 6502 family
  • 6800 family (6800, 68HC11)
These syntax flavours are supported:
  • Standard MIT (GNU-as style) syntax
  • Motorola/Freescale 68k syntax (Devpac compatible)
  • Atari MadMac syntax (6502, 68k, Jaguar)
  • Old 8-bit style syntax
Supported output file formats:
  • ELF (M68k, PowerPC, i386, ARM and JRISC)
  • a.out (M68k and i386)
  • Amiga hunk format (M68k)
  • TOS executable format (M68k)
  • EHF extended hunk format (PowerPC)
  • Raw, binary output (all)
  • Motorola Srecord format (all)
  • VOBJ proprietary versatile object format (all)
  • Test, debugging output (all)

12-Mar-2016: vasm 1.7e.
  • Ability to print the source line also in output module error messages.
  • Current PC symbol in absolute code regions was erroneously relocated to the section's base address.
  • Make sure that labels from absolute code regions are not relocated.
  • m68k: Fix for a bug introduced in last version: fmovem list,(An) and fmovem list,(d,An) were no longer recognized as valid for M68k FPUs.
  • PPC: Fixed mtvscr instruction, which uses the vB field instead of vD.
  • ARM: Accept the new SVC mnemonic as an alias for SWI.
  • ARM: Fixed macros. Previously only three characters for a macro name were allowed. Qualifiers are not allowed on ARM macros.
  • std-syntax: Permit the '$' as start character and in the middle of a label (note: a terminating '$' still defines a local label!).
  • std-syntax: A missing last macro argument no longer causes an error message, but is replaced by a default value (when defined) or an empty string.
  • std-syntax: .org directive defines the offset from the current section's start address when it appears within a section (GNU-as compatibility).
  • mot-syntax: ORG directive can be used within any normal section to define a block of code relocated to an absolute start address.
  • mot-syntax: Numeric absolute symbol expansion is supported for macro parameters of the form \<symbol> or \<$symbol> (hexadecimal value).
  • madmac-syntax: Removed the -rorg option, which is the default behaviour now.
  • oldstyle-syntax: The special macro argument \@ is replaced by an underscore, followed by a six-digit number again, as before V1.7c.
  • tos-output: Check for overflows in relocation fields.
  • aout-output: Fixed a crash since last version, when embedding absolute code regions in a section.

05-Oct-2015: vasm 1.7d.
  • New option -depend to print the list of file dependencies for the assembled source with the given options and conditions.
  • New output module for Motorola srecord format, contributed by Joseph Zatarski. It can be selected with the -Fsrec option.
  • m68k: Replace all short-branches, except BSR, which have a zero distance by a no-operation instruction. Now we use LEA (A6),A6 for no operation as NOP has a special meaning for certain 68k models.
  • m68k: A zero width in bitfield instructions is accepted. It is equivalent to a width of 32 and used in some sources.
  • m68k: New option -gas enables GNU-as specific mnemonics and additions. 68020/68881 is selected by default.
  • m68k: New option -sgs to enable & as an additional immediate operand prefix (SGS assembler).
  • m68k: New option -no-fpu to ignore any FPU directives or options.
  • m68k: Support immediate register list masks also for FMOVEM.
  • m68k: jbra/jbsr are always converted to branches, when the selected CPU supports 32-bit branches (gas compatibility).
  • tr3200: Add data relocations. Fix PC-relative RJMP instruction.
  • ARM: Accept an additional operand after an immediate constant to specify the even rotate-count (0-30). Usually vasm does that automatically.
  • mot-syntax: The symbol __LINE__ always contains the current line number.
  • std-syntax: Add .even directive.
  • std-syntax: Besides 0f also allow 0r as a floating point constant prefix.
  • aout-output: Fixed common symbols.
  • aout-output: Implemented stabs support.

15-May-2015: vasm 1.7c.
  • Complete redesign of the internal macro handling, which gives each syntax module more possibilities for individual macro features.
  • New syntax module: madmac, which tries to be compatible to the Atari Madmac assembler syntax, used for 6502, 68000 and Jaguar RISC targets.
  • New CPU backend for the virtual Trillek TR3200 CPU (known from 0x10c).
  • Allow arithmetic operations with more than one label from absolute ORG sections (like label1|label2). Support also depends on cpu backend and should work at least in data for most backends now.
  • Stop parsing a file at CP/M EOF character (0x1a), as seen in some sources.
  • No longer allow redefining a symbol, defined by an equ/equiv directive, with a set-directive.
  • Fixed problems with escape character sequences in strings inside a macro definition, when syntax module supports escape characters.
  • m68k: In MULx.L Dn,Dl the Dh bits (bit 0-2, 2nd word) are undefined. Most assemblers set Dh=Dl, similar to Dr=Dq in DIVx.L. So should we.
  • m68k: New option -regsymredef allows redefinition of register symbols while parsing the source.
  • m68k: Fixed "OPT 0" in PhxAss compatibility mode (broken since V1.7), which made all branches 16-bit size.
  • m68k: Register lists defined by REG, EQURL, FREQ, FEQURL must not be redefinable.
  • PPC: Support for floating point data constants.
  • jagrisc: Added absolute and relative 5 bit source operand relocations. Fixed relative JR relocations.
  • jagrisc: Fixed (R14+Rn) addressing mode.
  • jagrisc: New JRISC specific directives: GPU, DSP, REGEQU, EQUR, REGUNDEF, EQURUNDEF, CCDEF, CCUNDEF (madmac/smac compatible).
  • z80: Fixed RST (again), when referencing labels from an absolute section.
  • mot-syntax: New option -allmp makes all 36 macro arguments available, also in standard vasm mode (no PhxAss or Devpac compatibility required).
  • mot-syntax: New option -warncomm to warn about blanks in the operand field, which may start an unwanted comment.
  • mot-syntax: CNOP fills the padding words with NOP instructions in an M68k code section.
  • mot-syntax: The optional third argument of the SECTION directive may be written as a numerical constant to define any memory attributes (hunk format only).
  • mot-syntax: New directive WEAK, to declare a symbol having weak binding, for those output formats which support it.
  • mot-syntax: New directive COMMON, to create a common symbol.
  • mot-syntax: Made PRINTT and PRINTV directives more compatible to AsmOne.
  • mot-syntax: Fixed RS.x without operand (same as RS.x 0).
  • std-syntax: The standard GNU-as macro syntax, with named arguments, default values and qualifiers, is supported now. Macro names became case-insensitive.
  • std-syntax: Directives are case-insensitive.
  • std-syntax: New optional, non-standard, third argument for the .section directive defines target specific memory attributes (currently hunk format only).
  • std-syntax: .b/.w/.l extensions do not belong to an identifier, when the CPU is M68k.
  • std-syntax: Directives to define floating point constants in data: .float, .single and .double.
  • std-syntax: .equiv directive. Works like .set and .equ, but cannot be redefined.
  • aout-output: Absolute ORG sections are appended to a .text section. Support for Jaguar, which uses MID 0.
  • bin-output: Sort sections by their start address before writing them.
  • hunk-output: Align M68k code sections with NOP instructions.
  • hunk-output: Supports any memory attributes in objects and executables.
  • hunk-output: Warn about unsupported weak symbols.
  • hunk-output: Fixed illegal memory access with unreferenced common symbols.
  • hunk-output: Automatically generate short relocation hunks (HUNK_DREL32) in executables, when possible and not forbidden by a -kick1hunks option.
  • hunk-output: Support for 32-bit PC-relative relocations in executables (available since AmigaOS3.0).
  • tos-ouput: Warn about unsupported weak symbols.
  • elf-output: Add support for jagrisc (EM_JAGRISC = 0x9004). This is an unofficial definition done by the Jaguar scene.
  • aout-output: For M68k use the SUN010 or SUN020 MID, depending on the highest cpu type being used in the source.

28-Dec-2014: vasm 1.7b.
  • Fixed stack overflow and crash when using recursively defined symbols. Bug was present since introducing new 128-bit and float expressions in 1.7.
  • Issue a warning when a symbol was declared as external, but nowhere referenced in the source.
  • m68k: Do not optimize MOVEM to MOVEA or MOVE when predecrement or postincrement addressing mode is used with a register from the list.
  • m68k: The Devpac directive OPT X (xdebug) works now as expected for hunk-format object files and for TOS executables.
  • m68k: In Devpac-compatibility mode (-devpac) the __LK symbol is predefined and reflects the output file type: 0 = Atari executable, 3 = Amiga object, 4 = Amiga executable, 99 = all others which are unknown to Devpac.
  • m68k: MOVEM #list,-(An) must not reverse the bit mask automatically, but expect an already reversed one.
  • m68k: BTST #n,#m is illegal.
  • m68k: LEA (d32,An),Am translation to MOVE.L/ADD.L stopped working with V1.6c. Fixed again.
  • ARM: TEQP, TSTP, CMNP and CMPP were missing for AA2.
  • ARM: Fixed recognition of addressing mode and condition codes with instructions written in upper case.
  • 6502: New option -c02 to enable 65C02 instructions.
  • mot-syntax: In PhxAss- and Devpac-compatibility mode only the directives which are known by the emulated assembler are supported.
  • mot-syntax: RS, SO and FO offset directives use an aligned offset in Devpac-compatibility mode or when the -align option is given.
  • std-syntax: The optional third argument of .balign/.p2align/.align is now really supported and defines a maximum number of padding bytes.
  • std-syntax: New directives: .balignw, .balignl, .p2alignw, .p2alignl, .zero, .swbeg.
  • std-syntax: .word should rather define 16-bit than 32-bit constants.
  • std-syntax: .local followed by .comm should be the same as .lcomm.
  • oldstyle-syntax: Fixed recognizion of .equ/.eq/.set/.mac/.macro with -dotdir option.
  • hunk-output: New option -linedebug automatically generates a LINE DEBUG hunk for the input source.
  • aout-output: Always generate an external reference to a weak symbol, even when the symbol is defined.
  • elf-output: Always generate an external reference to a weak symbol, even when the symbol is defined.

25-Aug-2014: vasm 1.7a.
  • Addend for "external_label-current_section_label" PC-relative relocation was not calculated correctly.
  • Do not generate relocations with absolute ORG sections. External references from such a section are illegal.
  • Fixed PC-relative references between absolute ORG sections.
  • Defining a macro with the same name as a directive or mnemonic no longer causes and error, but a warning. Like most other assemblers vasm will ignore this macro definition.
  • New option -unsshift to make right-shift operations unsigned (logical), depending on the CPU's target address type.
  • Fixed some problems caused by signed sizes and section offsets.
  • Fixed -x option again. It only printed the first undefined symbol.
  • When specifying a listing file with -L <name> the source was not included. The default is now to include it. Can still be controlled by list/nolist directives.
  • Allow printing of multiple optimization messages for a single source line (-showopt).
  • Fixed infinite loop with huge octal and binary values, which got a decimal point or exponent.
  • Automatically rearrange nodes from "const-symbol-symbol", so that "symbol-symbol" is evaluated first, as it may yield a constant.
  • Fix compiling with pre MSVC 2013 versions (missing strtold()).
  • m68k: -opt-fconst, which is enabled in vasm-default mode since 1.6a, was broken for double to single precision conversions, as it moved following labels by 4 bytes.
  • m68k: -devpac compatibility includes unsigned right-shifts.
  • m68k: NEAR CODE from PhxAss is supported and translates all absolute JMP/JSR with an external symbol into 16-bit PC-relative addressing mode.
  • m68k: New option -sc to set small code mode (same as NEAR CODE directive).
  • mot-syntax: SECTION with a single argument defaults to a code section, except when the name is "data" or "bss".
  • hunk-output: New option -kick1hunks to use only those hunk types and external reference types which have been valid at the time of Kickstart 1.x for compatibility with old assembler sources and old linkers.
  • tos-output: A 16-bit aligned section size must also show up in the header.
  • tos-output: New option -monst for writing Devpac MonST-compatible symbols.

02-Jul-2014: vasm 1.7.
  • Labels in an absolute ORG section have no longer any restrictions regarding arithmetic and logical operations on them.
  • New expression evaluation module. Now also supports floating point and huge integer (128-bit) expressions in all backends.
  • New CPU backend for the Jaguar GPU and DSP RISC processors.
  • The path to the input source file is automatically added to the list of include paths to search.
  • Fixed a serious bug with offset sections. Labels from those sections were still treated as real labels, instead of expressions (offsets), until the final pass.
  • The value of the repetition symbol (REPTN) was reset to -1 when recursively calling a macro or entering an include file inside a repetition.
  • The number of 50 fast optimization passes may not be enough in some cases. So this phase will be extended by another pass whenever a pass included no modifications which made the code larger.
  • Exit immediately when the maximum number of errors has been reached and not before printing an additional error.
  • Escape code handling in string constants is no longer the default. It has to be explicitely enabled using the -esc option. Although, it is still the default in the std syntax module.
  • 6800: Added some missing 6800 instructions (addb, dec).
  • 6800: Labels are always addressed in extended mode. Use the < prefix to override that.
  • 6800: Accept lda and ldb as an alias for ldaa and ldab.
  • z80: Data definitions in parentheses, although unnecessary, should be allowed.
  • m68k: Never try to optimize JMP/JSR (label,PC).
  • m68k: Allow bad instruction aliases, like movea when the destination is not An, but warn about it.
  • m68k: New option -guess-ext makes the assembler accept a bad size extension, as long as the instruction is unsized or there is just a single size possible. This is the default setting for PhxAss- and Devpac-mode.
  • m68k: The size extension of branch instructions is completely ignored, also when illegal, if -guess-ext and -opt-allbra are specified (-phxass).
  • m68k: The PhxAss OPT directive must not reset the -opt-allbra flag. It is always enabled in PhxAss compatibility mode.
  • ARM: Supports 64-bit data.
  • mot-syntax: New directives import (same as xref) and export (same as xdef) for Atari PureC/AHCC compatibility.
  • mot-syntax: FAIL is no longer fatal and displays a normal user error in the final pass.
  • mot-syntax: Labels terminated by a colon must not start on the first column of a line.
  • mot-syntax: FEQU directive to assign floating point expressions to a symbol.
  • mot-syntax: EQU.<size> and =.<size> to assign floating point expressions in PhxAss compatibility mode.
  • std-syntax: .comm and .lcomm will now use the default alignments from the current CPU backend.
  • std-syntax: .err is no longer fatal and displays a normal user error in the final pass.
  • std-syntax: .abort is no longer a fatal error, but terminates assembly at that point with a normal error.
  • oldstyle-syntax: FAIL is no longer fatal and displays a normal user error in the final pass.
  • oldstyle-syntax: Supports intel-style constant suffixes (like 'h' to indicate hexadecimal).
  • oldstyle-syntax: A terminating colon on a label is also allowed before an equate, set or macro directive.
  • oldstyle-syntax: Added IFD and IFND (same as IFDEF and IFNDEF).
  • tos-output: Fixed a potential problem allocating 0 bytes, when there are no reloctions in a file.

$Id: index.php,v 1.11 2015/07/26 13:13:39 frank Exp $