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)
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)
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.
01-Apr-2011: vasm 1.5a.|
- Fixed -nocase option to make it no longer modify external symbol names, which then broke linking.
- Made IfDef and IfNotDef directives work with local symbols.
- Additionally to the standard \@ to insert a unique ID within a macro the symbols \@! and \@@ are supported to put the current ID onto the stack or pull the last ID from the stack.
- PPC: Fixed detection of missing and extra operands.
- m68k: FPU register names may be used for symbols, as long as no FPU code generation was enabled.
- m68k: Fixed a branch optimization bug, which occurs when the effect of all translations is nullified, so that no label changes its address in one pass.
- oldstyle-syntax: Fixed pc-symbol ('*') assignments. "* = <addr>" didn't work in the first column.
- mot-syntax: Do not crash on PRINTT without operand, but just print a newline.
- mot-syntax: Dots ('.') are allowed everywhere in the label, not only at the beginning, when either the -devpac option or the new -ldots option was specified.
- mot-syntax: Any local symbol in the source can be referenced using the global_name\local_name syntax, as in PhxAss.
- mot-syntax: When OUTPUT is used with ".name" then it is not only appended to the output name, but it also replaces a possible extension in it (Devpac compatibility).
- mot-syntax: Option -localu makes local symbols start with an underscore instead of a dot (from Devpac).
- output-vobj: A file without sections no longer causes an internal error.