Recent Changes - Search:

Recently Written


edit SideBar

Devel Asm

1.  Syntax mess

For x86 CPU’s, there exist multiple assembly syntaxes:

  • MASM - the oldest “dialect”, uses assume, offset, addr, ptr, subdialect of INTEL syntax: moves from right to left (opposite of other CPU’s approach and European text typing direction)
  • TASM IDEAL mode - based on MASM, newer, more brackets
  • GAS / AT&T - rather old,  movl %eax,%ebx - excessive prefixing, moves from left to right (the “correct” way ?), but opposite of INTEL syntax ! 
  • NASM/FASM - similar, also considered as “INTEL”, both based on TASM IDEAL, no assume, offset, addr, ptr anymore

A comparison of assemblers supporting MASM syntax or similar can be (no longer) found at Japheth ’s JWASM page: .

A comparison of INTEL syntax with GAS can be found at YASM project page: .

Assembly source code conversion tools:

2.  Code assembler in what ?

Most assemblers are coded in C , this brings some portability on the host side, OTOH is considered as “far away from acceptable” by some “hard-core” assembler freaks since not self-hosting, and relying on external tools like GCC needed to compile the assembler itself. Products coded in assembly are FASM, RosASM (very limited usefulness for DOS), SolASM (self-hosting, fact confirmed by author, but closed source), and possibly (closed source) LZASM.

3.  Assembler AKA assembly compiler products

3.1  MASM / MASM32

MASM exists since 1981, and it is still maintained by Microsoft - not very frequently, but every now and then support for new CPU opcodes is implemented. Also, nowadays it is not being promoted as much as other Microsoft’s products - in fact not at all. MASM is not free, all the various versions available for legal download do have severe license restrictions. Most of old DOS code as well as code having old roots uses MASM syntax and is intended to be compiled with it, mostly prefers version 5.1 or 6.1xx - code written for 5.1 however might not compile with 6.1xx anymore. Versions 6.xx brought various syntax changes, and added support for high-level structures ( .if , .while , … ) into the compiler core. There are also later versions (7, 8 and 9), around, but they never became that popular as 5.1 and 6.1xx and were almost never used for DOS development.

One source to get MASM is MASM32 (it includes MASM v6.14 ). However, MASM32 is a package for Win32 programming with MASM, it’s not intended for programming 32-bit (and even less 16-bit) DOS applications. Furthermore, MASM32 tries to prohibit by license to develop “Open Source” programs, as well as programs for non-MS systems! Paid versions of MASM don’t have such restrictions. Technically MASM itself supports compiling DOS code, 16-bit and 32-bit, of course. 16-bit code requires an OMF linker, alternatives to the original MASM linker (dropped and barred out from bundling with MASM long ago) are for example VALX (contained in CC386) or OPTLINK (contained in Digital Mars C++).

MASM is written in C (closed source), versions 5.xx are compiled with Microsoft C compiler version 5 as real-mode DOS applications, MASM 6.xx are compiled with C compiler 6 as Win32-PE binaries, versions up to 6.11d however are stubbed with a version of PharLap DOS extender providing a minimal Win32 emulation, allowing to use them also in DOS as-is. Newer versions are no longer intended for use in DOS, but they still run using HX-DOS Extender.

3.2  TASM

TASM is - like MASM - rather old and not free. It supports 2 types of syntax: MASM-like (default) and IDEAL mode - later the latter one inspired the NASM and FASM syntax, and is used by LZASM (see below) as well. Was also used frequently for DOS development, alone or mixed with PASCAL or C language. One famous project with nice TASM source is the DOS/32A extender. Historical note: FASM started on TASM before it became self-compiling.

3.3  Paradigm ASM

Clone of TASM supporting both MASM and IDEAL MODE syntax. Product itself not very useful, commercial, designed for “embedded” stuff, has a manual called pasmug.pdf being “offered” as manual for LZASM (see below), or Google for it. Company page: .

3.4  PoASM

Related to Pelles C compiler. After extracting it from the installer (no way in DOS), it can run in DOS also using HX-DOS . It has a syntax comparable with MASM, but in many cases it can’t be used as a replacement, because it doesn’t support generating 16-bit code or segmented memory models. Furthermore, support for macros is limited and differs significantly from MASM. Supports only COFF output format. It has been premature, and now can be considered as obsolete in favor of JWASM.

3.5  JWasm

JWasm is intended to be a Masm compatible assembler, it can be used as a drop-in replacement for Masm. Unlike current versions of Masm, the JWasm license doesn’t restrict the usage to certain OS’es. Binaries for DOS (32-bit and 16-bit), Windows and Linux are available. Also, JWasm is open source, it’s a fork of Open Watcom’s WASM. Currently 16, 32 and 64 bit code generation is supported, formatted as OMF, COFF, ELF, MZ EXE or raw binary. Instructions up to SSSE3 (Intel Core 2) are supported. The 16-bit DOS version has some limitations (no 64-bit support, no COFF and ELF, no latest SSSE instructions, limited size of source code that can be compiled).

Work on JWasm started in 2008-March (also some experimental releases), versions published so far are:

  • v1.7 2008 May - supported OMF output format only
  • v1.8 2008 June - added COFF output and partial MASM 5.1 compatibility
  • v1.9 2008 July - full ELF and Linux support (not really useful for DOS), bug-fixes in various areas, the DOS version became a stand-alone binary with DPMI host included
  • v1.91 2008 August - raw binary output, bug-fixes
  • v1.92, v1.93 2008 September & October - bug-fixes, source clean-up, support for SSSE3 instructions
  • v1.94, 1.94a, 1.94b, 1.94c 2008 December - many bug-fixes, more directives, other small enhancements
  • v1.95 2009 May - many bug-fixes, added 16-bit DOS hosted version
  • v1.96 2009–07–26 - many bug-fixes, added format MZ, last version without 64-bit target support, v1.96a came 3 days later fixing a bug specific to the 16-bit DOS version
  • v2.00 2009–10–12 - enabled 64-bit support, many bug-fixes in various areas
  • v2.01 … v2.08 - many bug-fixes
  • v2.09 2012–12–02 - many bug-fixes, added format PE
  • v2.10 2013–04–17 2013–04–20 - many bug-fixes, more debug support
  • (dead) JWASM, also comparison table of MASM-compatible assemblers


Original WASM was created for WATCOM compiler long ago, in recent years WASM came with OpenWATCOM C compiler versions 1.0 to 1.7, uses MASM syntax, “intended” to be fully MASM 6.xx compatible, but has been premature and limited, and developing slowly, and providing a “mess-compatibility” with something between MASM 5.1 and 6.xx only, well usable for “additional” ASM files for C projects (like MP3 decoder of MPXPLAY), but not for “serious” ASM development. The WASM source code has been the root for JWasm, see above. However recently there was some partially independent development of “original WASM” as well and support for TASM (both MASM and IDEAL mode, but only partial) was added in version 1.9, while JWasm doesn’t support IDEAL mode or special TASM compatibility.

Project page: WASM in OpenWATCOM Wiki

3.7  NASM

“The Netwide Assembler”

Written in pretty well portable C language (prefers GCC (DGJPP for DOS) compiler, but old versions also have a 16-bit DOS version (old Boreland C compiler ?), provides sort of portability - develop for I80×86 CPU on other CPU’s, for running your code you will need additionally a full emulator then ;-) NASM can output 16-bit, 32-bit and 64-bit (2.xx versions, not very useful dor DOS) code formatted as plain binary (useful to create DOS .COM and .SYS files) or various object formats, including OMF (usual .OBJ files) and COFF . Project started in 1996 (?), was under intensive development until 2002, then slow development until 2005 (YASM (see below) fork created in this time, 2005 version 0.98.39 came out), since 2007 fast development again (0.99 and 2.xx versions, 64-bit support). For years the license was LGPL, with version 2.07 (2009-Jul) it was changed to the 2-clause BSD license.

Major developers and contributors: Simon Tatham, Julian Hall, H. Peter Anvin, Frank B. Kotler, Victor van den Elzen, Cyrill Gorcunov.

Some relevant versions:

  • NASM 0.98.39 - was released on January 15, 2005 . 16-bit and 32-bit target support, various 32-bit host platforms + 16-bit RM DOS. The pretty “final” choice for DOS.
  • NASM 0.98.40 - is not “official” and was not for DOS anyway.
  • CC386 compiler (see C-language compilers) uses a modified version from the NASM 0.98 line compiled with CC386.
  • NASM 0.99.xx - were experimental / development versions preceding 2.0 .
  • NASM 1.0 - doesn’t exist :-D
  • NASM 2.0 - the new “mature” version, brings 64-bit and later SSE support as “benefit” , 32-bit and 16-bit targets kept as well, various 32-bit host platforms including DOS, but no 16-bit hosted version anymore.
  • NASM 2.07 - released 2009-Jul, fixes over 2.0, license changed to BSD.
  • 2.10.06 - released 2012-Dec-04, very latest, just minor fixes over 2.07

Project pages (hint: open link in a new window):

Download (hint: open link in a new window):

Project includes a disassembler, NDISASM , as well as a good (non-MASM style, up-to-date) instruction list, the preceding statements about “MS-DOS” are however no longer acceptable.

3.8  YASM

Yes it is an ASseMbler”

Version 1.0 released 2010-Apr-08, so far latest 1.2.0 2011-Oct-31.

Based originally on NASM, rewrite and drop-in replacement (except OMF support), later additional syntax support added, BSD licensed. DUGL ASM code (closed) changed from NASM to YASM recently. Written in C , DOS version compiles with DGJPP.

  • Compiles 16, 32 and 64 bit code
  • Outputs raw binary, ELF and COFF (32 and 64)
  • Supports NASM and GAS’s “AT&T” syntax (also a separate “TASM-like frontend” exists)
  • No OMF output (is on the ToDo list, but already delayed several times)
  • No support for MASM syntax (was ToDo ? forget it, use JWASM ;-) )
  • No MZ and PE output (probably not planned, mentioned because FASM has this feature)

3.9  FASM = FlatAssembler


Project page:

Latest version: 1.71.54 from 2016-Jun-09


By Tomasz Grysztar , self-compiling/self-hosting, liberal BSD-like open source license. FASM can generate 16-bit and 32-bit code (+ 64-bit) and easily mix them. A good 32-bit DOS version is available (at least 80386 CPU is required, no 16-bit version exists). FASM’s syntax is inspired by TASM’s “ideal” mode and NASM, with further updates which are rather unique to it.

So far FASM has been most famous for usage in development of some OS’es like MenuetOS (64-bit and 32-bit GUI), DexOS and BOS (latter 2 are 32-bit DOS-like systems).

FASM Features

FASM supports various output formats:

  • Raw binary (also useful as DOS .COM and .SYS )
  • DOS MZ executable (.EXE)
  • PE executables and DLL’s
  • COFF object modules
  • ELF objects

FASM is efficient and easy to use, the compiler resides in one single file of cca 100 KiB size (!).

FASM provides a powerful preprocessing and macro system, although it’s “original” and not compatible with other assemblers. FASM includes an expression evaluator with 65-bit (sixty-five!) precision (since version 1.70, actually 1.69.41beta).

There are almost no commandline options: SSSO - same source, same output , makefiles/linking not needed but also possible if someone really wants to (still no OMF).

FASM’s DOS version is sort of “strange” - runs in unreal mode if available (not with EMM386 or if CPU seems not to support “this” unreal mode), otherwise uses DPMI (host must be active). Even “worse”, it uses a “32-bit” unreal mode, an approach which is rather unique, but also very interesting from a technical point of view.

FASM also has a one file DOS IDE version: text editor with syntax highlighting, calculator, built-in compiler, no mouse support.


  • Very little FASM-compatible manuals and open source and example code around, most ASM code available is MASM, and ASM manuals also mostly refer to MASM.
  • No support for OMF output format (also no support for LE).
  • No “official” / included disassembler (NDISASM or DISTORM can be used).

FASM History

First public version was released 2000/03/15 (???), first selfcompilable one was 0.90 1999/05/04, and was previously developed on Tomasz ’s previous non-public assembler ASM32 (32-bit DOS only), and “finally” ASM32 had started on TASM.


In 2015 Tomasz started a development stage of FASM that might look a bit crazy at first glance: removing support of all instructions and output formats, leaving behind only preprocessor and expression evaluator. What’s the point of that? Well, adding support for other CPU’s than Intel. There have been hacky derivatives of FASM for other target CPU’s around for years, and this move is supposed to provide a well designed method to achieve the objective. This approach is implemented in a separate branch of FASM called FASM G, the good old (or less good, if you don’t appreciate the huge amount of the latest Intel instructions having been and being added) FASM is not abandoned or deleted, but will probably develop slower in future.

3.10  LZASM

By Stepan Polovnikov , closed source freeware, DOS and Win32 versions. Lazy Assembler  latest version: 0.56 (06 AUG 2007) . Is - mostly - compatible with TASM IDEAL mode.

3.11  Solar Assembler (SOLASM)

By Bogdan Ontanu , closed source, free for personal use (see license). There are binaries for SolarOS, MacOS, Win32 & Linux available. To run the assembler in DOS you’ll need the Win32 version and HXRT. SolAsm’s syntax is - like FASM and LZASM - inspired by TASM. Has output support for 16, 32 and 64 bit code, raw binary, object formats OMF, COFF and ELF and direct PE format (EXE or DLL).

Project page: .

3.12  DJASM

This one, itself written in C, is considered being sort of half-baked and not a serious development tool, since it was created “only” to compile the DGJPP “stub”: 14 KiB source to 2 KiB binary. Very little code, but valuable info about DPMI usage.

3.13  GAS (GNU Assembler, AS.EXE)

Very popular, although not very good. Why ? It is the assembler used by GCC (3 stage compilation: C/C++/HLL → ASM, ASM → objects, finally linking) and therefore all compilers based on it (DGJPP, MinGW/CYGWIN, FreePASCAL, FreeBASIC). It introduced the so called “AT&T” syntax (source operand first, then destination, plus many other “extraordinary” rules), but supports also the “Intel” one (destination operand first, then source) for quite a long time. In this mode it mostly removes the “AT&T” oddnesses, and accepts a syntax acceptably similar to TASM IDEAL or FASM (still some PTR’s are required). The second flaw is its lack of correctness (expects GCC to feed in correct code) - many bugs detectable (and detected by other assemblers) during compilation are silently passed and compiled into bad code - disassemble or debug to find them. Finally, it occupies cca 1/2 to 1 MiB (various versions and builds of them do exist) what is quite big - FASM has 100 KiB only and offers more features. 2 famous projects compiling with GAS are UPX (most of it is C++, a part is ASM using “Intel” syntax of GAS) and the Loonix kernel (most of it is C, a part is ASM using the “AT&T” syntax). Source files for GAS can have the extension .S (usually when using “AT&T” syntax) , or .ASM (mostly when using INTEL syntax) . FreeBASIC “libraries” use both (besides dominating C language) .

3.14  Misc / others

  • Anasm (toy, but written in NASM, for DOS)
  • NewBasic (NBASM32, minimal “toy” MASM 5.1 clone)
  • RosASM (rejected by ReactOS devels, WinNT GUI only)
  • GoASM (Windows only, 32- and 64-bit)
  • TMA
  • A86 and A386 (by Eric Isaacson, shareware, mostly MASM-compatible)
  • Octasm (related to OctaOS)
  • Wolfware (WASM.COM)
  • NGASM (FreeWare from India, sort of minimal old MASM clone from 2007, can create DOS COM programs only
  • Pass32
  • DEBUG (see Development , minimal assembling support also, 8086 to Pentium)
  • Insight real mode debugger (see Development , minimal assembling support also, only 8086 for now)
  • HLA (Assembler frontend only)
  • Arrowsoft (MASM derivative, probably illegal…/240.html)

4.  Linkers

4.1  VALX

16 and 32 bit OMF linker, by David Lindauer / Ladsoft , open source (GPL), based on old VAL linker, available with CC386 compiler (no longer separately).

4.2  WALK32 / W32Link

DOS hosted (8086 !!!) “cross” OMF linker with Win32 PE output (only), some other related tools (but no assembler) included, hosted at .


16 and 32 bit OMF and COFF linker, part of Open WATCOM project. Japheth writes about MZ support: “has improved recently, since v1.6 it can handle 32bit object modules. Since v1.8 it also accepts 32bit segments and DGROUP with size > 64 kB.” Nevertheless he maintains a JWLINK fork with some fixes and enhancements in output formats MZ EXE and PE , it is used for creation of some HX binaries.

  • Input: OMF16, OMF32, COFF32, ELF
  • Output: DOS .COM executable, DOS .SYS driver, DOS MZ executable, LE/LX, PE (EXE or DLL), ELF and more
  • Fault: original WLINK version can’t link HX’s Win32 API emulation DLL’s
  • JWlink v1.9 beta 11 2013-Apr-23 and much documentation

4.4  PO-LINK

32 and 64-bit COFF to PE linker, comes with Pelles C package, closed source freeware.

  • Input: COFF object
  • Output: PE
  • Fault: itself runs in DOS with HX, but available only inside installer not extractable in DOS

4.5  Digital Mars OPTLINK

Included in the Digital Mars C++ package. FreeWare. Fast.

  • Input: OMF objects (both 16- and 32-bit)
  • Output: COM/EXE (DOS), NE (Win16, OS/2), PE (Win32).

4.6  LD

32 and 64-bit COFF linker, designed for GCC, part of GNU project, used by DJGPP, FreeBASIC and FreePASCAL (where it recently became optional only because of “internal” linker ?).

  • Input: COFF object
  • Output: COFF DPMI executable, PE

4.7  ObjConv

Also “sort-of” a linker. Allows to convert various 32-bit and 64-bit object formats (most useful for DOS: COFF32 < - > OMF32) and disassemble (smart(!), but slow on big files) object files and PE into MASM or NASM syntax, minimal “read-only” OMF16 support. By Agner Fog , C++ , open source, GPL.

Author provides (besides source code) a Win32 console binary only, a native DOS binary is provided by Japheth at his JWasm page, see above.

5.  See also

Edit - History - Print - Recent Changes - Search
Page last modified on July 08, 2016, at 10:22 AM