vasm

A portable and retargetable assembler.
Valid HTML 4.01!
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 and CPU32)
  • ColdFire family (all models of V2, V3, V4, V4e)
  • PowerPC family (POWER, 40x, 440, 460, 6xx, 7xx, 7xxx, 860, Book-E, e300 and e500)
  • Z80 family (Z80, 8080, 8085, GBZ80, 64180, RCM2/3/4k)
  • 6502 family (including 65C02, 65CE02, DTV, 45GS02, HU6280)
  • 6809 family (6809, 6309 and 68HC12)
  • Jaguar RISC (GPU and DSP instruction sets)
  • ARM (architecture ARMv1 to ARMv4, including THUMB mode)
  • 80x86 family (IA32 8/16/32 bit, using MIT-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 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, i386 and JRISC)
  • Amiga hunk format (M68k)
  • Atari TOS executable format (M68k)
  • Sharp X68000 Xfile format (M68k)
  • EHF extended hunk format (PowerPC)
  • o65 relocatable format (6502)
  • Raw, binary output (all)
  • Commodore PRG, Atari COM, Apple DOS binary formats (6502)
  • 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)


19-Jul-2021: vasm 1.8l.
  • ASCII output modules cdef, ihex, srec and test now use the host system's line endings.
  • m68k: Scale factor may be a (constant) symbol.
  • m68k: Recognize local register symbols.
  • m68k: Fixed -opt-jbra (opt ob+), which caused an illegal instruction error since the last release.
  • m68k: Enabled Apollo Core FPU instructions.
  • m68k: Apollo FPU instruction banking prefix support. Patch by John Hankinson.
  • jagrisc: Fixed (Rn+0) optimization to (Rn).
  • z80: Support for the 12 additional 8085 instructions by Grzegorz Mazur.
  • 6809: Added missing LSRW and support for the 6309 F-register (patch by Jim Westfall).
  • 6809: Fixed LDW indexed addressing mode.
  • mot-syntax: showoffset for PhxAss compatibility.
  • mot-syntax: Fixed DX directive, which was broken in the last release.
  • madmac-syntax: ABS directive is no longer available for the jagrisc cpu backend as it conflicts with the instruction name.
  • std-syntax: .int uses the target's address size.
  • oldstyle-syntax: addr uses the target's address size.
  • hunk-output: Default section name comes from the syntax module now, in case the output only contains symbols, but no data.
  • srec-output: Added -crlf option to enforce CR/LF line endings (submitted by Grzegorz Mazur).
  • ihex-output: Added -crlf option to enforce CR/LF line endings (submitted by Grzegorz Mazur).


13-May-2021: vasm 1.8k.
  • New output modules "o65" and "o65exe" to write object files and executables for the 6502-family of processors.
  • Symbols defined on the command line by -D must be Equates, so they cannot be modified anymore in the source.
  • New default listing file format (wide). The old one can still be selected by -Lfmt=old.
  • Improved listing file output for macros and repetitions. Also their definitions are now printed.
  • New listing file options: -Lbpl=<val>, -Lall, -Llo and -Lni. All valid for the new wide-format.
  • New option -uspc=<val> sets the fill value for uninitalized space (defaults to zero).
  • m68k: Support 64/96 bit immediate FMOVEM.L with two or three control registers as destination.
  • m68k: Fixed misdetection of labels with dots (-ldots) as registers with size extension (e.g. "(pc.msg,pc)").
  • m68k: Fixed Apollo instruction encoding: pcmpgeb, pcmpgew, pcmpgtb, pcmpgtw. Changed Apollo instruction name: miniterm to minterm. Patch by John Hankinson.
  • m68k: New Apollo core instructions (John): lslq, lsrq, pabsb, pabsw, storem2, storem3, transilo.
  • m68k: Encoding a branch distance of -1 is not allowed for 68020+ CPUs.
  • 6502: > and < modifiers may be used to enforce absolute or direct/zero-page addressing modes.
  • 6502: New directive zero or .zero starts a zero-page bss-section, which makes symbol accesses to this section default to zero-page addressing.
  • 6502: Implemented a few 45GS02 instructions (Mega65).
  • 6809: Absolute constant offsets > 32767 are now negatively sign-extended and will allow addressing mode optimizations.
  • oldstyle-syntax: Besides .text, .data and .bss, also text, data and bss section names are automatically recognized and provided with correct attributes.
  • oldstyle-syntax: -sect option can be used to enable the section directives: text, data and bss. By default text and data directives create string/data constants.
  • oldstyle-syntax: Sections named .zero or zero get the zero-page flag for 6502.
  • oldstyle-syntax: Fixed crash with text/fcs directives without a string.
  • bin-output: Added support for ORIC machine code file headers.
  • bin-output: Uninitialized space is not written. At the moment it can only be created with *=*+n directives in some syntax modules.
  • tos-output: Report undefined symbols with source line number.
  • xfile-output: Report undefined symbols with source line number.


31-Dec-2020: vasm 1.8j.
  • New CPU backend for the PDP-11 architecture.
  • Fixed alignments in relocated-org blocks within a section.
  • 6809: 16-bit branch with a negative distance of 127 bytes (-130 encoded) was erroneously optimized to 8-bit branch (-129 encoded). Fixed.
  • 6809: .dpage directive conflicts with .dpage section in std-syntax and was renamed to .direct.
  • 6809: Support label differences in immediate addressing modes, which generate a pc-relative relocation.
  • m68k: Fixed inappropriate cpu-type errors, when using directives or macros starting with "mc", "mcf" or "ac".
  • m68k: Illegal opcode extensions should also be reported in Devpac- compatibility mode. Illegal opcode extensions for unsized instructions are still ignored with -devpac.
  • mot-syntax: pushsection and popsection directives.
  • mot-syntax: msource directive to control source level debugging within a macro (submitted by Soren Hannibal).
  • mot-syntax: if1, if2, ifp1 directives for compatibility with a warning.
  • oldstyle-syntax: org $addr works again for Z80.


28-Sep-2020: vasm 1.8i.
  • New CPU backend for 6809, 6309 and 68HC12.
  • New output module "cdef" to write all absolute symbols as a series of #define directives for inclusion in a C source.
  • Do not read a source file with the same name from the CWD, when the real source is actually located in a sub directory!
  • Show an error when no numerical term follows a base-prefix.
  • Do not show expression-evalulation errors before the final pass (e.g. division by zero).
  • New option -nomsg= to disable specific informational messages.
  • Define an internal symbol depending on the host file system in use (__UNIXFS, __AMIGAFS, __MSDOSFS).
  • Fixed crash when printing errors from files with an absolute path.
  • m68k: New option -extsd to allow small data with 020 extended addressing modes.
  • m68k: Disabled most of the new MOVE.L #x,Dn optimization from V1.8h for ColdFire, which doesn't support .W and .B operations.
  • m68k: Fixed encoding of ([...],ZRn,...).
  • m68k: Fixed PFLUSHR immediate addressing mode.
  • m68k: Some PMOVE reg,<ea> erroneously allowed immediate and PC-relative addressing modes as destination.
  • m68k: Allow A0 and A1 as small data base registers (near, -sdreg).
  • m68k: External small-data symbol references may have a signed addend.
  • jagrisc: Add more predefined condition codes. Now vasm supports the same condition codes as the SMAC assembler.
  • 6502: Fixed branches to external labels.
  • 6502: New directive EZP. Like EQU, but use advises zero page addressing.
  • 6502: -opt-branch can now also translate/optimize between BRA and JMP.
  • ARM: Fixed a problems with auto-rotated immediate values. Now all possible solutions should be found.
  • ARM: Fixed oscillating optimization for ADR/ADRL (-opt-adr).
  • ARM: Fixed handling of string/data directives with a single character.
  • ARM: Fixed MSR status register bit mask (patch by Luna).
  • mot-syntax: -devpac compatibility mode allows dots ('.') in labels (-ldots).
  • mot-syntax: Fixed crash when reading a label field including '\' and followed by a non-identifier character.
  • oldstyle-syntax: -ast allows * to start comments in the first column.
  • oldstyle-syntax: -i now also works for instructions with no operand.
  • oldstyle-syntax: -ldots allows '.' within identifiers.
  • oldstyle-syntax: added inline and einline directives from mot-syntax.
  • oldstyle-syntax: added FCS directive, which is like FCC but sets the MSB of the last character.
  • madmac-syntax: Added missing .offset and .abs directives to start an offset-section.
  • std-syntax: Added .pushsection and .popsection directives.
  • bin-output: Added support for Apple DOS binaries, Dragon DOS binaries and Tandy Color Computer machine language files.
  • vobj-output: Make some backends support larger sections sizes than their target address allows.


18-Apr-2020: vasm 1.8h.
  • Reworked absolute ORG sections.
  • -pic no longer reports references to undefined symbols.
  • New option -pad=<value> can be used to define a different padding value than zero for alignments and for filling gaps between absolute sections.
  • Fixed alignment directives. Now also alignments which are not a power of two are allowed (but probably not supported by all object file formats).
  • m68k: New optimizations for BAsm compatibility: MOVE.L #n,Dn is transformed into a combination of MOVEQ and SWAP, ADD.W or NEG.W.
  • m68k: New optimization flag for size, even when speed suffers. It will optimize for example MOVE.L #x,Dn to MOVEQ #x>>n,Dn + LSL.W #n,Dn.
  • m68k: Fix some situations where an absolute label from an ORG section should be treated as a simple absolute value (e.g. MOVEQ).
  • m68k: New option -nodpc to disallow direct encoding of absolute PC displacements (also set automatically with -devpac compatibility).
  • m68k: Added internal symbols _MOVEMBYTES and _MOVEMREGS for BAsm compatibility.
  • 6502: New directive ZPAGE, to declare a relocatable symbol as being located in the zero-page, so vasm will use ZP-addressing, even on external symbols.
  • 6502: Allow 32-bit data directives.
  • 6502: New option -bbcade for compatibility with the BBC ADE assembler, contributed by Garry Marshall.
  • z80: New option -intel-syntax switches to the old Intel 8080 syntax. Contributed by Mark Jones.
  • std-syntax: .org within a section allows an optional argument to define a fill-value.
  • mot-syntax: A SECTION directive with a single argument is interpreted as section type when the selected output format does not support section names (e.g. aout, tos, xfile). Otherwise the type defaults to code, using the given argument as section name.
  • mot-syntax: register list directives (REG, EQURL) also accept a previously defined register list symbol.
  • mot-syntax: Fix segfault/out-of-memory when a macro-argument enclosed in < ... > is missing the '>'.
  • mot-syntax: Allow comment-character directly attached to a macro directive.
  • mot-syntax: RORG allows an optional argument to define a fill-value.
  • mot-syntax: Only allow valid identifiers for macro names.
  • mot-syntax: Fixed string expressions as macro arguments.
  • mot-syntax: New directives db, dw and dl for ArgAsm, BAsm, HX68, Macro68, MaxonAsm, OMA, ProAsm, Cape compatibility. They do not exist in PhxAss- or Devpac-compatibility mode.
  • oldstyle-syntax: The addend in the abyte directive is now a modifier, where the special symbol ._ works as a placeholder for each expression from the line.
  • oldstyle-syntax: macro definitions and repetitions with -dotdir were not correctly recognized.
  • oldstyle-syntax: Fixed string expressions as macro arguments.
  • oldstyle-syntax: New directives fi and str, contributed by Garry Marshall.
  • oldstyle-syntax: New directives dsect and dend to implement offset-sections.
  • madmac-syntax: Fixed string expressions as macro arguments.
  • bin-output: option -atari-com may be used to output Atari 6502 COM files.
  • output-hunk: Alignment directives behind DX are allowed.


04-Oct-2019: vasm 1.8g.
  • Do not print informational messages when generating dependencies.
  • New option -depfile to specify a file name for the dependency output. Code generation may happen in parallel in this case.
  • Include the compile directory in the path, when printing error messages.
  • Treat a subtraction of a label from a constant as constant, when the label is from an absolute ORG section.
  • m68k: -opt-allbra makes sure that branch-optimization is enabled.
  • z80: "ld (BC/DE/HL),abs" is an illegal addressing mode.
  • mot-syntax: SECTION directive with a single argument is interpreted as section-type when the output format is "tos". Otherwise the type defaults to CODE.
  • mot-syntax: In devpac-compatibility mode allow '@' in the middle of labels.
  • mot-syntax: -phxass compatibility mode allows dots ('.') in labels (-ldots).
  • mot-syntax: Added support for Devpac IIF directive.
  • output-hunk: Fixed LINE debug hunk output (-linedebug). Now it can deal with code from multiple sources and the line numbers for executing macros and repetitions are correct.
  • output-hunk: New option -hunkpad=<code> selects the padding code for code sections to achieve 32-bit alignment. Default to 0x4e71 (NOP) for M68k.

$Id: index.php,v 1.14 2021/01/17 11:18:23 frank Exp $