vasm

A portable and retargetable assembler.
About vasm
Last release source
Daily source snapshot
Tagged source archives
Last release binaries
Daily snapshot binaries
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 (loosely ordered by maturity):
  • M680x0 family (including M6888x, M68851, CPU32 and Apollo 68080)
  • ColdFire family (all models of V2, V3, V4, V4e)
  • PowerPC family (POWER, 40x, 440, 460, 6xx, 7xx, 7xxx, 860, Book-E, e300 and e500)
  • 6502 family (including 65C02, 65CE02, DTV, 45GS02, HU6280, 65802, 65816)
  • 6809 family (6809, 6309 and 68HC12)
  • Z80 family (Z80, 8080, 8085, GBZ80, 64180, RCM2/3/4k)
  • Jaguar RISC (GPU and DSP instruction sets)
  • ARM (architecture ARMv1 to ARMv4, including THUMB mode)
  • 80x86 family (IA32 8/16/32 bit, using AT&T-syntax)
  • C16x/ST10
  • 6800 family (6800, 6801, 6803, 68HC11)
  • PDP-11 architecture (includes EIS, FIS)
  • QNICE (elegant 16-bit FPGA CPU)
  • TR3200 (virtual CPU from 0x10c)
  • Raspberry-Pi VideoCore IV
These syntax flavours are supported:
  • Standard (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, i386 and JRISC)
  • Amiga hunk format (M68k)
  • Atari TOS executable format (M68k)
  • Atari DRI object file format (M68k)
  • GST object file format
  • Sharp X68000 Xfile format (M68k)
  • EHF extended hunk format (PowerPC)
  • o65 relocatable format (6502, 65816)
  • Raw, binary output (all)
  • Apple DOS, Atari COM, Commodore PRG, Oric TAP binary formats (6502)
  • Wozmon monitor format (6502)
  • C256 Foenix PGX and PGZ binary formats (65816)
  • Tandy Color Computer and Dragon DOS binaries (6809)
  • Motorola Srecord format (all)
  • Intel-Hex format (all)
  • C #define output format (all)
  • VOBJ proprietary versatile object format (all)
  • Test, debugging output (all, default)


10-Nov-2023: vasm 1.9f.
  • Fix relative section offset directives, which must be unsigned to work correctly over the whole target's address space.
  • Fixed a few issues with named macro arguments.
  • Do not warn about missing references to Common or Weak symbols.
  • Binary output modules allow addresses outside of the backend's address space.
  • m68k: MOVEM (An),An/Am must not be optimized into two MOVE instructions. This was a new bug in V1.9e.
  • std-syntax: Fixed binary constant 0b...., which was erroneously mistaken for a one-digit temporary label destination since V1.9a.


30-Sep-2023: vasm 1.9e.
  • Exit before reading the source (from stdin) when there were errors already.
  • Make sure the relocated blocks within all sections are closed after parsing. Otherwise the first pass may find the section in a wrong state.
  • Output modules may define the default section, when no SECTION or ORG directive was given. "bin", "ihex" and "srec" now default to "ORG 0".
  • New output module "woz", which outputs sections as "wozmon" monitor commands, suitable for ASCII transfer via a serial connection. Contributed by anomie-p.
  • m68k: Improved -opt-movem (OPT om+) optimizations, for MOVEM with two registers.
  • m68k: Fixed Apollo ADD/SUB->ADDQ/SUBQ optimization with AMMX registers.
  • m68k: Enabled Apollo FPU instructions using 64-bit data registers: Fxxx.D Dn,ea, FMOVE.D Fn,Dm, etc.
  • m68k: Added missing PC-relative destination addressing modes for Apollo shift instructions and FMOVE, FMOVEM.
  • m68k: Apollo bchg/bclr/bset/btst Dn,An must not be allowed (conflicts with MOVEP).
  • m68k: New Apollo instructions FDBcc.L, DBcc En,lab; EXTUB.L and EXTUW.L.
  • 6809: Fixed typo in the opcode for the 6309 LDMD instruction.
  • mot-syntax: Allow multiple consecutive relocated blocks within a section.
  • mot-syntax: New directives LOCAL and RSEVEN for compatibility.
  • mot-syntax: Allow any type of expression for RSSET, SETSO, SETFO.
  • madmac-syntax: Allow multiple consecutive relocated blocks within a section.
  • oldstyle-syntax: The label defining the size of a STRUCT block may have been moved into the previous section, or caused a segfault at ENDSTRUCT, since V1.9b.
  • tos-output: Also write absolute symbols (equates) into executables.
  • tos-output: New option -szbx to enable unlimited symbol names using the SozobonX extension.
  • bin-output: New option -start to define the start address for the default org-section.


23-Apr-2023: vasm 1.9d.
  • m68k: Using MOVEQ.L instead of MOVEQ must only disable the warning for values between 128 and 255, but not allow any value without error.
  • mot-syntax: XREF allows no definition and XDEF requires a definition.
  • std-syntax: Fixed potential problem with "scratch at end of line" warnings after a section attribute string.
  • oldstyle-syntax: Fixed potential problem with "scratch at end of line" warnings after a section attribute string.
  • tos-output: Reloc-output in executables was broken since V1.9b! Restrict to 32-bit absolute relocations again.


29-Mar-2023: vasm 1.9c.
  • Reverted a last-minute change in V1.9b, which broke the O65 output module, used with 6502 and 65816.


26-Mar-2023: vasm 1.9b.
  • Fixed a rare expression evalulation bug. Previous versions may erroneously evaluate "label - equate" as constant, when the equate is something like "currentPCsymbol - label".
  • Allow a label definition on the same line as a section directive and warn about it.
  • Macro arguments were lost at the second repeat-level inside a macro.
  • Syntax modules warn about garbage characters in the operand field, when the mnemonic doesn't take any operand.
  • No longer cut symbol names in a wide-format listing file after 31 chars.
  • Error messages on macros and repetitions now always include the real source file name and line number in parentheses.
  • Directives for printing expressions into the console (printv, echo, etc.) now print undefined symbols as "<undefined>+offset".
  • New output module "gst" for GST object files (Atari, GST-assembler, Devpac).
  • New output file format "dri" for Atari M68k DRI object files.
  • m68k: Experimental Apollo TEX instruction, using a simplified syntax after a proposal of John H.
  • m68k: Apollo extended/compressed Bcc.B displacements in the range of -256 to 254.
  • m68k: MOVEQ.L suppresses any warning about an out of range operand.
  • m68k: Allow any size-extension for MOVEQ in Devpac-compatibility mode.
  • m68k: Fixed a string-buffer conflict introduced in V1.9a, which occurs when using local symbols in the label field and operand field together with some cpu-specific directives, like EQUR, REG, etc.
  • m68k: Optimize small data label in 020 base displacement to a 16-bit offset, or even to (d16,An) when the index is suppressed, provided that options -sd and -extsd have been given.
  • 6502: Some mnemonics could be misdetected as implied addressing mode when option -i was given: asl, asr, lsr, rol, ror. 45GS02: aslq, asrq, deq, inq, lsrq, rolq, rorq. WDC02: dec, inc.
  • mot-syntax: Do not allow a section with the same name and same type, but with different memory attributes.
  • mot-syntax: New option -nolocpfx to disable local symbols by label- prefix (usually '.').
  • mot-syntax: ELIF directive implements a real else-if.
  • mot-syntax: Export equate symbols with double-colon in vasm-native mode.
  • std-syntax: Fixed an issue caused by the introduction of one-digit temporary labels in V1.9a. Labels beginning with _f or _b were misdetected as forward/backward references to such labels.
  • std-syntax: Added missing .elseif directive.
  • oldstyle-syntax: All byte-directives (byt, byte, dfb, etc.) increment the pc by one without any operand. All word-directives (wor, wrd, word, etc.) increment the pc by two without any operand. Similar to a "declare storage" directive.
  • oldstyle-syntax: Whitespace between a label and its colon are allowed again.
  • hunk-output: Warn about inability of Kickstart 1.x to initialize BSS sections greater than 256k.
  • bin-output: ORIC file names in the tape header are limited to 15 characters and a ".tap" extension is removed automatically.
  • bin-output: Added support for the PGX and PGZ format, used by 65816- based C256 Foenix computers.
  • tos-output: Support DRI-format object files. New option: -Fdri.


02-Oct-2022: vasm 1.9a.
  • Reads the input from stdin when no source file name is given.
  • Small performance improvements. Tuned hash table sizes. Reduced memory allocations and deallocations.
  • Do not ignore the path from the main source when looking for a file.
  • Can build low-memory version of vasm with minimal hash tables, by compiling with -DLOWMEM.
  • Do not allow exporting equates which are based on imported symbols.
  • Search for include files in the current work directory first, then in the compile directory.
  • New option -maxpasses to adjust the maximum number of passes while resolving a section.
  • New option -nocompdir to disable compile directory based include file lookup completely.
  • New option -v to print version and copyright.
  • m68k: -no-opt option really ovrrides all "opt o" and "opt a" directives from the source now.
  • m68k: Fixed 68030/68851 PMOVE issue with TC and MMUSR, caused by a conflict with MOVEC control registers of the same name.
  • m68k: New Apollo instructions DBcc.L and MOVE2.
  • m68k: Fixed Apollo MOVE immediate addressing mode to vector register.
  • m68k: Fixed Apollo SUBI banked instruction (one word missing).
  • m68k: Added Apollo banking prefix support for MOVE.L Bn,<ea> and MOVE.L <ea>,Bn.
  • m68k: Apollo LSLQ and LSRQ default to a .W operation size when missing. The remaining AMMX instructions should be .Q.
  • m68k: Make sure AMMX 64-bit constants are parsed with full precision.
  • m68k: Added missing Apollo FMOVE addressing modes.
  • 6502: Added support for the WDC 65816 and 65802 8/16 bits instruction set, including some new directives for selecting Accumulator and Index width.
  • z80: Fix for GBZ80 "ld (c),a" and "ld a,(c)".
  • mot-syntax: ASSERT directive.
  • mot-syntax: macro arguments within <..> allow additional '>' characters inside a string without terminating the argument (vasm default mode only, not for Devpac-compatibility).
  • std-syntax: New option -gas for stricter GNU-as compatibility.
  • std-syntax: Supports one-digit temporary labels, where the nearest previous label may be referenced by Nb and the nearest following by Nf.
  • oldstyle-syntax: New directives SYMDEPEND and NEEDS. They define a dependency of the current section from an external symbol, which must be resolved by the linker.
  • oldstyle-syntax: Anonymous labels may be defined with a single ':' and referenced by ':+' or ':-'.
  • hunk-output: Converts NONE-relocs to 8-bit ABS with a warning.
  • hunk-output: Improved short-reloc output and work around AmigaOS LoadSeg() limitations/bugs.
  • o65-output: Check bad addends for 8-bit relocations.

$Id: index.php,v 1.16 2023/09/30 11:49:53 frank Exp $