Guide to Assembly Language Programming in Linux

In this chapter, we introduce the necessary mechanisms to write and execute assembly language programs. We begin by taking a look at the structure of assembly language programs we use in this book. To make the task of writing assembly language programs easier, we provide a simple template to structure the stand-alone assembly language programs used in this book.
Unlike the high-level languages, assembly language does not provide a convenient mechanism to do input and output. To overcome this deficiency, we have developed a set of I/O routines to facilitate character, string, and numeric input and output. These routines are described after introducing the assembly language template.
Once we have written an assembly language program, we have to transform it into its executable form. Typically, this takes two steps: we use an assembler to translate the source program into what is called an object program and then use a linker to transform the object program into an executable version. We give details of these steps in the "Assembling and Linking" section. However, this section uses an assembly language program example. Since we have not yet discussed the assembly language, you may want to skip this section on the first reading and come back to it after you have read Chapters 9 and 10, which provide an overview of the assembly language.
Writing an assembly language program is a complicated task, particularly for a beginner.