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
    tar -xzf nasm-2.10rc3.tar.gz
    cd nasm-2.10rc3
    ./configure --prefix=$HOME/nasm
    make install
    cd ..
    rm -rf nasm-2.10rc3 nasm-2.10rc3.tar.gz
    export PATH=$PATH:$HOME/nasm/bin

  2. Install Along32.

    wget -c
    tar -xzf Along32-1.0.3.tar.gz
    cd Along32/src
    mkdir -p $HOME/nasm/lib $HOME/nasm/include
    make install INSTDIR=$HOME/nasm/lib
    cp ../ $HOME/nasm/include
    cd ../../
    rm -rf Along32 Along32-1.0.3.tar.gz

  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/"

  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.


Comments are closed.