Skip to main content
Top

2020 | Book

Guide to Assembly Language

A Concise Introduction

insite
SEARCH

About this book

This concise guide is designed to enable the reader to learn how to program in assembly language as quickly as possible. Through a hands-on programming approach, readers will also learn about the architecture of the Intel processor, and the relationship between high-level and low-level languages.

This updated second edition has been expanded with additional exercises, and enhanced with new material on floating-point numbers and 64-bit processing.

Topics and features: provides guidance on simplified register usage, simplified input/output using C-like statements, and the use of high-level control structures; describes the implementation of control structures, without the use of high-level structures, and often with related C program code; illustrates concepts with one or more complete program; presents review summaries in each chapter, together with a variety of exercises, from short-answer questions to programming assignments; covers selection and iteration structures, logic, shift, arithmetic shift, rotate, and stack instructions, procedures and macros, arrays, and strings; includes an introduction to floating-point instructions and 64-bit processing; examines machine language from a discovery perspective, introducing the principles of computer organization.

A must-have resource for undergraduate students seeking to learn the fundamentals necessary to begin writing logically correct programs in a minimal amount of time, this work will serve as an ideal textbook for an assembly language course, or as a supplementary text for courses on computer organization and architecture. The presentation assumes prior knowledge of the basics of programming in a high-level language such as C, C++, or Java.

Table of Contents

Frontmatter
1. Variables, Registers, and Data Movement
Abstract
High-level languages, such as C, C++, and Java, have similarities with natural languages which help make programs easier to read and write whereas low-level languages are closer to the machine and offer a look at the machine organization and architecture. There is a one-to-many relationship between high-level languages and low-level languages, where language translators such as compilers and interpreters convert each high-level instruction into many low-level instructions. The native language of a particular machine is a low-level language known as machine language and is coded in ones and zeros. Further, the machine language of an Intel microprocessor is different than that of other microprocessors or mainframes, thus machine language is not transferable from one type of machine to another.
James T. Streib
2. Input/Output
Abstract
As mentioned in Chap. 1, input and output (I/O) in assembly language can be quite difficult and complicated. Although the exploration of I/O at the assembly language level is a subject worthy of study, it often times gets in the way of many of the other important topics and reasons for studying assembly language. The result is that it is helpful to have a simplified form of input/output.
James T. Streib
Chapter 3. Arithmetic Instructions
Abstract
After learning how to load a register, transfer data between memory locations, and perform I/O, the next step is to learn how to perform various arithmetic operations. One of the simplest ways to learn how to perform arithmetic in assembly language is to first write the equation as a high-level statement.
James T. Streib
4. Selection Structures
Abstract
As one should have learned in Computer Science I, there are two basic types of control structures available regardless of the language used. These two types of control structures are selection structures and iteration structures, also commonly known as ifs and loops.
James T. Streib
5. Iteration Structures
Abstract
As should be recalled from previous courses, there are many different types of iteration structures available to a programmer in a high-level programming language.
James T. Streib
6. Logic, Shifting, Rotating, and Stacks
Abstract
However, some-times it is necessary to not just compare the contents of variables or registers but check the individual bits within a memory location or a register.
James T. Streib
7. Procedures and Macros
Abstract
This chapter will first show the reader how procedures are implemented in assembly language. The implementation of macros is introduced next which is probably a new topic to most readers. Both procedures and macros are tools that allow programmers to save time by not having to rekey the same code over and over again, but there are important differences between the two mechanisms. The chapter then continues with the introduction of conditional assembly which can be a difficult concept for new assembly language programmers. Lastly, this chapter shows the beginning of the implementation of what might be called a macro calculator which simulates a one register (accumulator) computer.
James T. Streib
8. Arrays
Abstract
Up until this point, arrays have not been needed in the examples shown. However, this chapter will introduce the declaration of arrays, array access, indexing arrays, and how to input, process, and output arrays. Although there are many ways one can index an array, this text will present only two of them.
James T. Streib
9. Strings
Abstract
This chapter concerns string processing. Specifically it examines various string processing instructions that are available in MASM. Continuing on with the last chapter, it also examines the manipulation of arrays of strings.
James T. Streib
10. Floating-Point Instructions
Abstract
This chapter introduces the fundamentals of floating-point instructions. This includes registers, memory storage, input/output, the instructions needed to perform arithmetic, and basic control structures. In order to learn the concepts in this chapter one should understand how floating-point numbers are represented in memory from a computer organization class or text. Alternatively, one can review or learn the basic concepts needed as presented in Appendix B.7 of this text. Also, one should have knowledge of stacks usually discussed in a second semester computer science course or text such as Guide to Data Structures [3].
James T. Streib
11. 64-Bit Processing
Abstract
To store larger 64-bit numbers in a high-level language such as Java, variables are declared as long, or in the C programming language long long is used. In assembly language a quad word, qword, or signed quad word, sqword, is used. Just as a 32-bit double word is twice as big as a regular 16-bit word, a 64-bit quad word is two times larger than a 32-bit double word or four times larger than a 16-bit word, thus the name quad word.
James T. Streib
12. Selected Machine Language Instructions
Abstract
The purpose of this chapter is to help draw further connections between assembly language and computer organization. The advantage of using assembly language is that one can see computer organization from a software perspective. Further, by examining machine language one can see some of the principles discussed in a computer organization text. It is especially helpful to see these principles implemented in a real machine language.
James T. Streib
Backmatter
Metadata
Title
Guide to Assembly Language
Author
Prof. James T. Streib
Copyright Year
2020
Electronic ISBN
978-3-030-35639-2
Print ISBN
978-3-030-35638-5
DOI
https://doi.org/10.1007/978-3-030-35639-2

Premium Partner