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:
  • 6502 family (including 65C02, 65CE02, DTV, 45GS02, HU6280, 65802, 65816)
  • 6800 family (6800, 6801, 6803, 68HC11)
  • 6809 family (6809, 6309, Turbo9, Konami-2 and 68HC12)
  • 80x86 family (IA32 8/16/32 bit, using AT&T-syntax)
  • ARM (architecture ARMv1 to ARMv4, including THUMB mode)
  • C16x/ST10
  • ColdFire family (all models of V2, V3, V4, V4e)
  • HANS project (32-bit FPGA CPU)
  • Jaguar RISC (GPU and DSP instruction sets)
  • M680x0 family (including M6888x, M68851, CPU32 and Apollo 68080)
  • PDP-11 architecture (includes EIS, FIS)
  • PowerPC family (POWER, 40x, 440, 460, 6xx, 7xx, 7xxx, 860, Book-E, e300 and e500)
  • QNICE (elegant 16-bit FPGA CPU)
  • Raspberry-Pi VideoCore IV
  • Sony SPC700
  • SunPlus μnSP CPU (ISA V1.0 and V1.1)
  • Sweet16 (Steve Wozniak's pseudo CPU)
  • TR3200 (virtual CPU from 0x10c)
  • Z80 family (Z80, 8080, 8085, GBZ80, 64180, RCM2/3/4k)
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:
  • a.out (JRISC, M68k, x86)
  • AOF ARM/Acorn object file format (ARM)
  • Amiga hunk format (M68k)
  • Apple DOS, Atari COM, Commodore PRG, Oric TAP binary formats (6502)
  • Atari TOS executable format (M68k)
  • Atari DRI object file format (M68k)
  • C #define output format (all)
  • C256 Foenix PGX and PGZ binary formats (65816)
  • COFF (ARM, M68k, PowerPC, x86)
  • EHF extended hunk format (PowerPC)
  • ELF (ARM, JRISC, M68k, PowerPC, x86)
  • GST object file format
  • HANS project output format
  • Intel-Hex format (all)
  • MOS Paper Tape format (all)
  • Motorola S-Record format (all)
  • o65 relocatable format (6502, 65816)
  • Raw, binary output (all)
  • Sharp X68000 Xfile (and Zfile) format (M68k)
  • Tandy Color Computer and Dragon DOS binaries (6809)
  • Test, debugging output (all, default)
  • VOBJ proprietary versatile object format (all)
  • Wozmon monitor format (6502)
vasm is human-made software, and at the moment it is our goal to preserve this characteristic. Please keep this in mind if you consider contributing (especially regarding use of generative AI). If your contribution might contain code not written by yourself, please consult us beforehand to check whether we consider it admissible.


10-Jul-2026: vasm 2.0f.
  • Local symbols could become unavailable when defined after a PC-symbol expression or a directive dealing with the current PC. Fixes a regression from last version, V2.0e.
  • New option -ctrace to enable tracing of conditional assembly.
  • New option -iserror=<n> to turn a warning into an error message.
  • And-operations with a local label are allowed, as long as the constant is less than the section's alignment where the label resides.
  • All output modules should handle uninitialized space properly.
  • Print relocation type name instead of the number in output module errors.
  • Fixed alignment of addresses which have their MSB set.
  • Fixed potential memory corruption bug with more than 32/64 sections while referencing label1-label2 from a different section.
  • m68k: B<cc>.L is accepted with a warning as B<cc>.W in 68000 mode (for compatibility with very old 68000 sources).
  • m68k: Command line option -opt-allbra must not be reset by the directive opt o-. It should still be present after branch optimization is reenabled with opt o1+.
  • m68k: Option -opt-jbra (directive: OPT ob+) should not be restricted to convert external references only.
  • m68k: Fixed regression from V2.0: An optimization of an absolute destination to 16-bit PC-relative was no longer detected (e.g. 68020+ CMP).
  • m68k: Added missing Devpac2/3 opt directives: e, y, z, alink, amiga, even, hcln, inconce, line, list1, mex, traceif, where list1 and mex have currently no function.
  • m68k: Devpac-compatibility mode has to report word-accesses with odd absolute operands by default (-warnunaligned, opt e+).
  • m68k: -warnunaligned should not have any effect for LEA and PEA instructions.
  • m68k: Sections with <type>_P should cause an error with Devpac-compatbility.
  • m68k: Added missing optimization of adda/suba #-x,An to subq/addq #x,An, when x is between -8 and -1.
  • m68k: -showopt and OPT ow+ print the total number of optimizations and translations after the last pass.
  • m68k: Apollo: move.l Bm,An and Am,Bn should not be allowed.
  • jagrisc: Pseudo instructions AJR and AJUMP ensure that a JR or JUMP instruction is 32-bit aligned (required for working with main memory). Also -opt-jr works with AJR and translates into AJUMP when needed.
  • 6809: Konami2 ISA allows X, Y, S, U as the offset register for direct and indirect addressing.
  • 6809: Fixed register parser to work with identifiers which start with a register name.
  • mot-syntax: Allow FEQU without size extension.
  • mot-syntax: Fixed ODD directive. Finally.
  • std-syntax: Support infix operator ! for bitwise Or-Not (gas compatibility).
  • std-syntax: boolean true should be -1 not 1. But !0 is still 1.
  • oldstyle-syntax: Symbols with assignment directives may always be written with leading whitespace in default mode. Only with -i (ignore trailing blanks in operand) you have to use -spcequ to enable that feature.
  • madmac-syntax: New directives: du.b, du.w, du.l to declare uninitialized space.
  • madmac-syntax: Added align directive from rmac, which can optionally specify a 16-bit fill value.
  • madmac-syntax: Added a standard section directive for more flexibility.
  • hunk-output: New option -hcln, to select HiSoft HCLN line debug output, instead of default SAS/C line debug.
  • tos-output: Fixed addends for SD- and PC-relative relocations in DRI objects.
  • o65-output: Better range-check for 8-bit absolute relocations.


24-Feb-2026: vasm 2.0e.
  • Fixed -nocase option for symbols, which was broken in last release.
  • New output module "aof" for the ARM/Acorn Object Format, used for example by Acorn and 3DO.
  • New cpu backend for Wozniak's Sweet16 pseudo CPU (also useful as a simple tutorial backend).
  • Fixed ".." include paths and misdetection of paths starting with '/' as being absolute for AmigaOS hosts.
  • ARM: Support for automatic literal pools, when using the '=' operand-prefix with LDR, to load any constant or label addresses to a register. Includes optimization to MOV or ADR, if possible. Literal pools are dumped with the ltorg directive, or automatically at the end of any section.
  • ARM: Alternatively permit an SWI immediate operand with '#'.
  • m68k: Register symbol definitions should be case-insensitive in Devpac compatibility mode.
  • m68k: Apollo: Adapted MOVEIW opcode for latest cores.
  • 6809: Fixed branch optimization/translation (-opt-branch), which was broken since the introduction of Konami-support in V2.0c.
  • jagrisc: CPU-specific directives (.equr, etc.) with a leading dot were no longer recognized since V1.8k, when no other dot-prefixed directive was used before and the syntax module was "madmac".
  • std-syntax: ELF visibility types: .hidden, .internal, .protected.
  • oldstyle-syntax: ASSERT and FAIL directives should not create a default section if no section exists at that point.
  • oldstyle-syntax: New option -spcequ removes the restriction that equate symbols have to start on the first column.
  • oldstyle-syntax: Add COND and ENDC directives for compatibility.
  • elf-output: Support for visibility types.
  • tos-output: Alignments > 32 bit in data or bss could lead to corrupt output.
  • xfile-output: Alignments > 32 bit in data or bss could lead to corrupt output.


23-Nov-2025: vasm 2.0d.
  • Improved performance of expression evaluation.
  • New output module "coff" for writing COFF object files. Currently supported are m68k, x86, PPC and ARM. Contributed by Jean-Paul Mari.
  • Added indirect symbols by exporting equates pointing to an imported destination symbol. Currently supported by the output modules VOBJ and a.out.
  • -chklabels option is the default now. You can still disable the warnings.
  • List symbols sorted by their unsigned value.
  • Fixed internal error with non-case-sensitive macro redefinitions.
  • m68k: Apollo: Optimize ANDI.L #$ff/ffff,Dn to EXTUB/W.L Dn. Optimize CMP.L #x,<ea> to CMPIW.L #x,<ea> (with -32768 <= x <= 32767) and ADD/SUB.L #x,<ea> to ADDIW #x,<ea> (negated x for SUB).
  • m68k: Apollo: added LPSTOP.
  • PPC: Set address size to 8 for 64-bit CPUs. Fixes some output formats.
  • ARM: Allow any type of immediate constant, like characters.
  • jagrisc: Fixed -opt-jr. Operands for the JUMP were swapped.
  • jagrisc: Use natural default alignment for 32 and 64-bit data.
  • mot-syntax: Include ds.p, blk.p, rs.p, etc. for completeness (same as .x).
  • aout-output: Fixed PC-relative relocs on a different local section.
  • aout-output: New option -aoutalign to change the default section alignment.
  • aout-output: Indirect symbols.
  • vobj-output: No longer write local symbols with -nosym option.
  • vobj-output: Indirect symbols.


14-Jul-2025: vasm 2.0c.
  • Fixed output of the last byte in a CPU's address space for multiple output formats allowing absolute addressing: gst, ihex, pap, srec, woz.
  • Try to convert 128-bit expressions to the backend's native address size when possible, while parsing it.
  • Support left and right shift operations using a shift-count larger than the backend's native address size.
  • Defining symbols which were declared as externally defined is no longer an error but a warning, as this is usually harmless.
  • Fixed possible internal error when defining a label on the same line as a section directive.
  • m68k: Reverted change from V2.0: out of range warnings have become errors again. These checks can be disabled by multiple options and directives.
  • m68k: Improved error messages for quick-immediate and shift-values.
  • m68k: Huge (128-bit) expressions are allowed in immediate 8/16/32-bit addressing modes when the final value fits or when range-checking was disabled.
  • m68k: Apollo: Disabled illegal optimization of ADDI.B #n,An into ADDQ.
  • m68k: New option -warnunaligned to warn about accesses to odd addresses.
  • 6809: -konami2 option now enables the original instruction set (rev. 052001), while the extended instruction set for later revisions is available via -konami2ext (e.g. rev. 052526, 053248).
  • jagrisc: New option -opt-jr=<n> automatically translates out-of-range JR branches into MOVEI plus JUMP, using Rn as a temporary register.
  • jagrisc: New option -no-opt disables all standard optimizations.
  • jagrisc: Optimize MOVEI to MOVEQ when possible (constant from 0 to 31).
  • jagrisc: Fixed JR/JUMP with externally defined CC.
  • jagrisc: Allow relocations for LOAD/STORE (Rn+x), but note that there are still errors when x becomes 32.
  • mot-syntax: -devpac compatility automatically disables warnings for xref on defined symbols and xdef on undefined symbols.
  • oldstyle-syntax: Fixed data directives with comment characters (for example: db 1,';',2).
  • vobj-output: Fix handling of section sizes which have the MSB set.
  • bin-output: New option -join implements a mini-linker for multiple sections.


21-Apr-2025: vasm 2.0b.
  • New CPU backend for the SPC700, as used in the SuperFamicom and SNES for sound processing.
  • New option -no-msrcdebug to disable source level debugging within a macro context (MSOURCE directive in mot-syntax).
  • Fixed potential crash with NOLIST directives, when listing file is enabled (new bug since V2.0).
  • Assign a relocated org address to labels already in the parser pass to make conditional assembly (sort of) work.
  • Fixed DWARF output for advancing the state machine by 15 * instruction size.
  • m68k: Allow Apollo immediate FPU instructions with a third operand again (broken since V2.0).
  • 6502: Fixed external branch label references.
  • 6502: Fixed Mega65 32-bit indirect instructions (broken since V1.9a).
  • 6809: Added Konami-6809 support, used on arcade boards (patch submitted by Jim Westfall).
  • 6809: Fixed two-byte opcodes with the MSB in the first byte set (for example HC12 TAP).
  • mot-syntax: The rept directive allows for an optional counter symbol name.
  • oldstyle-syntax: The label field allows preceding whitespace now, provided it is followed by a ':', an '=', or an assignment directive (EQU, SET).
  • oldstyle-syntax: Allow anonymous labels together with multiple statements per line (Z80).
  • oldstyle-syntax: ascii does not null-terminate strings. asc is not the same as byte.
  • oldstyle-syntax: The size of multi-byte data and space directives depends on the target CPU now. For example long is 24 bits for 6502/65816.
  • oldstyle-syntax: defp uses the target's address size, like da and addr.
  • oldstyle-syntax: fdb doesn't define words but double-bytes (whenever that matters).
  • oldstyle-syntax: New directive dl (long word).
  • oldstyle-syntax: New directives with fixed bit-size for forming constant data and space: di8, di16, di24, di32, di64, ds8, ds16, ds24, ds32, ds64.
  • oldstyle-syntax: The rept and repeat directives allow an optional second argument to specify the name of an iteration symbol to use.
  • hunk-output: -kick1hunks ignores section memory flags except CHIP and FAST with a warning.


30-Dec-2024: vasm 2.0a.
  • Fixed bad path in source level debugging information, when the initial source file and an include file were based on the same "compile directory".
  • Get rid of C99-round() dependency.
  • Fixed empty strings, which were broken in V2.0. They should not generate any data.
  • When position-independant code is requested (-pic option) the assembler defaults to relocatable mode (to be able to detect violations).
  • Allow 64-bit (or more) expressions with absolute label addresses.
  • 6502: Additionally allow BRK with an immediate 8-bit operand.
  • 6502: Operand prefix character '?' can be used to select the Memory/Bank-ID where the referenced symbol resides. Requires the use of VOBJ and vlink.
  • mot-syntax: A double colon after the label also exports RS symbols now.
  • madmac-syntax: New directives: ifdef and ifndef (just for convenience, they are no official MadMac directives!).
  • madmac-syntax: Fix problem with print-directive when string is empty.
  • oldstyle-syntax: Fixed usage of '$' as current-PC symbol for Z80, which was broken since V2.0.
  • oldstyle-syntax: Fixed definition of structure offset labels, which should be referenceable by structname.offsetname. Broken since V2.0.
  • hunk-output: Fixed output generated by Databss directives (like DX in mot-syntax). Broken in V2.0.
  • hunk-output: -linedebug: do not generate multiple entries per line.

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