Skip to main content
Engineering LibreTexts

1.1: What this textbook is about

  • Page ID
    76093
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    This book intends to be a first book for students and other readers interested in assembly language; it is intended to take the user from soup to nuts in that it will show how to build their first ARM assembly language program and take them all the way until they understand enough about ARM assembly to be able to continue the study of assembly on their own. This makes it an appropriate textbook for either a primary textbook in an ARM assembly language class, as a secondary or supplemental textbook for a class on Computer Organization, or any number of other classes where a basic knowledge of assembly language is useful but not part of the core material, such as a class in Computer Architecture, Operating Systems, Computer Security, Compilers, Reverse Engineering, etc.

    This textbook is written so the concepts taught are generally applicable to any assembly language, but since assembly languages are so different, it is important to note that this textbook is specifically about the ARM assembly language. And since assembly language exposes the Central Processing Unit (CPU) architecture, the architecture that will be discussed will be a simplified version of the ARM architecture that this textbook will call the Multi-Stage CPU (MSCPU). Note that all of the ARM assembly operations presented in this book are correct, though just a subset of the entire ARM assembly operations and formats. Likewise, the MSCPU represents a working subset of the ARM CPU and is not intended to implement a complete ARM CPU design. It is an illustrative model of a non-existent CPU, but a CPU that allows the assembly language to be implemented and explained in a working Logisim implemented model for the CPU.

    This textbook is designed to be used as part of a Computer Organization class, or as a supplement for a course where students need to know assembly but the teaching of assembly is not intended to be a significant part of the class. For many students and programmers, this will be their only exposure to assembly language and the underlying hardware it represents, so it is important that this textbook not teach just the instructions, but to fill in the gap for these readers between a high level language (HLL) and the computer that will run the program.

    So, while assembly language and low level hardware concepts are the main thrust of this textbook, the effect of these concepts and principals in HLL such as Java, Python, and C/C++ will also be an emphasized. It will cover a number of general computer science concepts such as:

    1. The difference between values and references (pointers). The book will also highlight the difference between reference types and value types. These concepts are important in all HLL and often not well understood by students studying CS. This lack of understanding possibly comes from both values and references being values in a HLL, muddying the distinction between the two types of access. Assembly language directly accesses the data on a computer, exposing the difference between a reference and value and requires the user to consider this difference when accessing the data. This makes assembly language the perfect language for teaching these concepts.
    2. Program memory types and the difference segments of memory. These include the static or bss (data) segment, text (instruction) segment, heap segment, and stack memory. Proper understanding of these segments affects HLL in many areas including a correct understanding of program scoping and lifetime, program safety (correctness), concurrent execution of a program, among a myriad of other issues that often result in program errors that are difficult to understand and find.
    3. Translation of the HLL to assembly language and a basic understanding of how the assembly language is executed in hardware. This allows the programmer to see their programs in the broader context of how a computer works, not simply the abstract model of the HLL in which the program is written.
    4. Interfacing between C/C++ and assembly language. This is important to many programmers because most of the programs users will write for the ARM chip will be largely written in a HLL, with small, critical pieces in of the program in assembly. In addition, there are useful tools in C/C++ that will be accessed in this textbook from the earliest chapters. Therefore, it is important to know how to communicate between C/C++ and assembly.
    5. Translating assembly code to machine code. The reason this is included is every useful program must be translated into a format that the CPU can understand. The CPU can understand only machine code, which is assembly code translated into a code of 0’s and 1’s that the CPU can understand. This machine code format will help the user understand how the program is instantiated on the CPU.
    6. Programming plans and how they lead to properly structured code. Programming plans, or cognitive schema that are instantiated in structure code blocks in programs, are important for programming in any language. Many students have issues of program structure through much of their academic studies. This book will emphasize how to properly structure code and enforce that structure in assembly language, a language that always is tempting you to break rules to ill effects.
    7. The use of the program stack to implement program abstraction and recursion. Stack are a part of most modern computer languages, and to understand their implementation helps programmers to understand their proper usage. Further, recursion is a central component to many algorithms and data structures, and by presenting how recursion is implemented at the assembly level the reader will hopefully gain a larger insight into the principal.
    8. How different types of data are stored, with an emphasis on dereferencing operations using an array and struct and implementation of C-type null terminated arrays.
    9. The steps needed to produce a program, specifically the compile (or assemble), link, and execute steps. What is done in each step and the output produced will be discussed. Finally, tools such as objdump and readelf will be covered to help students understand the structure of an executable file and how it relates to assembly language programs.

    The target audience for this textbook is someone who has had at least one semester of programming in a HLL, but who has never programmed in assembly language and wants to know how assembly works and what happens to a program written in a HLL to allow it to run directly on a CPU. As such, it will fill a gap that exists for students who intend to study topics such as Operating System or Computer Architecture.Finally, tools such as objdump and readelf will be covered to help students understand the structure of an executable file and how it relates to assembly language programs.

    In addition, but knowing how a CPU works, a programmer can understand how the CPU fits into the overall implementation of a program or larger system architecture. Knowing assembly creates better programmers and designers.

    It is also important to point out what this textbook is not. This textbook is not intended to cover all the relevant information for someone who is implementing a program in ARM assembly. For example, it does not cover floating point operations, Thumb or 64-bit ARM assembly, or how to access General Purpose Input/Output (GPIO) ports. While these are important, they do not fit into the statement of purpose for this textbook.


    This page titled 1.1: What this textbook is about is shared under a CC BY 4.0 license and was authored, remixed, and/or curated by Charles W. Kann III via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.

    • Was this article helpful?