Using nasm/Along32 instead of masm/Irvine32

Kip Irvine’s x86 assembly book is a good introduction to assembly. However, it requires using Visual Studio on Windows, both for the syntax and more importantly for the Irvine32 support library that the examples require. Happily, some folks have put together a Linux port of that library called Along32 and so using the crossplatform nasm assembler, one can make nearly full use of the book on Linux.

Below are the basic instructions for using nasm and this library.

  1. Install nasm (if it is not already installed).

    wget -c http://www.nasm.us/pub/nasm/releasebuilds/2.10rc3/nasm-2.10rc3.tar.gz
    tar -xzf nasm-2.10rc3.tar.gz
    cd nasm-2.10rc3
    ./configure --prefix=$HOME/nasm
    make
    make install
    cd ..
    rm -rf nasm-2.10rc3 nasm-2.10rc3.tar.gz
    export PATH=$PATH:$HOME/nasm/bin

  2. Install Along32.

    wget -c http://sourceforge.net/projects/along32/files/Along32-1.0.3.tar.gz/download
    tar -xzf Along32-1.0.3.tar.gz
    cd Along32/src
    make
    mkdir -p $HOME/nasm/lib $HOME/nasm/include
    make install INSTDIR=$HOME/nasm/lib
    cp ../Along32.inc $HOME/nasm/include
    cd ../../
    rm -rf Along32 Along32-1.0.3.tar.gz
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/nasm/lib

  3. Convert your program to nasm syntax. The instructions here should provide a good starting point. The %include line should be: %include "/path/to/my/home/nasm/include/Along32.inc"

  4. Assemble your program (assuming source is program.asm)

    nasm -f elf -o program. o program.asm

  5. Link your program.

    gcc -o program program.o -lAlong32 -L$HOME/nasm/lib

  6. Run your program.

    ./program

Comments are closed.