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
(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)
- 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)
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.
05-Oct-2015: vasm 1.7d.|
- New option -depend to print the list of file dependencies for the assembled source with the given options and conditions.
- New output module for Motorola srecord format, contributed by Joseph Zatarski. It can be selected with the -Fsrec option.
- m68k: Replace all short-branches, except BSR, which have a zero distance by a no-operation instruction. Now we use LEA (A6),A6 for no operation as NOP has a special meaning for certain 68k models.
- m68k: A zero width in bitfield instructions is accepted. It is equivalent to a width of 32 and used in some sources.
- m68k: New option -gas enables GNU-as specific mnemonics and additions. 68020/68881 is selected by default.
- m68k: New option -sgs to enable & as an additional immediate operand prefix (SGS assembler).
- m68k: New option -no-fpu to ignore any FPU directives or options.
- m68k: Support immediate register list masks also for FMOVEM.
- m68k: jbra/jbsr are always converted to branches, when the selected CPU supports 32-bit branches (gas compatibility).
- tr3200: Add data relocations. Fix PC-relative RJMP instruction.
- ARM: Accept an additional operand after an immediate constant to specify the even rotate-count (0-30). Usually vasm does that automatically.
- mot-syntax: The symbol __LINE__ always contains the current line number.
- std-syntax: Add .even directive.
- std-syntax: Besides 0f also allow 0r as a floating point constant prefix.
- aout-output: Fixed common symbols.
- aout-output: Implemented stabs support.
15-May-2015: vasm 1.7c.|
- Complete redesign of the internal macro handling, which gives each syntax module more possibilities for individual macro features.
- New syntax module: madmac, which tries to be compatible to the Atari Madmac assembler syntax, used for 6502, 68000 and Jaguar RISC targets.
- New CPU backend for the virtual Trillek TR3200 CPU (known from 0x10c).
- Allow arithmetic operations with more than one label from absolute ORG sections (like label1|label2). Support also depends on cpu backend and should work at least in data for most backends now.
- Stop parsing a file at CP/M EOF character (0x1a), as seen in some sources.
- No longer allow redefining a symbol, defined by an equ/equiv directive, with a set-directive.
- Fixed problems with escape character sequences in strings inside a macro definition, when syntax module supports escape characters.
- m68k: In MULx.L Dn,Dl the Dh bits (bit 0-2, 2nd word) are undefined. Most assemblers set Dh=Dl, similar to Dr=Dq in DIVx.L. So should we.
- m68k: New option -regsymredef allows redefinition of register symbols while parsing the source.
- m68k: Fixed "OPT 0" in PhxAss compatibility mode (broken since V1.7), which made all branches 16-bit size.
- m68k: Register lists defined by REG, EQURL, FREQ, FEQURL must not be redefinable.
- PPC: Support for floating point data constants.
- jagrisc: Added absolute and relative 5 bit source operand relocations. Fixed relative JR relocations.
- jagrisc: Fixed (R14+Rn) addressing mode.
- jagrisc: New JRISC specific directives: GPU, DSP, REGEQU, EQUR, REGUNDEF, EQURUNDEF, CCDEF, CCUNDEF (madmac/smac compatible).
- z80: Fixed RST (again), when referencing labels from an absolute section.
- mot-syntax: New option -allmp makes all 36 macro arguments available, also in standard vasm mode (no PhxAss or Devpac compatibility required).
- mot-syntax: New option -warncomm to warn about blanks in the operand field, which may start an unwanted comment.
- mot-syntax: CNOP fills the padding words with NOP instructions in an M68k code section.
- mot-syntax: The optional third argument of the SECTION directive may be written as a numerical constant to define any memory attributes (hunk format only).
- mot-syntax: New directive WEAK, to declare a symbol having weak binding, for those output formats which support it.
- mot-syntax: New directive COMMON, to create a common symbol.
- mot-syntax: Made PRINTT and PRINTV directives more compatible to AsmOne.
- mot-syntax: Fixed RS.x without operand (same as RS.x 0).
- std-syntax: The standard GNU-as macro syntax, with named arguments, default values and qualifiers, is supported now. Macro names became case-insensitive.
- std-syntax: Directives are case-insensitive.
- std-syntax: New optional, non-standard, third argument for the .section directive defines target specific memory attributes (currently hunk format only).
- std-syntax: .b/.w/.l extensions do not belong to an identifier, when the CPU is M68k.
- std-syntax: Directives to define floating point constants in data: .float, .single and .double.
- std-syntax: .equiv directive. Works like .set and .equ, but cannot be redefined.
- aout-output: Absolute ORG sections are appended to a .text section. Support for Jaguar, which uses MID 0.
- bin-output: Sort sections by their start address before writing them.
- hunk-output: Align M68k code sections with NOP instructions.
- hunk-output: Supports any memory attributes in objects and executables.
- hunk-output: Warn about unsupported weak symbols.
- hunk-output: Fixed illegal memory access with unreferenced common symbols.
- hunk-output: Automatically generate short relocation hunks (HUNK_DREL32) in executables, when possible and not forbidden by a -kick1hunks option.
- hunk-output: Support for 32-bit PC-relative relocations in executables (available since AmigaOS3.0).
- tos-ouput: Warn about unsupported weak symbols.
- elf-output: Add support for jagrisc (EM_JAGRISC = 0x9004). This is an unofficial definition done by the Jaguar scene.
- aout-output: For M68k use the SUN010 or SUN020 MID, depending on the highest cpu type being used in the source.
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.