PDA

View Full Version : assembly


Slurm
March 8th, 2006, 08:16 PM
Just curious,

What does one use assembly language for? Everything I read has about it discourages one to attempt to use it.

Nord
March 8th, 2006, 08:33 PM
Assembly language is used for speed and compactness and requires an intimate knowledge of the architecture of your computer and its microprocessor.

It is useful in embedded applications.

Nord

rplantz
March 8th, 2006, 09:21 PM
Just curious,

What does one use assembly language for? Everything I read has about it discourages one to attempt to use it.

I have written a textbook intended for a sophomore-level college class on assembly language. I taught such a class for over 20 years. Here's what I say in my preface about learning assembly language:

I have followed two basic criteria in creating this book:
• I believe that you should avoid writing in assembly language except when absolutely
necessary, and
• I wanted to teach the material in a Linux environment.
It may seem strange that I would recommend against assembly language programming
in a book devoted to the subject. Well, C was introduced in 1978 specifically for low-level
programming. C code is much easier to write and to maintain than assembly language. C
compilers have evolved to a point where they produce better machine code than all but
the best assembly language programmers can. In addition, the hardware technology has
increased such that there is seldom any significant advantage in writing the most efficient
machine code. In short, it is hardly ever worth the effort to write in assembly language.
You might well ask why I think you should study assembly language, given that I think
you should avoid writing in it. I believe very strongly that the best programmers have a
good understanding of how computer hardware works. I think this principle holds in most
fields: the best drivers understand how automobiles work; the best musicians understand
how their instrument works; etc.
The goal of this book is to introduce how computer hardware works from a programmer‘s
point of view. A programmer‘s job is to design a sequence of instructions that will cause
the hardware to perform operations that solve a problem. We will look at these instructions
by exploring how C/C++ language constructs are implemented at the instruction set level.
This is not a book on how to write programs in assembly language. You will write most
of the programs here is assembly language, but they are very simple programs intended to
illustrate the concepts. We will cover only a small subset of the available instructions. If
you do decide to write real-world programs in assembly language, there are several other
excellent books on that topic; see the Bibliography on page 317. And, of course, you will
want Intel’s manuals; see [7] – [10]. The goal here is to provide you with your first “look
under the hood.”