Version 0.9
Copyright © 2013 Leo Noordergraaf
Copyright © 1999, 2000, 2006 Konstantin Boldyshev
$Date: 2013-03-10 13:40:11 +0100 (Sun, 10 Mar 2013) $
Abstract
This document is intended to be a tutorial, showing how to write a simple assembly program in several UNIX operating systems on the IA-32 (i386) platform. Included material may or may not be applicable to other hardware and/or software platforms.
This document explains program layout, system call convention, and the build process.
It accompanies the Linux Assembly HOWTO, which may also be of interest, though it is more Linux specific.
Table of Contents
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License Version 1.1; with no Invariant Sections, with no Front-Cover Texts, and no Back-Cover texts.
The latest version of this document is available from http://asm.sourceforge.net/intro.html If you are reading a few-months-old copy, please check the url above for a new version.
You will need several tools to play with programs included in this tutorial.
First of all you need the assembler (compiler). As a rule modern UNIX distributions include as (or gas), but all of the examples here use another assembler -- nasm (Netwide Assembler). It comes with full source code, and you can download it from the nasm page, or install it from the ports (or package) system. Compile it, or try to find precompiled binary for your OS; note that several distributions (at least Linux ones) already have nasm, check first.
Second, you need a linker -- ld, since assembler produces only object code. All distributions with the compilation tools installed will have ld.
If you're going to dig in, you should also install include files for your OS, and if possible, kernel source.
Now you should be ready to start, welcome..