Guide to Assembly Language Programming in Linux

Chapter 11: Writing Procedures

Overview

The last two chapters introduced the basics of the assembly language. Here we discuss how procedures are written in the assembly language. Procedure is an important programming construct that facilitates modular programming. In the IA-32 architecture, the stack plays an important role in procedure invocation and execution. We start this chapter by giving details on the stack, its uses, and how it is implemented. We also describe the assembly language instructions to manipulate the stack.

After this introduction to the stack, we look at the assembly language instructions for procedure invocation and return. Unlike high-level languages, there is not much support in the assembly language. For example, we cannot include the arguments in the procedure call. Thus parameter passing is more involved than in high-level languages. There are two parameter passing methods one uses the registers and the other the stack. We discuss these two parameter passing methods in detail. The last section provides a summary of the chapter.

Introduction

A procedure is a logically self-contained unit of code designed to perform a particular task. These are sometimes referred to as subprograms and play an important role in modular program development. In high-level languages, there are two types of subprograms: procedures and functions. A function receives a list of arguments and performs a computation based on the arguments passed onto it and returns a single value. In this sense, these functions are very similar to the mathematical functions.

Procedures also receive a list of arguments just as...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Programmable Logic Controllers (PLC)
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.