Copyright notice
Contents
List of Figures
List of Tables
Listings
Preface
Preface
 Assumed Background
 Additional Resources
 Learning from this Book
 Development Environment
 Organization of the Book
 Suggested Usage
 Production of the Book
 Acknowledgements
1 Introduction
 1.1 Computer Subsystems
 1.2 How the Subsystems Interact
2 Data Storage Formats
 2.1 Bits and Groups of Bits
 2.2 Mathematical Equivalence of Binary and Decimal
 2.3 Unsigned Decimal to Binary Conversion
 2.4 Memory — A Place to Store Data (and Other Things)
 2.5 Using C Programs to Explore Data Formats
 2.6 Examining Memory With gdb
 2.7 ASCII Character Code
 2.8 write and read Functions
 2.9 Exercises
3 Computer Arithmetic
 3.1 Addition and Subtraction
 3.2 Arithmetic Errors — Unsigned Integers
 3.3 Arithmetic Errors — Signed Integers
 3.4 Overflow and Signed Decimal Integers
 3.5 C/C++ Basic Data Types
 3.6 Other Codes
 3.7 Exercises
4 Logic Gates
 4.1 Boolean Algebra
 4.2 Canonical (Standard) Forms
 4.3 Boolean Function Minimization
 4.4 Crash Course in Electronics
 4.5 NAND and NOR Gates
 4.6 Exercises
5 Logic Circuits
 5.1 Combinational Logic Circuits
 5.2 Programmable Logic Devices
 5.3 Sequential Logic Circuits
 5.4 Designing Sequential Circuits
 5.5 Memory Organization
 5.6 Exercises
6 Central Processing Unit
 6.1 CPU Overview
 6.2 CPU Registers
 6.3 CPU Interaction with Memory and I/O
 6.4 Program Execution in the CPU
 6.5 Using gdb to View the CPU Registers
 6.6 Exercises
7 Programming in Assembly Language
 7.1 Creating a New Program
 7.2 Program Organization
 7.3 Assemblers and Linkers
 7.4 Creating a Program in Assembly Language
 7.5 Instructions Introduced Thus Far
 7.6 Exercises
8 Program Data – Input, Store, Output
 8.1 Calling write in 64-bit Mode
 8.2 Introduction to the Call Stack
 8.3 Viewing the Call Stack
 8.4 Local Variables on the Call Stack
 8.5 Designing the Local Variable Portion of the Call Stack
 8.6 Using syscall to Perform I/O
 8.7 Calling Functions, 32-Bit Mode
 8.8 Instructions Introduced Thus Far
 8.9 Exercises
9 Computer Operations
 9.1 The Assignment Operator
 9.2 Addition and Subtraction Operators
 9.3 Introduction to Machine Code
 9.4 Instructions Introduced Thus Far
 9.5 Exercises
10 Program Flow Constructs
 10.1 Repetition
 10.2 Binary Decisions
 10.3 Instructions Introduced Thus Far
 10.4 Exercises
11 Writing Your Own Functions
 11.1 Overview of Passing Arguments
 11.2 More Than Six Arguments, 64-Bit Mode
 11.3 Interface Between Functions, 32-Bit Mode
 11.4 Instructions Introduced Thus Far
 11.5 Exercises
12 Bit Operations; Multiplication and Division
 12.1 Logical Operators
 12.2 Shifting Bits
 12.3 Multiplication
 12.4 Division
 12.5 Negating Signed ints
 12.6 Instructions Introduced Thus Far
 12.7 Exercises
13 Data Structures
 13.1 Arrays
 13.2 structs (Records)
 13.3 structs as Function Arguments
 13.4 Structs as C++ Objects
 13.5 Instructions Introduced Thus Far
 13.6 Exercises
14 Fractional Numbers
 14.1 Fractions in Binary
 14.2 Fixed Point ints
 14.3 Floating Point Format
 14.4 IEEE 754
 14.5 Floating Point Hardware
 14.6 Comments About Numerical Accuracy
 14.7 Instructions Introduced Thus Far
 14.8 Exercises
15 Interrupts and Exceptions
 15.1 Hardware Interrupts
 15.2 Exceptions
 15.3 Software Interrupts
 15.4 CPU Response to an Interrupt or Exception
 15.5 Return from Interrupt/Exception
 15.6 The syscall and sysret Instructions
 15.7 Summary
 15.8 Instructions Introduced Thus Far
 15.9 Exercises
16 Input/Output
 16.1 Memory Timing
 16.2 I/O Device Timing
 16.3 Bus Timing
 16.4 I/O Interfacing
 16.5 I/O Ports
 16.6 Programming Issues
 16.7 Interrupt-Driven I/O
 16.8 I/O Instructions
 16.9 Exercises
A Reference Material
 A.1 Basic Logic Gates
 A.2 Register Names
 A.3 Argument Order in Registers
 A.4 Register Usage
 A.5 Assembly Language Instructions Used in This Book
 A.6 Addressing Modes
B Using GNU make to Build Programs
C Using the gdb Debugger for Assembly Language
D Embedding Assembly Code in a C Function
E Exercise Solutions
 E.2 Data Storage Formats
 E.3 Computer Arithmetic
 E.4 Logic Gates
 E.5 Logic Circuits
 E.6 Central Processing Unit
 E.7 Programming in Assembly Language
 E.8 Program Data – Input, Store, Output
 E.9 Computer Operations
 E.10 Program Flow Constructs
 E.11 Writing Your Own Functions
 E.12 Bit Operations; Multiplication and Division
 E.13 Data Structures
 E.14 Fractional Numbers
 E.15 Interrupts and Exceptions
Bibliography
Bibliography
Index
Index

Copyright notice

Copyright ©2008, ©2009, ©2010, ©2011, ©2012, ©2013, ©2015, ©2019 by Robert G. Plantz. All rights reserved.

The author has used his best efforts in preparing this book. The author makes no warranty of any kind, expressed or implied, with regard to the programs or the documentation contained in this book. The author shall not be liable in any event from incidental or consequential damages in connection with, or arising out of, the furnishing, performance, or use of these programs.

All products or services mentioned in this book are the trademarks or service marks of their respective companies or organizations. Eclipse is a trademark of Eclipse Foundation, Inc.