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)
28-Dec-2014: vasm 1.7b.|
- Fixed stack overflow and crash when using recursively defined symbols. Bug was present since introducing new 128-bit and float expressions in 1.7.
- Issue a warning when a symbol was declared as external, but nowhere referenced in the source.
- m68k: Do not optimize MOVEM to MOVEA or MOVE when predecrement or postincrement addressing mode is used with a register from the list.
- m68k: The Devpac directive OPT X (xdebug) works now as expected for hunk-format object files and for TOS executables.
- m68k: In Devpac-compatibility mode (-devpac) the __LK symbol is predefined and reflects the output file type: 0 = Atari executable, 3 = Amiga object, 4 = Amiga executable, 99 = all others which are unknown to Devpac.
- m68k: MOVEM #list,-(An) must not reverse the bit mask automatically, but expect an already reversed one.
- m68k: BTST #n,#m is illegal.
- m68k: LEA (d32,An),Am translation to MOVE.L/ADD.L stopped working with V1.6c. Fixed again.
- ARM: TEQP, TSTP, CMNP and CMPP were missing for AA2.
- ARM: Fixed recognition of addressing mode and condition codes with instructions written in upper case.
- 6502: New option -c02 to enable 65C02 instructions.
- mot-syntax: In PhxAss- and Devpac-compatibility mode only the directives which are known by the emulated assembler are supported.
- mot-syntax: RS, SO and FO offset directives use an aligned offset in Devpac-compatibility mode or when the -align option is given.
- std-syntax: The optional third argument of .balign/.p2align/.align is now really supported and defines a maximum number of padding bytes.
- std-syntax: New directives: .balignw, .balignl, .p2alignw, .p2alignl, .zero, .swbeg.
- std-syntax: .word should rather define 16-bit than 32-bit constants.
- std-syntax: .local followed by .comm should be the same as .lcomm.
- oldstyle-syntax: Fixed recognizion of .equ/.eq/.set/.mac/.macro with -dotdir option.
- hunk-output: New option -linedebug automatically generates a LINE DEBUG hunk for the input source.
- aout-output: Always generate an external reference to a weak symbol, even when the symbol is defined.
- elf-output: Always generate an external reference to a weak symbol, even when the symbol is defined.
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".
- hunk-output: 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.
- tos-output: A 16-bit aligned section size must also show up in the header.
- tos-output: 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).
- tos-output: 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.
- bin-output: 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).
- tos-output: 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.
- vobj-output: Output was broken since 1.6, when relocations based on the current-pc symbol had been used.