Skip to Main Content
Professional Assembly Language
book

Professional Assembly Language

by Richard Blum
February 2005
Intermediate to advanced content levelIntermediate to advanced
574 pages
13h 18m
English
Wrox
Content preview from Professional Assembly Language

Chapter 13. Using Inline Assembly

Now that you know the basics of assembly language programming, it's time to start putting those concepts to practical use. One very common use of assembly language programming is to code assembly functions within higher-level languages, such as C and C++. There are a couple of different ways to do this. This chapter describes how to place assembly language functions directly within C and C++ language programs. This technique is called inline assembly.

The chapter begins by describing how C and C++ programs use functions, and how the functions are converted to assembly language code by the compiler. Next, the basic inline assembly format is discussed, including how to incorporate simple assembly functions. After that, the extended inline assembly format is described. This format enables you to incorporate more complex assembly language functions within the C or C++ programs. Finally, the chapter explains how to define macros using complex inline assembly language functions within C programs.

What Is Inline Assembly?

In a standard C or C++ program, code is entered in the C or C++ syntax in a text source code file. The source code file is then compiled into assembly language code using the compiler. After that step, the assembly language code is linked with any required libraries to produce an executable program (see Chapter 3, "The Tools of the Trade").

In the Linux world, the GNU compiler (gcc) is used to create the executable program from the text source ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Introduction to 80x86 Assembly Language and Computer Architecture, 2nd Edition

Introduction to 80x86 Assembly Language and Computer Architecture, 2nd Edition

Richard C. Detmer

Publisher Resources

ISBN: 9780764579011Purchase book