Page 22 - ARM 64 Bit Assembly Language
P. 22
Introduction 5
Without first learning assembly language, it is impossible to learn advanced concepts such
as microcode, pipelining, instruction scheduling, out-of-order execution, threading, branch
prediction, and speculative execution. There are many other concepts dealing with operating
systems and computer architecture, which require some understanding of assembly language.
The best programmers understand why some language constructs perform better than others,
how to reduce cache misses, and how to prevent buffer overruns that destroy security.
Every program is meant to run on a real machine. Even though there are many languages,
compilers, virtual machines, and operating systems to enable the programmer to use the ma-
chine more conveniently, the strengths and weaknesses of that machine still determine what
is easy and what is hard. Learning assembly is a fundamental part of understanding enough
about the machine to make informed choices about how to write efficient programs, even
when writing in a high-level language.
As an analogy, most people do not need to know a lot about how an internal combustion
engine works in order to operate an automobile. A race car driver needs a much better un-
derstanding of exactly what happens when he or she steps on the accelerator pedal, in order to
be able to judge precisely when (and how hard) to do so. Also, who would trust their car to a
mechanic who could not tell the difference between a spark plug and a brake caliper? Worse
still, should we trust an engineer to build a car without that knowledge? Even in this day of
computerized cars, someone needs to know the gritty details, and they are paid well for that
knowledge. Knowledge of assembly language is one of the things that defines the computer
scientist and engineer.
When learning assembly language, the specific instruction set is not critically important, be-
cause what is really being learned is the fine detail of how a typical stored-program machine
uses different storage locations and logic operations to convert a string of bits into a mean-
ingful calculation. However, when it comes to learning assembly languages, some processors
make it more difficult than it needs to be. Because some processors have an instruction set is
extremely irregular, non-orthogonal, large, and poorly designed, they are not a good choice
for learning assembly. The author feels that teaching students their first assembly language
on one of those processors should be considered a crime, or at least a form of mental abuse.
Luckily, there are processors that are readily available, low-cost, and relatively easy to learn
assembly with. This book uses one of them as the model for assembly language.
1.2 The ARM processor
In the late 1970’s, the microcomputer industry was a fierce battleground, with several compa-
nies competing to sell computers to small business and home users. One of those companies,
based in the United Kingdom, was Acorn Computers Ltd. Acorn’s flagship product, the BBC