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
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)
- Z80 family (Z80, 8080, GBZ80, 64180, RCM2/3/4k)
- 6502 family
- 6800 family (6800, 68HC11)
These syntax flavours are supported:
- Standard MIT (GNU-as style) syntax
- Motorola/Freescale 68k syntax (Devpac compatible)
- Old 8-bit style syntax
Supported output file formats:
- ELF (M68k, PowerPC, i386 and ARM)
- a.out (M68k and i386)
- Amiga hunk format (M68k)
- TOS executable format (M68k)
- EHF extended hunk format (PowerPC)
- Raw, binary output (all)
- VOBJ proprietary versatile object format (all)
- Test, debugging output (all)
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".
- output-hunk: 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.
- output-tos: A 16-bit aligned section size must also show up in the header.
- output-tos: 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).
- output-tos: Fixed a potential problem allocating 0 bytes, when there are no reloctions in a file.
09-Feb-2014: vasm 1.6c.|
- New resolver strategies to prevent infinite oscillating optimizations. After 50 passes the resolver switches into a safe mode, where only a single instruction per pass is optimized. When there are still instructions left, which alternate between different sizes, then optimization will be disabled for them. This was mainly a problem with aggressive M68k branch optimizations.
- New CPU backend for the 6800 family, contributed by Esben Norby. Currently the 6800 and the 68HC11 models are supported.
- Quit with a fatal error when the internal line buffer (4096 bytes) overflows, before overwriting innocent memory.
- Forbid structure recursion with a fatal error. Otherwise all available memory will be allocated.
- Limit the maximum number of macro recursion levels to 1000. Can be adjusted by specifying the new -maxmacrecurs=<n> option.
- Always converts path separators for the assembler's host OS, defined by AMIGA, ATARI or MSDOS in the Makefile. Default is Unix.
- Expression parser: binary And, Or, Xor operators have now higher priority than multiply and divide (same as Devpac).
- Also warn about auto-aligned data.
- m68k: Range check with unsigned operands didn't work when the value is negative (for example ADDQ #-10,D0).
- m68k: Allow outer displacement as first expression in front of the brackets for Devpac compatibility: (od,[bd,An,Xn])
- m68k: Warn about bad displacement positioning when not in Devpac compatibility mode.
- m68k: OPT X (xdebug) is ignored now, as it has very different meaning in Devpac-Atari and Devpac-Amiga.
- m68k: Allow a wrong size extension in Devpac mode, as long as the correct size can be guessed (e.g. moveq.w -> moveq.l).
- m68k: Support OPTC directive and __OPTC symbol in PhxAss-compatibility mode.
- m68k: BASEREG may be reused for the same register without ENDB in PhxAss- compatibility mode.
- m68k: ENDB doesn't not need to specify a register in PhxAss-compatibility mode, as long as it is unambigious.
- m68k: An equate symbol used as displacement in a BASEREG operand, which is defined later in the source, no longer generates an error.
- m68k: Removed useless optimization for LINK An,#0 into PEA/MOVE.
- m68k: Optimizing ASL #2,Dn into two ADDs is only allowed with -opt-lsl, because it modifies the V-flag.
- m68k: Generally all optimizations which result in multiple instructions need an additional -opt-speed option from now on.
- mot-syntax: Allow blanks in the operand and within expressions, when -phxass mode is enabled.
- mot-syntax: In -phxass mode '*' comments can be used everywhere, but have to be preceded by a space-character (blanks, tabs, etc.).
- mot-syntax: For compatibility with other assemblers (PhxAss, Barfly, etc.) the SO directive will also manipulate the RS-counter (and the __RS symbol) and vice versa.
- mot-syntax: -phxass mode defines the symbol _PHXASS_ with value 2, so it is possible to differentiate it from the original (value 1).
- mot-syntax: When no output name is given in PhxAss mode, a default name is constructed from the input name (name or name.o).
- oldstyle-syntax: Some new directives, used in 68HC11 sources: bsz, rmb, zmb, fcb, fcc, fdb.
- output-bin: Fixed misdetection of overlapping sections, caused by signed section origins (e.g. >= 0x8000 on 6502).
01-May-2013: vasm 1.6b.|
- Display a warning when instructions are automatically aligned. This might help to find missing align directives and avoid bugs.
- Display an error when a macro name conflicts with a mnemonic or directive.
- Expression symbols (equates) which are based on label are exported as an offseted label from the same section as the base.
- m68k: Fixed gas-compatible mnemonics: JB<cc> -> J<cc>.
- m68k: Fixed ColdFire ISA-B optimization "AND.L #$ff/#$ffff,Dn -> MVZ.B/W Dn,Dn", which always used a D0 source register.
- m68k: Scale factor 8 is allowed for ColdFire chips with an FPU.
- PPC: Fixed relocations, which had been broken since 1.6a.
- x86: Fixed data relocations, which had been broken since 1.6a.
- mot-syntax: A comma in the comment field of an operand-less instruction had been misinterpreted as an operand separator.
- mot-syntax: Allow labels on the same line as an ENDC/ENDIF directive.
- mot-syntax: Print the source and line number of the corresponding IF directive, when the ENDC/ENDIF directive is missing.
- std-syntax: Allow labels on the same line as an .endif directive.
- std-syntax: When # is used as the first non-blank character on a line, then it can still start a comment, even for architectures which define a different comment character (e.g. ARM, M68k).
- output-tos: Fixed uninitialized relocation pointer, which could lead to illegal memory accesses.
02-Apr-2013: vasm 1.6a.|
- The vasm core supports structure definitions. A structure name can either be used as a directive to initialize data, or in expressions as the structure's size. Its fields are available as local labels to the global structure name, defining the field offsets. (Originally contributed by Romain Giot, modified by Frank Wille.)
- The vasm core supports the creation of offsets sections. The contents of such a section is not included in the output file and their labels can be referenced as absolute offset symbols.
- Fixed -x option, which didn't display undefined symbols when there had been other errors in the source.
- m68k: Division optimization (-opt-div, directive opt od) must not try to optimize signed divisions, except with 1/-1. DIVS rounds towards zero, while ASR rounds downwards.
- m68k: Fixed immediate extended precision operands, which load "0.0" or "-0.0".
- m68k: -opt-fconst is enabled by default, except in Devpac and PhxAss mode. Fixed a bug which prevented optimization of extended precision 0.0 to single precision.
- PPC: Register symbols are no longer exported into most object formats.
- z80: Forbid operations between different index registers, like ix/iy pairs and ld ixl,(ix+0) (fixed by Romain Giot).
- z80: Improved detection of indirect operands in parentheses (fixed by Romain Giot).
- oldstyle-syntax: STRUCT and ENDSTRUCT directives for supporting structures.
- mot-syntax: Devpac-compatible CARGS directive.
- mot-syntax: New directive OFFSET. Devpac-compatible, but additionally to Devpac it allows any directive or instruction within such a section.
- output-vobj: Output was broken since 1.6, when relocations based on the current-pc symbol had been used.
29-Dec-2012: vasm 1.6.|
- New instruction/operand parser. Can handle instruction availability, depending on selected cpu-type, and optional operands in common code.
- Now using the faster djb2 hash table algorithm. Tuned hash table sizes for PPC, M68k and x86. Bigger symbol and macro hash tables.
- Symbol distances from two different sections are supported, when the second symbol comes from the current section, by using a pc-relative relocation with an appropriate addend.
- The vasm core supports named arguments of the form "\identifier". It can be enabled by syntax modules on demand.
- "\@?" can be used in a macro to push the current id below the top item on the stack.
- "\()" can be used to separate a macro name from the subsequent context.
- Macro and repeat directives in comments could have caused some confusion.
- Support for relocated origin blocks (RORG-blocks) in absolute output, which assign all labels in this block to a different base address, although the code is still physically placed at the original address.
- Only produce a listing file when -L option is given. A nolist directive at the end of the source will not prevent writing of a listing file anymore.
- Do not include internal assembler symbols in the object file.
- m68k: B<cc> *+$80 is now optimized to B<cc>.B as well, because the instruction will be 2 bytes smaller after that. Fall back to *+$7e optimization, when we need too many passes due to oscillating instruction sizes. Usually caused by an alignment directive before the destination label.
- m68k: Optimize CMP.W #0,An to TST.L An (TST.W An was wrong!).
- m68k: New optimization: DIVU/DIVS.L #x,Dn can be optimized into LSR/ASR when x is a power of 2 and between 2 and 256. Negative values are handled by appending a NEG.L. DIVU/DIVS.W #1 is supported for ColdFire ISA_B/C by MVZ.W. DIVS.W #-1 by using NEG.W first. The new option is called -opt-div.
- m68k: New optimization: ANDI.? #-1,<ea> is optimized to TST.? <ea>. ANDI.L #$ff/$ffff,Dn is optimized to MVZ.B/W Dn,Dn for ColdFire ISA_B/C.
- m68k: New optimizations: ORI #0,<ea> and EORI #0,<ea> are optimized to TST <ea>. AND #0,<ea> is optimized to CLR <ea>, when allowed.
- m68k: New optimization: LEA 0,An is optimized to SUBA.L An,An.
- PPC: Reworked cpu selection.
- PPC: Reworked operand parser and evaluater. mfdec is now recognized.
- z80: Fixed crashes and internal errors when an expression creates an illegal relocation.
- z80: Operands in parentheses were not allowed for defining data.
- z80: A '#' prefix selects hexadecimal radix, as used in some assemblers.
- z80: Fixed a bug with using invalid register-pairs in some addressing modes.
- z80: Added the hidden instruction OUT (C),0 (contributed by Romain Giot).
- 6502: Improved detection of indirect addressing modes. (expr)+(expr) and (expr)+expr are no longer indirect.
- mot-syntax: PhxAss-compatibility mode allows blanks in operands.
- mot-syntax: Ignore AsmOne AUTO directive.
- mot-syntax: Although ignored, load, jumpptr and jumperr should accept non-constant expressions.
- mot-syntax: Internal symbol REPTN can be used as iteration counter in the inner repeat loop.
- mot-syntax: New directives: IFB and IFNB to check whether a macro argument is blank or non-blank.
- oldstyle-syntax: Enabled support for named macro arguments.
- oldstyle-syntax: Fixed detection of endmac, endmacro, endrep and endrepeat.
- oldstyle-syntax: Conditional directives also allow non-constant expressions, like label-differences. But the expression has to evaluate in the first assembler pass.
- oldstyle-syntax: assert directive, displays an error message when the expression is false.
- oldstyle-syntax: Allow access to any local symbol in the source by using the syntax "global_name.local_name". The '.' is otherwise forbidden in the middle of a label now.
- oldstyle-syntax: New directives rorg, rend, phase, dephase for a relocated label origin.
- oldstyle-syntax: print a warning when alignment is too big.
- oldstyle-syntax: LIST and NOLIST directives to control listing file output.
- oldstyle-syntax: INCBIN got two optional arguments to skip bytes at the beginning of a file and to restrict the size of the included data (contributed by Romain Giot).
- oldstyle-syntax: New directive abyte, which adds a constant offset to each byte written (contributed by Romain Giot).
- oldstyle-syntax: New directive ifused (contributed by Romain Giot).
- std-syntax: Implemented .abort, .err and .fail directives.
- std-syntax: Allow non-constant expressions for conditional directives, with the same restrictions as in the other syntax modules.
- std-syntax: print a warning when alignment is too big.
- std-syntax: .list and .nolist directives to control listing file output.
- std-syntax: Enabled support for named macro arguments.
- std-syntax: New directives: .ifb and .ifnb to check whether a macro argument is blank or non-blank.