Why Learn Assembly Language?
Programming in assembly language is a tedious and error-prone process. The
natural preference of a programmer is to program the application in some high-
level language. However, there are some good reasons why some applications
cannot be programmed in a high-level language. Even the applications that
require coding in assembly language do not require the whole program to be
written in assembly language. In such instances, part of the program can be
written in assembly language and the rest can be written in some high-level
language. Such programs are referred to as hybrid programs or mixed-mode
programs. Very often, programs that require assembly language are actually
hybrid programs. In Chapter 13, we will discuss how you can write hybrid
programs.
Learning assembly language has both practical and educational purposes.
Even if you do not plan to write in an assembly language, studying it provides
a good understanding of computer systems. When you program in a high
level language such as C, you are shielded from low-level details on purpose
and provided only a "black-box" view of the system. When programming in
assembly language, you need to understand the internal details of the system
(how data is stored, how code can be made time-efficient, and so on). To
understand assembly language is to understand the computer system itself!
This book uses the PC to explore these internal details. The reason for this
is that PCs are popular and their architecture encompasses several important
characteristics to provide a good understanding of some fundamental concepts,
yet simple enough to provide a gentle introduction to computers beyond the
black-box view.
A final reason to learn assembly language is the personal satisfaction that
comes with learning something complex. Sure, leaning assembly language
is more difficult than learming C. But assembly language gives you complete
control over the system hardware. It is very easy to write a simple program
in assembly language that can crash the system. Try to achieve the same with
a high-level language! You feel powerful with assembly language on your
side, making the time spent learning assembly language worth your while. The
insights provided by assembly language would benefit you even when you are
programming in some high-level language.