Getting Started with JWasm — Installation and Quick Examples

Getting Started with JWasm — Installation and Quick Examples

What JWasm is

  • JWasm is a MASM-compatible x86/x86-64 assembler (supports 16/32/64-bit), open-source, originally based on Open Watcom Wasm. Runs on Windows, Linux, DOS and others; produces OMF/COFF/ELF/BIN/PE outputs depending on build.

Installation (Windows, Linux — quick steps)

  1. Download the latest release for your OS from the JWasm GitHub releases page (e.g., Baron-von-Riedesel/JWasm) or SourceForge.
  2. Unpack the archive into a directory (e.g., C:\JWasm or /opt/jwasm).
  3. Add that directory to your PATH (optional) so you can run jwasm from any shell.
  4. For formats requiring linking (COFF/PE/ELF), install a compatible linker (Visual Studio linker, Open Watcom wlink, ld, or other supported linkers).

Basic usage

  • Assemble a source file to an object:
    • Windows/Unix shell:

      Code

      jwasm -fmacho -Fo:out.obj source.asm

      (replace -fmacho with -fcoff, -felf, -fbin, -fpe as needed; use -Fo for output filename)

  • Assemble and produce an executable where supported (example for simple BIN output):

    Code

    jwasm -fbin -Fo:prog.bin prog.asm
  • Common options:
    • -f : choose output format (omf/coff/elf/bin/pe).
    • -Fd: : create listing file (depends on build).
    • -Z?: debug/info options (see manual).
    • Use .MODEL, .CODE, .DATA, PROC/ENDP, PUBLIC/EXTERN similar to MASM.

Minimal example (32-bit Windows PE via COFF + link)

source.asm:

Code

.MODEL FLAT, STDCALL .EXITPROC proto PUBLIC main

.CODE main PROC

push 0 call ExitProcess 

main ENDP END

Assemble and link (example using MSVC linker):

Code

jwasm -fpe -Fo:main.obj source.asm link /SUBSYSTEM:CONSOLE main.obj kernel32.lib

Simple “Hello, world” (console) outline

  • Use Windows API WriteConsoleA or printf via C runtime; easiest is to assemble a tiny program that calls MessageBox or uses C runtime if linking with libc.

Documentation & samples

  • Ship contains Manual.html, Readme, and SAMPLES directory. See repository README and Manual for MASM differences, directives, format-specific notes, and many sample files.

Tips

  • Use the samples included in the distribution to learn format/linker combos.
  • For Visual Studio integration, use provided jwasm.rules or VS2010 custom build rule files in the package.
  • If you need cross-platform builds, compile JWasm from sources with provided makefiles (GCC/Clang/Open Watcom/MSVC makefiles included).

If you want, I can:

  • provide a ready-to-assemble Hello World asm file for your target (Windows/Linux/PE/ELF), or
  • give exact jwasm command lines for a specific OS and linker.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *