HJWasm

1. About HJWasm

HJWasm is a free MASM-compatible assembler based on JWasm with these features:

  • native support for output formats Intel OMF, MS Coff (32/64-bit), Elf (32/64-bit), Binary, Windows PE (32/64-bit) and DOS MZ.
  • precompiled HJWasm binaries are available for Windows.
  • Instructions up to AVX2 and AVX512F are supported.
  • Support for MS Vectorcall on x64.
  • HJWasm is written in C. The source is portable and has successfully been tested with Open Watcom, MS VC, GCC and more.
  • As far as programming for MS Windows is concerned, HJWasm can be used with both WinInc (32/64-bit) and Masm32 (32-bit).
  • C header files can be converted to include files for HJWasm with h2incX.
  • HJWasm's source code is released under the Sybase Open Watcom Public License, which allows free commercial and non-commercial use.
  • There's a bunch of source samples available - they are supplied with the precompiled binary packages.
  • JWasm started as a fork of Open Watcom's Wasm in March 2008. Today, the part of Wasm source lines still contained in JWasm is approximately 15%.
  • HJWasm is a continued evolution of JWasm.

  • A document detailing all of the changes from JWasm to HJWasm:
    HJWasm Extended Guide

    2. Download HJWasm

    HJWasm 2.31 (32bit) 15/05/2017 hjwasm231_x86.zip 32bit Binary Package (Windows)
    HJWasm 2.31 (64bit) 15/05/2017 hjwasm231_x64.zip 64bit Binary Package (Windows)
    HJWasm 2.31 (Linux 64bit) 15/05/2017 hjwasm231_linux64.zip 64bit Linux Executable (GCC)
    HJWasm 2.31 (OSX Universal) 15/05/2017 hjwasm231_osx.zip 64bit OSX Executable (GCC)

    3. Visual Studio Syntax Highlighting

    V1.1 Usertype.zip
  • Download the usertype.dat file here and copy it to your Visual Studio installation folder /Common7/IDE.
  • Go to Tools->Options->Text Editor->File Extension and register .ASM as Visual C++ Editor type.
  • Close and restart Visual Studio and you should have prettified code. This also corrects an issue where breakpoints wouldn't set on AVX source lines.

  • h2incX

    3. About h2incX

    This tool's purpose is to convert C header files to Masm-style include files.
    It is much more powerful than Microsoft's h2inc tool. The main purpose is to convert the Win32 include files,
    but it should work with any C header files as well. It is a simple Win32 console application, but a 32bit DOS extended binary version is included as well to be used on Non-Win32 platforms.

    4. Features

    A private profile file is used which allows fine-tuning of the include files to generate.
    huge C header sets can be converted in one run (for example the Win32 headers contained in the PSDK).
    prototypes may be written so the include file fits for both dynamic linking to a dll (using the IAT entries) and static linking to a library.
    optionally a .DEF file is written, which can then be converted to an import library with POLIB.

    5. Known Bugs and Restrictions

    In many cases the conversion will not be 100 percent, there will always remain some places where additional manual modifications will be required:
    one should be aware that some C header file declarations simply cannot be translated to ASM. There are no things like inline functions in ASM, for example.
    on some situations h2incx has to "count" braces. This can interfere with #if preprocessor commands, because h2incx cannot evaluate expressions in these commands.
    As a result h2incx may get confused and produce garbage.

    h2incx has some limited knowledge about C++, but it's original purpose was to convert C headers. So some C++ specific keywords may confuse h2incx, which is also true for templates.
    "far" and "near" qualifiers are skipped, so this tool will not work for 16bit includes.
    Macros in C header files will most likely not be converted reliably and therefore may require manual adjustments.

    6. Download h2incX

    h2incX v0.99.20 22/2016 h2incX.zip 102kb Added some additional X64 reserved words.
    h2incx.ini 22/2016 h2incxini.zip 3kb modified .INI which fixed some bugs concerning Win64

    WinInc - Masm/HJWasm/JWasm include files for Win32 and Win64

    7. About WinInc

    WinInc is a set of include files for Masm, HJWasm, JWasm or PoAsm created by h2incx.
    It contains all includes required to build Win32 and Win64 applications or dlls.

    Be aware that WinInc is intended for people being familiar with the command line interface and experienced in programming (not necessarily Assembler, however).
    There is also no installer supplied, just a compressed package of directories and files together with a simple README.TXT trying to explain things.

    As already mentioned, the WinInc include files were generated by h2incx. As source the C header files from the Microsoft Platform SDK were used.
    Since the conversion done by h2incx is not perfect, some of the created files had to be slightly adjusted afterwards.

    8. Comparison of WinInc vs Masm32

    WinInc is mostly compatible with the include files supplied with Masm32. The main differences are:

    In Masm32 there is one big include, WINDOWS.INC, which contains the Win32 declarations, and a bunch of other includes which contain the function prototypes.
    The include files of WinInc match 1:1 the header files contained in MSVC or MS PSDK, with extension .H replaced by .INC of course.

    Unlike Masm32 the prototype parameters of the WinInc include files are "typed". They usually have the same type as their C counterparts.
    In Masm32 all parameter types are "DWORD". Having typed parameters may be advantageous if the target has to be debugged and the debugger knows how to handle the MASM debug type information.
    The few name conflicts are resolved differently. In WinInc, a name which is used in the Win32 API and is also a MASM reserved word (for example, "mask"), is changed by
    adding a "_" suffix. In Masm32 the kind of the name modifications isn't consistent.

    WinInc includes are more up-to-date than the ones coming with Masm32. All declarations for the Win32 API extensions added to Windows 2000 and Windows XP are there.
    For some reason Masm32 doesn't allow to develop Open Source software with it. Furthermore none of its parts are redistributable. WinInc does not have such restrictions, it is Public Domain.

    Other ways in which WinInc differs from Masm32:

  • No assembler, linker or resource compiler is included in WinInc.
  • No library of helper functions (M32LIB in Masm32) is included, instead it is recommended (and supported) to use functions contained in C runtime libraries like libc, crtdll, msvcrt, ....
  • No IDE/editor is included.
  • 9. Downloads

    V2.08 WinInc208.zip

    General Support and Information

    11. Source Code

    Source code for HJWasm can be found in our Git Repository here.

    12. Bug Reports and Feature Requests

    bug reports and feature requests can be logged via the github project page.

    13. Complimentary Tools

    The following tools have been tested and work with HJWASM x86/x64.
  • EasyCode Visual Assembly IDE
  • 14. Contact

    General support, questions and anything related to assembly language programming
    is best answered via the official MASM32 forum and HJWasm board.

    Branislav Habus Developer safirdrive@gmail.com
    John Hankinson Developer john@terraspace.co.uk