1st Edition

X86 Assembly Language and C Fundamentals

By Joseph Cavanagh Copyright 2013
    814 Pages 337 B/W Illustrations
    by CRC Press

    The predominant language used in embedded microprocessors, assembly language lets you write programs that are typically faster and more compact than programs written in a high-level language and provide greater control over the program applications. Focusing on the languages used in X86 microprocessors, X86 Assembly Language and C Fundamentals explains how to write programs in the X86 assembly language, the C programming language, and X86 assembly language modules embedded in a C program. A wealth of program design examples, including the complete code and outputs, help you grasp the concepts more easily. Where needed, the book also details the theory behind the design.

    Learn the X86 Microprocessor Architecture and Commonly Used Instructions

    Assembly language programming requires knowledge of number representations, as well as the architecture of the computer on which the language is being used. After covering the binary, octal, decimal, and hexadecimal number systems, the book presents the general architecture of the X86 microprocessor, individual addressing modes, stack operations, procedures, arrays, macros, and input/output operations. It highlights the most commonly used X86 assembly language instructions, including data transfer, branching and looping, logic, shift and rotate, and string instructions, as well as fixed-point, binary-coded decimal (BCD), and floating-point arithmetic instructions.

    Get a Solid Foundation in a Language Commonly Used in Digital Hardware

    Written for students in computer science and electrical, computer, and software engineering, the book assumes a basic background in C programming, digital logic design, and computer architecture. Designed as a tutorial, this comprehensive and self-contained text offers a solid foundation in assembly language for anyone working with the design of digital hardware.

    Number Systems and Number Representations
    Number Systems
    Number Representations
    Problems

    X86 Processor Architecture
    General Architecture
    Arithmetic and Logic Unit
    Control Unit
    Memory Unit
    Input/Output
    Register Set
    Translation Lookaside Buffer
    The Assembler
    Problems

    Addressing Modes
    Register Addressing
    Immediate Addressing
    Direct Memory Addressing
    Base (Register Indirect) Memory Addressing
    Base or Index Plus Displacement Addressing
    Base and Index Plus Displacement Addressing
    Scale Factor
    Segment Override Prefix
    X86 Operation Modes
    Problems

    C Programming Fundamentals
    Structure of a C Program
    Variables and Constants
    Input and Output
    Operators
    While Loop
    For Loop
    Additional C Constructs
    Problems

    Data Transfer Instructions
    Data Types
    Move Instructions
    Load Effective Address
    Load Segment Registers
    Exchange Instructions
    Translate
    Conversion Instructions
    Problems

    Branching and Looping Instructions
    Branching Instructions
    Looping Instructions
    Problems

    Stack Operations
    Stack Structure
    Additional Push Instructions
    Additional Pop Instructions
    Problems

    Logic, Bit, Shift, and Rotate Instructions
    Logical AND Instruction
    Logical Inclusive-OR Instruction
    Logical Exclusive-OR Instruction
    Logical NOT Instruction — 1s Complement
    NEG Instruction — 2s Complement
    TEST and Byte Set on Condition Instructions
    Bit Test Instructions
    Bit Scan Instructions
    Shift Instructions
    Rotate Instructions
    Problems

    Fixed-Point Arithmetic Instructions
    Addition
    Subtraction
    Multiplication
    Division
    Problems

    Binary-Coded Decimal Arithmetic Instructions
    ASCII Adjust After Addition (AAA) Instruction
    Decimal Adjust AL After Addition (DAA) Instruction
    ASCII Adjust AL After Subtraction (AAS) Instruction
    Decimal Adjust AL After Subtraction (DAS) Instruction
    ASCII Adjust AX After Multiplication (AAM) Instruction
    ASCII Adjust AX Before Division (AAD) Instruction
    Problems

    Floating-Point Arithmetic Instructions
    Floating-Point Fundamentals
    Load Data Instructions
    Store Data Instructions
    Addition Instructions
    Subtraction Instructions
    Multiplication Instructions
    Division Instructions
    Compare Instructions
    Trigonometric Instructions
    Additional Instructions
    Problems

    Procedures
    Call a Procedure
    Return from a Procedure
    Passing Parameters to a Procedure
    Problems

    String Instructions
    Repeat Prefixes
    Move String Instructions
    Load String Instructions
    Store String Instructions
    Compare Strings Instructions
    Scan String Instructions
    Problems

    Arrays
    One-Dimensional Arrays
    Multidimensional Arrays
    Problems

    Macros
    Macro Definitions
    Macro Examples
    Problems

    Interrupts and Input/Output Operations
    Interrupts
    Direct Memory Access
    Memory-Mapped I/O
    In/Out Instructions
    Problems

    Additional Programming Examples
    Programming Examples
    Problems

    Appendix A ASCII Character Codes

    Appendix B Answers to Select Problems

    Index

    Biography

    Joseph Cavanagh is an adjunct professor in the computer engineering department at Santa Clara University in California. He is the author of several textbooks, including Computer Arithmetic and Verilog HDL Fundamentals (2009), Digital Design and Verilog HDL Fundamentals (2008), Verilog HDL: Digital Design and Modeling (2007), and Sequential Logic: Analysis and Synthesis (2006), as well as a novel, The Computer Conspiracy.