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)
- 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)
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.
10-Dec-2011: vasm 1.5c.|
- Define a __VASM symbol to identify the assembler.
- Reworked sources to use typedefs from stdint.h where appropriate.
- Fixed vobjdump to regard all information from an object as unsigned, except symbol values and reloc addends and masks.
- m68k: Assign the current cpu/fpu/mmu type to the __VASM symbol.
- m68k: Define the __G2 symbol in Devpac compatibility mode.
- ARM: Fixed U-bit handling and sign in load/store addressing modes dealing with labels (which are translated into PC-relative).
- ARM: The I-bit in halfword transfers must be flipped.
- z80: Fixed error message when 8-bit data is out of range (-128 .. 255).
- z80: Allow the offset to be an external symbol in ld (ix+offset).
- z80: Accept JP HL besides JP (HL), as most (?) assemblers do for convenience.
- std-syntax: Section ".text","acrwx" is default when no .section or .org directive is present.
- oldstyle-syntax: Section ".text","acrwx" is default when no SECTION or ORG directive is present.
- oldstyle-syntax: A section directive without attribute defaults to "acrwx".
- oldstyle-syntax: New option -autoexp to automatically export all non-local symbols.
05-Aug-2011: vasm 1.5b.|
- m68k: Fixed -no-opt option.
- m68k: Fixed the (hopefully) last possibility for oscillating branch optimizations. Example: bra lab; bra lab; lab:
- x86: Enabled experimental 64-bit support. The new option -m64 allows the usage of 64-bit instructions. New directive .code64.
- 6502: Fixed ASL, ROR and ROL with addressing mode ABS,X (by Mauricio M. Lucero).
- 6502,z80: Support /256 %256 and &255 operations with labels and generate the appropriate relocations (Dominic Morris).
- z80: Bad relocations are now flagged by the correct error message.
- elf-output: Support for ELF64 and x86_64 relocations.