Using VASM - A Multiplatform, multi-Target-CPU assembler!

This is not the website of VASM, and I am not it's author ... you can find VASM here!

<- Back to the Main Contents & Basic Z80 Assembly Lessons

Vasm is an open source, multi platform assembler, which can compile to the Z80, GBZ80 (gameboy CPU), 6502, 68000 and more!
Learn more about VASM

Download my Windows builds of VASM (Built 2019/6/29)
Vasm also supports multiple syntax options, and the 'OldStyle' option is most compatible with the WinAPE code we've looked at in these tutorials, unfortunately there are some compatibility issues, but it's relatively trivial to fix them

VASM Command Line
Let's take a look at a typical VASM command line!

We need to use a different EXE build of vasm, depending on our ASM source, and destination CPU

these tutorials use OldStyle for Z80 and 6502, and MOT for 68000 (68k)



There are various other commands switches you may want to use (In order of importance)

Source FileName - This is the ASM file we want to compile
Output file - Winape can specify a destination in the ASM code, but VASM cannot, you must specify it here on the command line and type -FBin means 'binary output'
Listing - this is a TXT output of the processing of the ASM file, it's useful to debug what went wrong if you end up with a corrupt binary, or one that's much bigger than you expected
nocase - Disable case sensitivity
chklabels - make sure no ASM commands are in the label area

Special options for special CPU's:

m68000 - Specify a 680xx CPU type
gbz80 - Build for the Gameboy CPU
c02 - Build for 65C02 / HUC6270 cpu

68000 only:

ELF link - if we want to use Vlink to create an Amiga or AtariST binary, we need to set the output to -Felf, and use vlink to build to our destination
Link format - binary format vlink should output to

Stuff I use, but you don't need to:

vasm definition - This will set vasm to 1... this does the same as 'vasm equ 1' in the code, and allows us to fix things that vasm needs doing differently to WinApe in the ASM file
Build definition - the same as 'BuildZXS equ 1' in the code - I use a different batch file for each destination


Differences between VASM and WinAPE

Winape Version Corrected Vasm Ver
WinApe doesn't mind commands being at the far left, but in VASM only Labels and EQU symbol definitions can be at the left,
We need to move the ORG and RET  statement to the right
Hint: use -chklabels to warn if any commands are in label area!
Winape uses MEND or ENDM for the end of a macro, but VASM can only use ENDM
I've been putting labels for self-modifying values on the right in WinAPE, but VASM requires them to be on the next line, at the far left
in VASM Macros need to have a comma , between the macro name and the first parameter,
also parameters need a \ before them in the macro definiton,

Unfortunately WinAPE will not like this, but if you need to compile both, you can use an 'ifdef vasm' option, and have a version for winape, and one for vasm
this 'nolist' statement is being mistaken for a label, what's worse, because it's before the ORG statement, it will be considered the first data in the output, and 32k of zeros will appear at the start of your output file!
there is no such command as ex hl,de... the correct one is ex de,hl
WinAPE would let us get away with it, but VASM says no!
in WinAPE, align is done by the byte boundary... VASM works differently, you specify the bit number you want aligned, so Align 256 becomes Align 8
If you want to compile on both, you'll have to have alternate versions for WinAPE and VASM
RST's in WinAPE can be specified by address or number, but in VASM they can only be specified by address... just multiply the RST number by 8!
Vasm is Case sensitive, so we need to ensure the case matches!

*** use the -nocase option to disable case sensitivity!

Useful Macros

WinAPE VASM
If you want to compile with VASM and WinAPE , you may wish to use macro's to help you

For example, when you want zeros in your output file until a certain address, in WinAPE you need a local label and defs ... but in VASM you can just use ORG

READ (including another ASM file) is INCLUDE in VASM
PRINT,WRITE,SAVE and CLOSE have no equivalent in VASM... we specify the save file on the command line, and we'll just have to do without PRINT!

As previously mentioned ALIGN does not work the same, but we can define compatible macros to compile to both.

 

View Options
Default Dark
Simple (Hide this menu)
Print Mode (white background)

Top Menu
Youtube channel
ASM Programming Forums
GitHub
Dec/Bin/Hex/Oct/Ascii Table

Z80 Content
Learn Z80 Assembly
Hello World
Advanced Series
Multiplatform Series
Platform Specific Series
ChibiAkumas Series
Grime Z80
Z80 Downloads
Z80 Cheatsheet
Sources.7z
DevTools kit
Z80 Platforms
Amstrad CPC
Elan Enterprise
Gameboy & Gameboy Color
Master System & GameGear
MSX & MSX2
Sam Coupe
TI-83
ZX Spectrum
Spectrum NEXT
Camputers Lynx

6502 Content
Learn 6502 Assembly
Advanced Series
Platform Specific Series
Grime 6502
6502 Downloads
6502 Cheatsheet
Sources.7z
DevTools kit
6502 Platforms
Apple IIe
Atari 800 and 5200
Atari Lynx
BBC Micro
Commodore 64
Commander x16
Super Nintendo (SNES)
Nintendo NES / Famicom
PC Engine (Turbografx-16)
Vic 20

68000 Content
Learn 68000 Assembly
Platform Specific Series
Grime 68000
68000 Downloads
68000 Cheatsheet
Sources.7z
DevTools kit
68000 Platforms
Amiga 500
Atari ST
Neo Geo
Sega Genesis / Mega Drive
Sinclair QL (Quantum Leap)
X68000 (Sharp x68k)

My Game projects
Chibi Aliens
Chibi Akumas

Work in Progress
Learn 6809 Assembly
Learn 65816 Assembly
Learn 6809 Assembly
Learn PDP11 Assembly
Learn TMS9900 Assembly
Learn 8086 Assembly (x86)
Learn Risc-V Assembly
Wonderswan
MsDos
Learn ARM Assembly
Dragon 32/Tandy Coco
Ti 99
Gameboy Advance
Risc Os

Misc bits
Ruby programming




Chibi Akumas V1.666 has taken over 350 hours of development, if you want to support my work, and learn all the secrets of the game's development, please back me on patreon!





Thanks to Homebrew Legends for help promoting my game!
Buy Chibi Akuma(s) from PolyPlay
Buy ChibiAkuma(s) games now!