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, GBZ80, 64180, RCM2/3/4k)
  • 6502 family
  • 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)
  • 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)
  • 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, default)


13-Aug-2017: vasm 1.8a.
  • Increased number of fast-optimization passes from 50 to 200, as very large sources (> 60000 lines), with lots of branches to optimize, may still have optimization possibilities left after 50 passes.
  • Repeat loops with an iterator symbol over an arbitrary sequence of values.
  • m68k: New option -sd and directive OPT ON to enable optimizations of absolute references to the small data section into a base register relative addressing mode.
  • m68k: New option -opt-jbra and directive OPT OB to convert all absolute jumps to external labels into 32-bit PC-relative branches (68020 and up).
  • m68k: OPT O+ in Devpac compatibilty mode does not enable PC-relative optimizations (an explicit OPT A+ is needed).
  • m68k: New Apollo Core instructions: PMULA, PMULH, STOREC, UNPACK1632.
  • m68k: -m68020up option no longer includes Apollo Core.
  • m68k: Devpac OPT Ln (with n=0,1,2,etc. for Atari) is recognized, although it has no effect at the moment.
  • m68k: Suppressed index registers ZRn, which are explicitely written in the source, are no longer optimized away.
  • PPC: -m option to select the CPU model starts working. By default the instruction set of a 32-bit PPC (G2, G3, G4) with AltiVec is supported.
  • x86: Floating point constants (.float, .double) are supported.
  • mot-syntax: Optional offset and length arguments for INCBIN (contributed by Andreas Larsson).
  • std-syntax: New directives for gas compatibility: .irp and .irpc.
  • bin-output: Fixed another sign-problem while padding between sections.
  • hunk-output: Print source line for undefined symbols, when generating an executable.
  • vobj-output: Ignore all internal/local symbols, except "*tmpNNNNNNNN*", which is required for certain relocations.


16-May-2017: vasm 1.8.
  • External references in ORG or RORG sections are allowed.
  • Option -depend only prints relative include file names, while the new option -dependall prints all included file names, also with absolute paths.
  • m68k: Support for Apollo Core 68080 and AMMX ISA.
  • m68k: MSP, ISP and MMUSR are no valid 68060 control registers.
  • 6502: Fixed potential segfault during zero-page optimization (new since last version).
  • jagrisc: Fixed SHLQ instruction.
  • mot-syntax: Make NREF directive work for PhxAss compatibility. Allows optimization of absolute references to base-relative.
  • std-syntax: Labels ending on '$' are only local when all preceding characters are digits.
  • madmac-syntax: Fixed .long directive (which only aligned to even bytes).
  • oldstyle-syntax: New options -i (ignore everything in the operand after a blank), -noc (no C-style constant prefixes) and -noi (no intel-style constant suffixes).
  • oldstyle-syntax: Z80 supports multiple directives or instructions per line, separated by a ':' character.
  • oldstyle-syntax: Fixed parser problem with nested repeat/endrepeat blocks.
  • output-hunk: -kick1hunks must not forbid base relative relocs and references. It was supported by some 1.3 linkers (blink for example).


14-Feb-2017: vasm 1.7h.
  • Implemented a dynamic line buffer. No limitations on line lengths anymore.
  • Octal escape sequences are limited to a maximum of three digits.
  • Allow assembler text output (echo, printv) in offset sections.
  • Print a warning for initialized data in a bss-type section. This already worked in the past (1.2c and later), but has been lost somewhere.
  • Some single-character labels and symbols will be rejected (depending on the syntax module).
  • -maxerrors=0 should print all errors in the source.
  • Print expressions in the listing file and the test output in decimal and hexadecimal form.
  • m68k: Immediate- and PC-relative destination addressing modes for 68851 PMOVE are not allowed. PMOVE ea,PCSR doesn't exist.
  • 6502: Perform zero-page optimization with a known label from an absolute section.
  • std-syntax: Fixed problem with parentheses in character constants.
  • oldstyle-syntax: New option -org=<address> to set the absolute base address of the program from the command line.
  • oldstyle-syntax: Implemented some listing file directives, but without any function yet: nam, subttl, page, space.
  • bin-output: Fixed output section sorting, which didn't work with some implementations of qsort().
  • elf-output: Fixed external references in stabs.
  • elf-output: Use a hash table for ELF symbols to speed up the output.
  • hunk-output: Optimization to make it faster with many sections.
  • test-output: Fixed crash when printing stabs without a value.


02-Nov-2016: vasm 1.7g.
  • Avoid a crash or internal error in some output modules, when an equate refers to an undefined (imported) symbol.
  • m68k: Optimizing/translating to 68020+ addressing modes for MOVEM didn't work. For example MOVEM (40000,A0) was not automatically translated into a bd32 addressing mode, but had to be explicitely written as (40000.l,A0).
  • m68k: Optimizing MOVEM was not attempted, when using a register list symbol in one operand and a label in the other.
  • m68k: Fixed -opt-movem & -opt-speed optimization of MOVEM with two registers, which saw a wrong instruction size and moved following labels.
  • aout-output: Instructions with more than one relocation were no longer supported since V1.7f.


17-Sep-2016: vasm 1.7f.
  • Print a warning when a constant is not representable using the target data type.
  • Show warnings or errors when an expression overflows the backend's address data types.
  • Warn about overflows caused by negative expressions in space directives.
  • New option -chklabels makes vasm issue a warning when a label conflicts with a mnemonic or directive name.
  • Reworked internal relocation representation.
  • m68k: Base-displacement addressing modes and suppressed registers are allowed for CPU32. Just memory-indirect is illegal.
  • m68k: Added FJcc mnemonics for GNU-as compatibility (-gas option).
  • PPC: Added complete support for 403, 405, 440, 460, Book-E, e300 and e500 instruction sets.
  • 6800: Fixed a bug which suppressed command line options for syntax- and output-modules.
  • 6800: Support for 6801/6803 compatible CPUs added (contributed by Adrien Destugues).
  • ARM: Thumb-mode [PC,#imm] and [SP,#imm] addressing modes were not recognized.p ARM: Fixed thumb-mode SP-adjustment instructions: ADD SP,#<9-bit unsigned> and SUB SP,#<9-bit unsigned> (missing).
  • ARM: External subroutine calls in thumb-mode with BL were broken.
  • x86: Fixed determining the operation size when last register is %DX.
  • x86: 32-bit only instructions failed, when selecting a 32-bit cpu using the -m command line option.
  • x86: Avoid Illegal Relocation error for calls and jumps in absolute mode.
  • std-syntax: Data directives do no longer enforce natural alignment, for compatibility with GNU-as! Use the -align option to keep the old behaviour.
  • std-syntax: '0f' is another allowed float-constant prefix for GNU-as compatibility.
  • std-syntax: .stabs should support escape-characters in its string-field.
  • std-syntax: Support progbits and nobits section type arguments for ELF compatibility.
  • mot-syntax: Retain the possibility to use multiple ORG directives and output a real binary file, as before V1.7e. Only an ORG directive after a SECTION directive is now relocated within that section.
  • mot-syntax: Added IFMI (=IFLT) and IFPL (=IFGE).
  • mot-syntax: Fixed problems when macro arguments are followed by blanks and the -spaces option is given.
  • mot-syntax: New directives inline and einline, to define an isolated block for local labels.
  • mot-syntax: New directives ifmacrod and ifmacrond to conditionally assemble a block when a macro is defined or undefined (compatible with the same directives on the Barfly assembler).
  • madmac-syntax: Make ORG behave like in mot-syntax.
  • vobj-output: The byte-offset to a relocation now always defines the base for all relocation calculations (e.g. PC-relative).
  • vobj-output: For little-endian the bit position in a byte of a reloc-field is now counted from right to left. You will need at least vlink V0.15b to link more complex little-endian relocations (e.g. ARM).
  • hunk-output: -keepempty prevents the assembler from deleting empty sections.
  • elf-output: -keepempty prevents the assembler from deleting empty sections.


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.
Aktion UBERWACH!

$Id: index.php,v 1.13 2017/06/27 21:59:33 frank Exp $