SlideShare a Scribd company logo
Assembly Language For X86 Processors 8th Edition
Kip R Irvine download
https://ebookbell.com/product/assembly-language-
for-x86-processors-8th-edition-kip-r-irvine-57018230
Explore and download more ebooks at ebookbell.com
Here are some recommended products that we believe you will be
interested in. You can click the link to download.
Assembly Language For X86 Processors Seventh Edition Irvine Kip R
https://ebookbell.com/product/assembly-language-for-x86-processors-
seventh-edition-irvine-kip-r-22041816
Assembly Language For X86 Processors 6th Edition 6th Kip Irvine
https://ebookbell.com/product/assembly-language-
for-x86-processors-6th-edition-6th-kip-irvine-2540012
Assembly Language For X86 Processors Eigth Edition 8th Kip R Irvine
https://ebookbell.com/product/assembly-language-for-x86-processors-
eigth-edition-8th-kip-r-irvine-11749486
Assembly Language For X86 Processors 6th Edition 6th Kip Irvine
https://ebookbell.com/product/assembly-language-
for-x86-processors-6th-edition-6th-kip-irvine-55389064
Assembly Language For Intelbased Computers 5th Edition China Reprint
5th Edition Irvine
https://ebookbell.com/product/assembly-language-for-intelbased-
computers-5th-edition-china-reprint-5th-edition-irvine-31426294
Assembly Language For Intelbased Computers 4th Edition Kip R Irvine
https://ebookbell.com/product/assembly-language-for-intelbased-
computers-4th-edition-kip-r-irvine-1021014
Assembly Language For Beginners Itebooks
https://ebookbell.com/product/assembly-language-for-beginners-
itebooks-23836018
Assembly Language For Intelbased Computers 4th Edition Kiprirvine
https://ebookbell.com/product/assembly-language-for-intelbased-
computers-4th-edition-kiprirvine-1021012
Assembly Programming Language For Beginners Learn Assembly Programming
Language Panchtilak
https://ebookbell.com/product/assembly-programming-language-for-
beginners-learn-assembly-programming-language-panchtilak-56519696
Assembly Language For X86 Processors 8th Edition Kip R Irvine
Assembly Language For X86 Processors 8th Edition Kip R Irvine
Senior Vice President Courseware Portfolio Management: Marcia J.
Horton
Vice President, Portfolio Management: Engineering, Computer Science &
Global Editions: Julian Partridge
Executive Portfolio Manager: Tracy Johnson
Portfolio Management Assistant: Meghan Jacoby
Product Marketing Manager: Yvonne Vannatta
Field Marketing Manager: Demetrius Hall
Marketing Assistant: Jon Bryant
Managing Content Producer: Scott Disanno
Content Producer: Amanda Brands
Manufacturing Buyer, Higher Ed, Lake Side Communications, Inc. (LSC):
Maura Zaldivar-Garcia
Inventory Manager: Bruce Boundy
Rights and Permissions Manager: Ben Ferrini
Full-Service Project Management: Vanitha Puela, SPi Global
Cover Image: Tetra Images/Alamy Stock Photo
Printer/Binder: LSC Communications, Inc.
IA-32, Pentium, i486, Intel64, Celeron, and Intel 386 are trademarks of
Intel Corporation. Athlon, Phenom, and Opteron are trademarks of
Advanced Micro Devices. TASM and Turbo Debugger are trademarks of
Borland International. Microsoft Assembler (MASM), Windows Vista,
Windows 7, Windows NT, Windows Me, Windows 95, Windows 98,
Windows 2000, Windows XP, MS-Windows, PowerPoint, Win32,
DEBUG, WinDbg, MS-DOS, Visual Studio, Visual C++, and CodeView are
registered trademarks of Microsoft Corporation. Autocad is a trademark
of Autodesk. Java is a trademark of Sun Microsystems. PartitionMagic is a
trademark of Symantec. All other trademarks or product names are the
property of their respective owners.
Copyright © 2020, 2015, 2011, 2007, 2003 by Pearson Inc. 221 River
Street, Hoboken, NJ 07030. All rights reserved. Manufactured in the
United States of America. This publication is protected by Copyright and
permissions should be obtained from the publisher prior to any
prohibited reproduction, storage in a retrieval system, or transmission in
any form or by any means, electronic, mechanical, photocopying,
recording, or likewise. To obtain permission(s) to use materials from this
work, please visit http://www.pearsoned.com/permissions/.
Previously published as Assembly Language for Intel-Based Computers.
The author and publisher of this book have used their best efforts in
preparing this book. These efforts include the development, research, and
testing of the theories and programs to determine their effectiveness. The
author and publisher make no warranty of any kind, expressed or
implied, with regard to these programs or the documentation contained
in this book. The author and publisher shall not be liable in any event for
incidental or consequential damages in connection with, or arising out of,
the furnishing, performance, or use of these programs.
Microsoft and/or its respective suppliers make no representations about
the suitability of the information contained in the documents and related
graphics published as part of the services for any purpose. All such
documents and related graphics are provided “as is” without warranty of
any kind. Microsoft and/or its respective suppliers hereby disclaim all
warranties and conditions with regard to this information, including all
warranties and conditions of merchantability, whether express, implied or
statutory, fitness for a particular purpose, title and non-infringement. In
no event shall microsoft and/or its respective suppliers be liable for any
special, indirect or consequential damages or any damages whatsoever
resulting from loss of use, data or profits, whether in an action of
contract, negligence or other tortious action, arising out of or in
connection with the use or performance of information available from the
services. The documents and related graphics contained herein could
include technical inaccuracies or typographical errors. changes are
periodically added to the information herein. Microsoft and/or its
respective suppliers may make improvements and/or changes in the
product(s) and/or the program(s) described herein at any time. Partial
screen shots may be viewed in full within the software version specified.
Microsoft® and Windows® are registered trademarks of the microsoft
corporation in the usa and other countries. screen shots and icons
reprinted with permission from the microsoft corporation. This book is
not sponsored or endorsed by or affiliated with the microsoft corporation.
1 19
ISBN-13: 978-0-13-538165-6
ISBN-10: 0-13-538165-7
Preface
Assembly Language for x86 Processors, Eighth Edition, teaches assembly
language programming and architecture for x86 and Intel64 processors. It
is an appropriate text for the following types of college courses:
Assembly Language Programming
Fundamentals of Computer Systems
Fundamentals of Computer Architecture
Students use Intel or AMD processors and program with Microsoft
Macro Assembler (MASM), running on recent versions of Microsoft
Windows. Although this book was originally designed as a programming
textbook for college students, it serves as an effective supplement to
computer architecture courses. As a testament to its popularity, previous
editions have been translated into numerous languages.
Emphasis of Topics
This edition includes topics that lead naturally into subsequent courses in
computer architecture, operating systems, and compiler writing:
Virtual machine concept
Instruction set architecture
Elementary Boolean operations
Instruction execution cycle
Memory access and handshaking
Interrupts and polling
Hardware-based I/O
Floating-point binary representation
Other topics relate specially to x86 and Intel64 architecture:
Protected memory and paging
Memory segmentation in real-address mode
16-Bit interrupt handling
MS-DOS and BIOS system calls (interrupts)
Floating-point unit architecture and programming
Instruction encoding
Certain examples presented in the book lend themselves to courses that
occur later in a computer science curriculum:
Searching and sorting algorithms
High-level language structures
Finite-state machines
Code optimization examples
What’s New in the Eighth Edition
This edition represents this book’s transition into the world of interactive
electronic textbooks. We’re very excited about this innovative concept,
because for the first time readers will be able to experiment and interact
with review questions, code animations, tutorial videos, and multiple-
input exercises.
All section reviews in the chapters have been rewritten as interactive
questions, giving the reader immediate feedback on their answers.
New questions were added, others removed, and many revised.
Code animations allow the reader to step through program code and
view both variable values and comments about the code. Readers no
longer have to visually jump back and forth between program code
and text explanations on the next page.
Links to timely tutorial videos have been inserted in the text, so
readers can receive tutoring on topics as they encounter them in the
text. Previously, readers would need to purchase a separate
subscription to gain access to the entire set of videos, presented as a
list. In this edition, videos are free.
Multiple-input exercises allow readers to browse a program listing
and insert variable values into boxes next to the code. They receive
immediate colorized feedback, giving them the opportunity to
experiment until all input values are correct.
Hypertexted definitions of key terms are placed throughout the text,
connected to an online glossary.
In short, we have taken the successful content of this book (refined
through many editions) and brought it into the interactive electronic
textbook world.
This book is still focused on its primary goal, to teach students how to
write and debug programs at the machine level. It will never replace a
complete book on computer architecture, but it does give students the
first-hand experience of writing software in an environment that teaches
them how a computer works. Our premise is that students retain
knowledge better when theory is combined with experience. In an
engineering course, students construct prototypes; in a computer
architecture course, students should write machine-level programs. In
both cases, they have a memorable experience that gives them confidence
to work in any OS/machine-oriented environment.
Protected mode programming is entirely the focus of chapters 1 through
13 . As such, students can create 32-bit and 64-bit programs that run
under the most recent versions of Microsoft Windows. The remaining
three legacy chapters cover 16-bit programming. These chapters cover


BIOS programming, MS-DOS services, keyboard and mouse input, dist
storage fundamentals, video programming, and graphics.
Subroutine Libraries
We supply three versions of the subroutine library that students use for
basic input/output, simulations, timing, and other useful tasks. The
Irvine32 and Irvine64 libraries run in protected mode. The 16-bit version
(Irvine16.lib) runs in real-address mode and is used only by Chapter 14
through Chapter 16 . Full source code for the libraries is supplied on the
companion website. The link libraries are available only for convenience,
not to prevent students from learning how to program input–output
themselves. Students are encouraged to create their own libraries.
Included Software and Examples
All the example programs were tested with Microsoft Macro Assembler,
running in a recent version of Microsoft Visual Studio. In addition, batch
files are supplied that permit students to assemble and run applications
from the Windows command prompt. Information Updates and
corrections to this book may be found at the Companion website,
including additional programming projects for instructors to assign at the
ends of chapters.
Overall Goals
The following goals of this book are designed to broaden the student’s
interest and knowledge in topics related to assembly language:
Intel and AMD processor architecture and programming
Real-address mode and protected mode programming


Assembly language directives, macros, operators, and program
structure
Programming methodology, showing how to use assembly language
to create system-level software tools and application programs
Computer hardware manipulation
Interaction between assembly language programs, the operating
system, and other application programs
One of our goals is to help students approach programming problems
with a machine-level mind set. It is important to think of the CPU as an
interactive tool, and to learn to monitor its operation as directly as
possible. A debugger is a programmer’s best friend, not only for catching
errors, but as an educational tool that teaches about the CPU and
operating system. We encourage students to look beneath the surface of
high-level languages and to realize that most programming languages are
designed to be portable and, therefore, independent of their host
machines. In addition to the short examples, this book contains hundreds
of ready-to-run programs that demonstrate instructions or ideas as they
are presented in the text. Reference materials, such as guides to MS-DOS
interrupts and instruction mnemonics, are available at the end of the
book.
Required Background
The reader should already be able to program confidently in at least one
high-level programming language such as Python, Java, C, or C++. One
chapter covers C++ interfacing, so it is very helpful to have a compiler on
hand. I have used this book in the classroom with majors in both
computer science and management information systems, and it has been
used elsewhere in engineering courses.
Features
Complete Program Listings
The author’s website contains supplemental learning materials, study
guides, and all the source code from the book’s examples. Two link
libraries (32-bit and 64-bit) are supplied with the book, containing more
than 40 procedures that simplify user input–output, numeric processing,
disk and file handling, and string handling. In the beginning stages of the
course, students can use this library to enhance their programs. Later,
they can create their own procedures and add them to the library.
Programming Logic
Two chapters emphasize Boolean logic and bit-level manipulation. A
conscious attempt is made to relate high-level programming logic to the
low-level details of the machine. This approach helps students to create
more efficient implementations and to better understand how compilers
generate object code.
Hardware and Operating System Concepts
The first two chapters introduce basic hardware and data representation
concepts, including binary numbers, CPU architecture, status flags, and
memory mapping. A survey of the computer’s hardware and a historical
perspective of the Intel processor family helps students to better
understand their target computer system.
Structured Programming Approach
Beginning with Chapter 5 , procedures and functional decomposition are
emphasized. Students are given more complex programming exercises,
requiring them to focus on design before starting to write code.

Java Bytecodes and the Java Virtual
Machine
In Chapters 8 and 9 , the author explains the basic operation of Java
bytecodes with short illustrative examples. Numerous short examples are
shown in disassembled bytecode format, followed by detailed step-by-
step explanations.
Creating Link Libraries
Students are free to add their own procedures to the book’s link library
and create new libraries. They learn to use a toolbox approach to
programming and to write code that is useful in more than one program.
Macros and Structures
A chapter is devoted to creating structures, unions, and macros, which
are essential in assembly language and systems programming.
Conditional macros with advanced operators serve to make the macros
more professional.
Interfacing to High-Level Languages
A chapter is devoted to interfacing assembly language to C and C++. This
is an important job skill for students who are likely to find jobs
programming in high-level languages. They can learn to optimize their
code and see examples of how C++ compilers optimize code.
Instructional Aids
All the program listings are available on the Web. Instructors are
provided a test bank, answers to review questions, solutions to
programming exercises, and a Microsoft PowerPoint slide presentation
for each chapter. More details can be found on Page xxvi .
 

VideoNotes
VideoNotes are Pearson’s visual tool designed to teach students key
programming concepts and techniques. These short step-by-step videos
demonstrate basic assembly language concepts. VideoNotes allow for
self-paced instruction with easy navigation including the ability to select,
play, rewind, fast-forward, and stop within each VideoNote exercise.
Details below.
Chapter Descriptions
Chapters 1 to 8 contain core concepts of assembly language and
should be covered in sequence. After that, you have a fair amount of
freedom. The following chapter dependency graph shows how later
chapters depend on knowledge gained from other chapters.
1. Basic Concepts: Applications of assembly language, basic
concepts, machine language, and data representation.
2. x86 Processor Architecture: Basic microcomputer design,
instruction execution cycle, x86 processor architecture, Intel64
architecture, x86 memory management, components of a
microcomputer, and the input–output system.
3. Assembly Language Fundamentals: Introduction to assembly
language, linking and debugging, and defining constants and
variables.
4. Data Transfers, Addressing, and Arithmetic: Simple data
transfer and arithmetic instructions, assemble-link-execute cycle,
operators, directives, expressions, JMP and LOOP instructions,
and indirect addressing.
5. Procedures: Linking to an external library, description of the
book’s link library, stack operations, defining and using
procedures, flowcharts, and top-down structured design.
 
6. Conditional Processing: Boolean and comparison instructions,
conditional jumps and loops, high-level logic structures, and
finite-state machines.
7. Integer Arithmetic: Shift and rotate instructions with useful
applications, multiplication and division, extended addition and
subtraction, and ASCII and packed decimal arithmetic.
8. Advanced Procedures: Stack parameters, local variables,
advanced PROC and INVOKE directives, and recursion.
9. Strings and Arrays: String primitives, manipulating arrays of
characters and integers, two-dimensional arrays, sorting, and
searching.
10. Structures and Macros: Structures, macros, conditional assembly
directives, and defining repeat blocks.
11. MS-Windows Programming: Protected mode memory
management concepts, using the Microsoft-Windows API to
display text and colors, and dynamic memory allocation.
12. Floating-Point Processing and Instruction Encoding: Floating-
point binary representation and floating-point arithmetic.
Learning to program the 32-bit floating-point unit. Understanding
the encoding of 32-bit machine instructions.
13. High-Level Language Interface: Parameter passing conventions,
inline assembly code, and linking assembly language modules to
C and C++ programs.
14. 16-Bit MS-DOS Programming: Memory organization, interrupts,
function calls, and standard MS-DOS file I/O services.
15. Disk Fundamentals: Disk storage systems, sectors, clusters,
directories, file allocation tables, handling MS-DOS error codes,
and drive and directory manipulation.
16. BIOS-Level Programming: Keyboard input, video text, graphics,
and mouse programming.
Appendix A: MASM Reference
Appendix B: The x86 Instruction Set


Appendix C: BIOS and MS-DOS Interrupts
Appendix D: Answers to Review Questions (Chapters 14 –
16 )
Instructor and Student Resources
Instructor Resource Materials
The following protected instructor material is available on pearson.com
For username and password information, please contact your Pearson
Representative.
Lecture PowerPoint Slides
Instructor Solutions Manual
Student Resource Materials
The following useful materials are located at www.asmirvine.com:
Getting Started, a comprehensive step-by-step tutorial that helps
students customize Visual Studio for assembly language
programming.
Corrections to errors found in the book.
Supplementary articles on assembly language programming topics.
Required support files for assembling and linking your programs,
complete source code for all example programs in the book, and
complete source code for the author’s supplementary library.
Assembly Language Workbook, an interactive workbook covering
number conversions, addressing modes, register usage, debug
programming, and floating-point binary numbers.

 

Debugging Tools: Tutorials on using the Microsoft Visual Studio
debugger.
Acknowledgments
Many thanks are due to Tracy Johnson, Portfolio Manager for Computer
Science at Pearson Education, who has provided friendly, helpful
guidance for many years. Vanitha Puela of SPi Global did an excellent job
on the book production, along with Amanda Brands as the Content
Producer at Pearson.
Previous Editions
I offer my special thanks to the following individuals who were most
helpful during the development of earlier editions of this book:
William Barrett, San Jose State University
Scott Blackledge
James Brink, Pacific Lutheran University
Gerald Cahill, Antelope Valley College
John Taylor
About the Author
Kip Irvine has written five computer programming textbooks, for Intel
Assembly Language, C++. Visual Basic (beginning and advanced), and
COBOL. His book Assembly Language for Intel-Based Computers has been
translated into six languages. His first college degrees (B.M., M.M., and
doctorate) were in Music Composition, at University of Hawaii and
University of Miami. He began programming computers for music
synthesis around 1982 and taught programming at Miami-Dade
Community College for 17 years. He earned an M.S. degree in Computer
Science from the University of Miami, and taught computer programming
in the School of Computing and Information Sciences at Florida
International University for 18 years.
Contents
Preface
1 Basic Concepts
1.1 Welcome to Assembly Language
1.1.1 Questions You Might Ask
1.1.2 Assembly Language Applications
1.1.3 Section Review
1.2 Virtual Machine Concept
1.2.1 Section Review
1.3 Data Representation
1.3.1 Binary Integers
1.3.2 Binary Addition
1.3.3 Integer Storage Sizes
1.3.4 Hexadecimal Integers
1.3.5 Hexadecimal Addition
1.3.6 Signed Binary Integers
1.3.7 Binary Subtraction
1.3.8 Character Storage
1.3.9 Binary-Coded Decimal (BCD) Numbers
1.3.10 Section Review
1.4 Boolean Expressions




















1.4.1 Truth Tables for Boolean Functions
1.4.2 Section Review
1.5 Chapter Summary
1.6 Key Terms
1.7 Review Questions and Exercises
1.7.1 Short Answer
1.7.2 Algorithm Workbench
2 x86 Processor Architecture
2.1 General Concepts
2.1.1 Basic Microcomputer Design
2.1.2 Instruction Execution Cycle
2.1.3 Reading from Memory
2.1.4 Loading and Executing a Program
2.1.5 Section Review
2.2 32-Bit x86 Processors
2.2.1 Modes of Operation
2.2.2 Basic Execution Environment
2.2.3 x86 Memory Management
2.2.4 Section Review
2.3 64-Bit x86-64 Processors
2.3.1 64-Bit Operation Modes
2.3.2 Basic 64-Bit Execution Environment
2.3.3 Section Review























2.4 Components of a Typical x86 Computer
2.4.1 Motherboard
2.4.2 Memory
2.4.3 Section Review
2.5 Input-Output System
2.5.1 Levels of I/O Access
2.5.2 Section Review
2.6 Chapter Summary
2.7 Key Terms
2.8 Review Questions
3 Assembly Language Fundamentals
3.1 Basic Language Elements
3.1.1 First Assembly Language Program
3.1.2 Integer Literals
3.1.3 Constant Integer Expressions
3.1.4 Real Number Literals
3.1.5 Character Literals
3.1.6 String Literals
3.1.7 Reserved Words
3.1.8 Identifiers
3.1.9 Directives
3.1.10 Instructions
3.1.11 Section Review























3.2 Example: Adding and Subtracting Integers
3.2.1 The AddTwo Program
3.2.2 Running and Debugging the AddTwo Program
3.2.3 Program Template
3.2.4 Section Review
3.3 Assembling, Linking, and Running Programs
3.3.1 The Assemble-Link-Execute Cycle
3.3.2 Listing File
3.3.3 Section Review
3.4 Defining Data
3.4.1 Intrinsic Data Types
3.4.2 Data Definition Statement
3.4.3 Adding a Variable to the AddTwo Program
3.4.4 Defining BYTE and SBYTE Data
3.4.5 Defining WORD and SWORD Data
3.4.6 Defining DWORD and SDWORD Data
3.4.7 Defining QWORD Data
3.4.8 Defining Packed BCD (TBYTE) Data
3.4.9 Defining Floating-Point Types
3.4.10 A Program That Adds Variables
3.4.11 Little-Endian Order
3.4.12 Declaring Uninitialized Data






















3.4.13 Section Review
3.5 Symbolic Constants
3.5.1 Equal-Sign Directive
3.5.2 Calculating the Sizes of Arrays and Strings
3.5.3 EQU Directive
3.5.4 TEXTEQU Directive
3.5.5 Section Review
3.6 Introducing 64-Bit Programming
3.7 Chapter Summary
3.8 Key Terms
3.8.1 Terms
3.8.2 Instructions, Operators, and Directives
3.9 Review Questions and Exercises
3.9.1 Short Answer
3.9.2 Algorithm Workbench
3.10 Programming Exercises
4 Data Transfers, Addressing, and Arithmetic
4.1 Data Transfer Instructions
4.1.1 Introduction
4.1.2 Operand Types
4.1.3 Direct Memory Operands
4.1.4 MOV Instruction
4.1.5 Zero/Sign Extension of Integers























4.1.6 LAHF and SAHF Instructions
4.1.7 XCHG Instruction
4.1.8 Direct-Offset Operands
4.1.9 Examples of Moving Data
4.1.10 Section Review
4.2 Addition and Subtraction
4.2.1 INC and DEC Instructions
4.2.2 ADD Instruction
4.2.3 SUB Instruction
4.2.4 NEG Instruction
4.2.5 Implementing Arithmetic Expressions
4.2.6 Flags Affected by Addition and Subtraction
4.2.7 Example Program (AddSubTest)
4.2.8 Section Review
4.3 Data-Related Operators and Directives
4.3.1 OFFSET Operator
4.3.2 ALIGN Directive
4.3.3 PTR Operator
4.3.4 TYPE Operator
4.3.5 LENGTHOF Operator
4.3.6 SIZEOF Operator
4.3.7 LABEL Directive






















4.3.8 Section Review
4.4 Indirect Addressing
4.4.1 Indirect Operands
4.4.2 Arrays
4.4.3 Indexed Operands
4.4.4 Pointers
4.4.5 Section Review
4.5 JMP and LOOP Instructions
4.5.1 JMP Instruction
4.5.2 LOOP Instruction
4.5.3 Displaying an Array in the Visual Studio Debugger
4.5.4 Summing an Integer Array
4.5.5 Copying a String
4.5.6 Section Review
4.6 64-Bit Programming
4.6.1 MOV Instruction
4.6.2 64-Bit Version of SumArray
4.6.3 Addition and Subtraction
4.6.4 Section Review
4.7 Chapter Summary
4.8 Key Terms
4.8.1 Terms
4.8.2 Instructions, Operators, and Directives























4.9 Review Questions and Exercises
4.9.1 Short Answer
4.9.2 Algorithm Workbench
4.10 Programming Exercises
5 Procedures
5.1 Stack Operations
5.1.1 Runtime Stack (32-Bit Mode)
5.1.2 PUSH and POP Instructions
5.1.3 Section Review
5.2 Defining and Using Procedures
5.2.1 PROC Directive
5.2.2 CALL and RET Instructions
5.2.3 Nested Procedure Calls
5.2.4 Passing Register Arguments to Procedures
5.2.5 Example: Summing an Integer Array
5.2.6 Saving and Restoring Registers
5.2.7 Section Review
5.3 Linking to an External Library
5.3.1 Background Information
5.3.2 Section Review
5.4 The Irvine32 Library
5.4.1 Motivation for Creating the Library
5.4.2 The Win32 Console Window























5.4.3 Individual Procedure Descriptions
5.4.4 Library Test Programs
5.4.5 Section Review
5.5 64-Bit Assembly Programming
5.5.1 The Irvine64 Library
5.5.2 Calling 64-Bit Subroutines
5.5.3 The x64 Calling Convention
5.5.4 Sample Program that Calls a Procedure
5.5.5 Section Review
5.6 Chapter Summary
5.7 Key Terms
5.7.1 Terms
5.7.2 Instructions, Operators, and Directives
5.8 Review Questions and Exercises
5.8.1 Short Answer
5.8.2 Algorithm Workbench
5.9 Programming Exercises
6 Conditional Processing
6.1 Boolean and Comparison Instructions
6.1.1 The CPU Status Flags
6.1.2 AND Instruction
6.1.3 OR Instruction
6.1.4 Bit-Mapped Sets























6.1.5 XOR Instruction
6.1.6 NOT Instruction
6.1.7 TEST Instruction
6.1.8 CMP Instruction
6.1.9 Setting and Clearing Individual CPU Flags
6.1.10 Boolean Instructions in 64-Bit Mode
6.1.11 Section Review
6.2 Conditional Jumps
6.2.1 Conditional Structures
6.2.2 Jcond Instruction
6.2.3 Types of Conditional Jump Instructions
6.2.4 Conditional Jump Applications
6.2.5 Section Review
6.3 Conditional Loop Instructions
6.3.1 LOOPZ and LOOPE Instructions
6.3.2 LOOPNZ and LOOPNE Instructions
6.3.3 Section Review
6.4 Conditional Structures
6.4.1 Block-Structured IF Statements
6.4.2 Compound Expressions
6.4.3 WHILE Loops
6.4.4 Table-Driven Selection






















6.4.5 Section Review
6.5 Application: Finite-State Machines
6.5.1 Validating an Input String
6.5.2 Validating a Signed Integer
6.5.3 Section Review
6.6 Conditional Control Flow Directives (Optional topic)
6.6.1 Creating IF Statements
6.6.2 Signed and Unsigned Comparisons
6.6.3 Compound Expressions
6.6.4 Creating Loops with .REPEAT and .WHILE
6.7 Chapter Summary
6.8 Key Terms
6.8.1 Terms
6.8.2 Instructions, Operators, and Directives
6.9 Review Questions and Exercises
6.9.1 Short Answer
6.9.2 Algorithm Workbench
6.10 Programming Exercises
6.10.1 Suggestions for Testing Your Code
6.10.2 Exercise Descriptions
7 Integer Arithmetic
7.1 Shift and Rotate Instructions
7.1.1 Logical Shifts and Arithmetic Shifts
7.1.2 SHL Instruction
























7.1.3 SHR Instruction
7.1.4 SAL and SAR Instructions
7.1.5 ROL Instruction
7.1.6 ROR Instruction
7.1.7 RCL and RCR Instructions
7.1.8 Signed Overflow
7.1.9 SHLD/SHRD Instructions
7.1.10 Section Review
7.2 Shift and Rotate Applications
7.2.1 Shifting Multiple Doublewords
7.2.2 Multiplication by Shifting Bits
7.2.3 Displaying Binary Bits
7.2.4 Extracting File Date Fields
7.2.5 Section Review
7.3 Multiplication and Division Instructions
7.3.1 Unsigned Integer Multiplication (MUL)
7.3.2 Signed Integer Multiplication (IMUL)
7.3.3 Measuring Program Execution Times
7.3.4 Unsigned Integer Division (DIV)
7.3.5 Signed Integer Division (IDIV)
7.3.6 Implementing Arithmetic Expressions
7.3.7 Section Review






















7.4 Extended Addition and Subtraction
7.4.1 ADC Instruction
7.4.2 Extended Addition Example
7.4.3 SBB Instruction
7.4.4 Section Review
7.5 ASCII and Unpacked Decimal Arithmetic
7.5.1 AAA Instruction
7.5.2 AAS Instruction
7.5.3 AAM Instruction
7.5.4 AAD Instruction
7.5.5 Section Review
7.6 Packed Decimal Arithmetic
7.6.1 DAA Instruction
7.6.2 DAS Instruction
7.6.3 Section Review
7.7 Chapter Summary
7.8 Key Terms
7.8.1 Terms
7.8.2 Instructions, Operators, and Directives
7.9 Review Questions and Exercises
7.9.1 Short Answer
7.9.2 Algorithm Workbench
7.10 Programming Exercises























8 Advanced Procedures
8.1 Introduction
8.2 Stack Frames
8.2.1 Stack Parameters
8.2.2 Disadvantages of Register Parameters
8.2.3 Accessing Stack Parameters
8.2.4 32-Bit Calling Conventions
8.2.5 Local Variables
8.2.6 Reference Parameters
8.2.7 LEA Instruction
8.2.8 ENTER and LEAVE Instructions
8.2.9 LOCAL Directive
8.2.10 The Microsoft x64 Calling Convention
8.2.11 Section Review
8.3 Recursion
8.3.1 Recursively Calculating a Sum
8.3.2 Calculating a Factorial
8.3.3 Section Review
8.4 INVOKE, ADDR, PROC, and PROTO
8.4.1 INVOKE Directive
8.4.2 ADDR Operator
8.4.3 PROC Directive
8.4.4 PROTO Directive























8.4.5 Parameter Classifications
8.4.6 Example: Exchanging Two Integers
8.4.7 Debugging Tips
8.4.8 WriteStackFrame Procedure
8.4.9 Section Review
8.5 Creating Multimodule Programs
8.5.1 Hiding and Exporting Procedure Names
8.5.2 Calling External Procedures
8.5.3 Using Variables and Symbols across Module
Boundaries
8.5.4 Example: ArraySum Program
8.5.5 Creating the Modules Using Extern
8.5.6 Creating the Modules Using INVOKE and PROTO
8.5.7 Section Review
8.6 Advanced Use of Parameters (Optional Topic)
8.6.1 Stack Affected by the USES Operator
8.6.2 Passing 8-Bit and 16-Bit Arguments on the Stack
8.6.3 Passing 64-Bit Arguments
8.6.4 Non-Doubleword Local Variables
8.7 Java Bytecodes (Optional Topic)
8.7.1 Java Virtual Machine
8.7.2 Instruction Set
8.7.3 Java Disassembly Examples






















8.7.4 Example: Conditional Branch
8.8 Chapter Summary
8.9 Key Terms
8.9.1 Terms
8.9.2 Instructions, Operators, and Directives
8.10 Review Questions and Exercises
8.10.1 Short Answer
8.10.2 Algorithm Workbench
8.11 Programming Exercises
9 Strings and Arrays
9.1 Introduction
9.2 String Primitive Instructions
9.2.1 MOVSB, MOVSW, and MOVSD
9.2.2 CMPSB, CMPSW, and CMPSD
9.2.3 SCASB, SCASW, and SCASD
9.2.4 STOSB, STOSW, and STOSD
9.2.5 LODSB, LODSW, and LODSD
9.2.6 Section Review
9.3 Selected String Procedures
9.3.1 Str_compare Procedure
9.3.2 Str_length Procedure
9.3.3 Str_copy Procedure
9.3.4 Str_trim Procedure























9.3.5 Str_ucase Procedure
9.3.6 String Library Demo Program
9.3.7 String Procedures in the Irvine64 Library
9.3.8 Section Review
9.4 Two-Dimensional Arrays
9.4.1 Ordering of Rows and Columns
9.4.2 Base-Index Operands
9.4.3 Base-Index-Displacement Operands
9.4.4 Base-Index Operands in 64-Bit Mode
9.4.5 Section Review
9.5 Searching and Sorting Integer Arrays
9.5.1 Bubble Sort
9.5.2 Binary Search
9.5.3 Section Review
9.6 Java Bytecodes: String Processing (Optional Topic)
9.7 Chapter Summary
9.8 Key Terms and Instructions
9.9 Review Questions and Exercises
9.9.1 Short Answer
9.9.2 Algorithm Workbench
9.10 Programming Exercises
10 Structures and Macros
10.1 Structures























10.1.1 Defining Structures
10.1.2 Declaring Structure Objects
10.1.3 Referencing Structure Objects
10.1.4 Example: Displaying the System Time
10.1.5 Structures Containing Structures
10.1.6 Example: Drunkard’s Walk
10.1.7 Declaring and Using Unions
10.1.8 Section Review
10.2 Macros
10.2.1 Overview
10.2.2 Defining Macros
10.2.3 Invoking Macros
10.2.4 Additional Macro Features
10.2.5 Using Our Macro Library (32-Bit Mode Only)
10.2.6 Example Program: Wrappers
10.2.7 Section Review
10.3 Conditional-Assembly Directives
10.3.1 Checking for Missing Arguments
10.3.2 Default Argument Initializers
10.3.3 Boolean Expressions
10.3.4 IF, ELSE, and ENDIF Directives
10.3.5 The IFIDN and IFIDNI Directives






















10.3.6 Example: Summing a Matrix Row
10.3.7 Special Operators
10.3.8 Macro Functions
10.3.9 Section Review
10.4 Defining Repeat Blocks
10.4.1 WHILE Directive
10.4.2 REPEAT Directive
10.4.3 FOR Directive
10.4.4 FORC Directive
10.4.5 Example: Linked List
10.4.6 Section Review
10.5 Chapter Summary
10.6 Key Terms
10.6.1 Terms
10.6.2 Operators and Directives
10.7 Review Questions and Exercises
10.7.1 Short Answer
10.7.2 Algorithm Workbench
10.8 Programming Exercises
11 MS-Windows Programming
11.1 Win32 Console Programming
11.1.1 Background Information
11.1.2 Win32 Console Functions























11.1.3 Displaying a Message Box
11.1.4 Console Input
11.1.5 Console Output
11.1.6 Reading and Writing Files
11.1.7 File I/O in the Irvine32 Library
11.1.8 Testing the File I/O Procedures
11.1.9 Console Window Manipulation
11.1.10 Controlling the Cursor
11.1.11 Controlling the Text Color
11.1.12 Time and Date Functions
11.1.13 Using the 64-Bit Windows API
11.1.14 Section Review
11.2 Writing a Graphical Windows Application
11.2.1 Necessary Structures
11.2.2 The MessageBox Function
11.2.3 The WinMain Procedure
11.2.4 The WinProc Procedure
11.2.5 The ErrorHandler Procedure
11.2.6 Program Listing
11.2.7 Section Review
11.3 Dynamic Memory Allocation
11.3.1 HeapTest Programs






















11.3.2 Section Review
11.4 32-Bit x86 Memory Management
11.4.1 Linear Addresses
11.4.2 Page Translation
11.4.3 Section Review
11.5 Chapter Summary
11.6 Key Terms
11.7 Review Questions and Exercises
11.7.1 Short Answer
11.7.2 Algorithm Workbench
11.8 Programming Exercises
12 Floating-Point Processing and Instruction Encoding
12.1 Floating-Point Binary Representation
12.1.1 IEEE Binary Floating-Point Representation
12.1.2 The Exponent
12.1.3 Normalized Binary Floating-Point Numbers
12.1.4 Creating the IEEE Representation
12.1.5 Converting Decimal Fractions to Binary Reals
12.1.6 Section Review
12.2 Floating-Point Unit
12.2.1 FPU Register Stack
12.2.2 Rounding
12.2.3 Floating-Point Exceptions























12.2.4 Floating-Point Instruction Set
12.2.5 Arithmetic Instructions
12.2.6 Comparing Floating-Point Values
12.2.7 Reading and Writing Floating-Point Values
12.2.8 Exception Synchronization
12.2.9 Code Examples
12.2.10 Mixed-Mode Arithmetic
12.2.11 Masking and Unmasking Exceptions
12.2.12 Section Review
12.3 x86 Instruction Encoding
12.3.1 Instruction Format
12.3.2 Single-Byte Instructions
12.3.3 Move Immediate to Register
12.3.4 Register-Mode Instructions
12.3.5 Processor Operand-Size Prefix
12.3.6 Memory-Mode Instructions
12.3.7 Section Review
12.4 Chapter Summary
12.5 Key Terms
12.6 Review Questions and Exercises
12.6.1 Short Answer
12.6.2 Algorithm Workbench






















12.7 Programming Exercises
13 High-Level Language Interface
13.1 Introduction
13.1.1 General Conventions
13.1.2 .MODEL Directive
13.1.3 Examining Compiler-Generated Code
13.1.4 Section Review
13.2 Inline Assembly Code
13.2.1 __asm Directive in Visual C++
13.2.2 File Encryption Example
13.2.3 Section Review
13.3 Linking 32-Bit Assembly Language Code to C/C++
13.3.1 IndexOf Example
13.3.2 Calling C and C++ Functions
13.3.3 Multiplication Table Example
13.3.4 Section Review
13.4 Chapter Summary
13.5 Key Terms
13.6 Review Questions
13.7 Programming Exercises
14 16-Bit MS-DOS Programming 622
14.1 MS-DOS and the IBM-PC
14.1.1 Memory Organization























14.1.2 Redirecting Input-Output
14.1.3 Software Interrupts
14.1.4 INT Instruction
14.1.5 Coding for 16-Bit Programs
14.1.6 Section Review
14.2 MS-DOS Function Calls (INT 21h)
14.2.1 Selected Output Functions
14.2.2 Hello World Program Example
14.2.3 Selected Input Functions
14.2.4 Date/Time Functions
14.2.5 Section Review
14.3 Standard MS-DOS File I/O Services
14.3.1 Create or Open File (716Ch)
14.3.2 Close File Handle (3Eh)
14.3.3 Move File Pointer (42h)
14.3.4 Get File Creation Date and Time
14.3.5 Selected Library Procedures
14.3.6 Example: Read and Copy a Text File
14.3.7 Reading the MS-DOS Command Tail
14.3.8 Example: Creating a Binary File
14.3.9 Section Review
14.4 Chapter Summary






















14.5 Programming Exercises
15 Disk Fundamentals
15.1 Disk Storage Systems
15.1.1 Tracks, Cylinders, and Sectors
15.1.2 Disk Partitions (Volumes)
15.1.3 Section Review
15.2 File Systems
15.2.1 FAT12
15.2.2 FAT16
15.2.3 FAT32
15.2.4 NTFS
15.2.5 Primary Disk Areas
15.2.6 Section Review
15.3 Disk Directory
15.3.1 MS-DOS Directory Structure
15.3.2 Long Filenames in MS-Windows
15.3.3 File Allocation Table (FAT)
15.3.4 Section Review
15.4 Reading and Writing Disk Sectors
15.4.1 Sector Display Program
15.4.2 Section Review
15.5 System-Level File Functions
15.5.1 Get Disk Free Space (7303h)























15.5.2 Create Subdirectory (39h)
15.5.3 Remove Subdirectory (3Ah)
15.5.4 Set Current Directory (3Bh)
15.5.5 Get Current Directory (47h)
15.5.6 Get and Set File Attributes (7143h)
15.5.7 Section Review
15.6 Chapter Summary
15.7 Programming Exercises
15.8 Key Terms
16 BIOS-Level Programming
16.1 Introduction
16.1.1 BIOS Data Area
16.2 Keyboard Input with INT 16h
16.2.1 How the Keyboard Works
16.2.2 INT 16h Functions
16.2.3 Section Review
16.3 Video Programming with INT 10h
16.3.1 Basic Background
16.3.2 Controlling the Color
16.3.3 INT 10h Video Functions
16.3.4 Library Procedure Examples
16.3.5 Section Review
16.4 Drawing Graphics Using INT 10h























16.4.1 INT 10h Pixel-Related Functions
16.4.2 DrawLine Program
16.4.3 Cartesian Coordinates Program
16.4.4 Converting Cartesian Coordinates to Screen
Coordinates
16.4.5 Section Review
16.5 Memory-Mapped Graphics
16.5.1 Mode 13h: 320 * 200, 256 Colors
16.5.2 Memory-Mapped Graphics Program
16.5.3 Section Review
16.6 Mouse Programming
16.6.1 Mouse INT 33h Functions
16.6.2 Mouse Tracking Program
16.6.3 Section Review
16.7 Chapter Summary
16.8 Programming Exercises
A MASM Reference
B The x86 Instruction Set
C BIOS and MS-DOS Interrupts
D Answers to Review Questions (Chapters 14–16)
Glossary
ASCII Character Reference Charts
Supplemental Materials






















Assembly Language For X86 Processors 8th Edition Kip R Irvine
Chapter 1
Basic Concepts
Chapter Outline
Welcome to Assembly Language
1.1 
Questions You Might Ask
1.1.1 
Assembly Language Applications
1.1.2 
Section Review
1.1.3 
Virtual Machine Concept
1.2 
Section Review
1.2.1 
Data Representation
1.3 
Binary Integers
1.3.1 
Binary Addition
1.3.2 
Integer Storage Sizes
1.3.3 
Hexadecimal Integers
1.3.4 
Hexadecimal Addition
1.3.5 
Signed Binary Integers
1.3.6 
Binary Subtraction
1.3.7 
Character Storage
1.3.8 
Binary-Coded Decimal (BCD) Numbers
1.3.9 
Section Review
1.3.10 
Boolean Expressions
1.4 
Truth Tables for Boolean Functions
1.4.1 
Section Review
1.4.2 
This chapter establishes some core concepts relating to assembly
language programming. For example, it shows how assembly language
fits into the wide spectrum of languages and applications. We introduce
the virtual machine concept, which is so important in understanding the
relationship between software and hardware layers. A large part of the
chapter is devoted to the binary and hexadecimal numbering systems,
showing how to perform conversions and do basic arithmetic. Finally, this
chapter introduces fundamental Boolean operations (AND, OR, NOT,
XOR), which will prove to be essential in later chapters.
Chapter Summary
1.5 
Key Terms
1.6 
Review Questions and Exercises
1.7 
Short Answer
1.7.1 
Algorithm Workbench
1.7.2 
1.1 Welcome to Assembly Language
Assembly Language for x86 Processors focuses on programming
microprocessors compatible with Intel and AMD processors running
under current versions of Microsoft Windows.
The latest version of Microsoft Macro Assembler (known as MASM)
should be used with this book. MASM is included with Microsoft Visual
Studio . Please check our website (www.asmirvine.com) for the latest
details about using MASM in Visual Studio.
Assembly language is the oldest programming language, and of all
languages, bears the closest resemblance to native machine language. It
provides direct access to computer hardware, requiring you to understand
much about your computer’s architecture and operating system.
Educational Value
Why read this book? Perhaps you’re taking a college course whose title is
similar to one of the following courses that often use our book:
Microcomputer Assembly Language
Assembly Language Programming
Introduction to Computer Architecture
Fundamentals of Computer Systems
Embedded Systems Programming
This book will help you learn basic principles about computer
architecture, machine language, and low-level programming. You will
learn enough assembly language to test your knowledge on today’s most
widely used microprocessor family. You won’t be learning to program a



“toy” computer using a simulated assembler; MASM is an industrial-
strength assembler, used by practicing professionals. You will learn the
architecture of the Intel processor family from a programmer’s point of
view.
If you are planning to be a C or C++ developer, you need to develop an
understanding of how memory, address, and instructions work at a low
level. A lot of programming errors are not easily recognized at the high-
level language level. You will often find it necessary to “drill down” into
your program’s internals to find out why it isn’t working.
If you doubt the value of low-level programming and studying details of
computer software and hardware, take note of the following quote from a
leading computer scientist, Donald Knuth, in discussing his famous book
series, The Art of Computer Programming:
Some people [say] that having machine language, at all, was the great mistake that I made. I
really don’t think you can write a book for serious computer programmers unless you are able
to discuss low-level detail.
Visit this book’s website to get lots of supplemental information, tutorials,
and exercises at www.asmirvine.com.
1.1.1 Questions You Might Ask
What Background Should I Have?
Before reading this book, you should have programmed in at least one
structured high-level language, such as Java, C, Python, or C++. You
should know how to use IF statements, arrays, and functions to solve
programming problems.
What Are Assemblers and Linkers?
1
Random documents with unrelated
content Scribd suggests to you:
put down two cards from the pack. Cecilio chose one, I took the
other; then, after laying down half a dozen cards in succession, I
won the first albur. Not a frown crossed Cecilio's face; and, for my
part, I thought that fortune was going to befriend me for once in my
life, but I lost the second throw. The third albur remained, which
would decide the affair.
While thus engaged, we had not perceived two horsemen who were
advancing toward us. I did not see them, for my part, till they were
almost at my side. The sound of their voices caused me to raise my
head, and at a single glance I saw in one of the new-comers a
perfect specimen of the Jarocho.[51] He wore in all its purity the
peculiar costume of this class of men, a straw hat with a broad brim
turned up behind, a fine linen shirt with cambric frills, without any
vest above it, a pair of blue cotton velvet breeches open at the knee,
and falling in a point to the middle of his leg. In a belt of Chinese
crape of a scarlet color hung a straight sword (machete), without
guard or sheath, the sharp and glittering blade of which sparkled in
the sun. His feet, which were bare, were held in the wooden stirrup
only by the tips of his toes. This Jarocho, his head inclined indolently
upon one shoulder, sat his horse in the attitude peculiar to people of
his caste, whose easy manner and unconstrained demeanor suited
him to perfection. His complexion partook equally of the darkness of
the negro and the copper color of the Indian. It was a more difficult
matter to define precisely what the other cavalier was, who was
habited in an Indian robe, blue pantaloons, and bottines of Cordovan
leather, while a rich hat of Jipijapa straw[52] sheltered him from the
rays of the sun. His face, with a slight tinge of sternness in it, might
have become equally well a merchant, a horse-dealer, or a
highwayman, and the easy-going horse that he bestrode seemed to
suit equally all three suppositions.
Two gamesters at play, wherever they may be, are always an
agreeable sight for Mexicans of all classes, and, to my great
annoyance, the two horsemen stopped short to look at us. I sat
quite motionless with the cards in my hand, and was much confused
at being surprised at an occupation so contrary to my habits. As no
stake was visible, however, I flattered myself that I would be able to
keep up appearances so far as to make them believe that it was only
the most innocent pastime; but I had to do with men who are acute
judges of human character.
"Might I ask if this beautiful horse is the stake?" asked the horseman
in the Indian robe, saluting me, and accompanying his request with
a piercing look.
"Exactly so," I answered.
"In that case you are playing high, señor," replied the cavalier; "and
if, as I fancy, the horse is your own, I wish Fortune may be
propitious to you; but would you not like any body to help you with
their advice?"
"I prefer finishing the game as I commenced it. I have always
remarked that I have more luck when there is no one by."
The cavalier was too much of a gamester himself not to see at once
the full force of my scruples, and, turning to his companion, said,
"'Tis as well as it is. Time presses. We must part here, although, if I
have time, you may trust on my rejoining you at the fandango of
Manantial; still, to speak truth, if certain infallible signs do not
deceive me, the north wind will not be long in beginning to blow."
"To-morrow, then, if it is possible," answered the Jarocho; and the
two cavaliers separated, the first following the direct road, while the
horseman in the Indian robe took a path on the left.
"What the devil has the north wind to do with a fandango in a little
village?" I asked, mechanically, of my valet.
"The cavalier in the Indian robe is perhaps afraid of catching cold,"
said Cecilio, with an affected air.
After this absurd explanation, we again began the game which had
been so unexpectedly interrupted. I once more drew two cards out
of the pack. One was the sota de bastos (knave of clubs). Cecilio
chose it. I shuffled the cards this time with a trembling hand. My
heart beat. Perhaps I was going to lose the daily companion of five
long years. Cecilio wiped away the sweat which ran in streams down
his forehead. Suddenly he uttered a cry which pierced to my
innermost core. I was just turning up the knave of hearts.
"You have lost, sir!" cried he.
At these words, spoken in good French, I regarded Cecilio with mute
surprise. He, meanwhile, stepping up proudly to my horse, put his
foot in the stirrup, and was going to spring upon Storm's back.
"Stop!" I cried; "the saddle does not go with the animal." I then
ordered him to take the saddle off, and to put it on the back of the
other horse. Cecilio executed this order, which would probably be the
last he would ever receive from his old master, with sufficient
readiness and good will. This done, he mounted that horse which
was no longer mine. I cursed my folly, but it was too late. A feeling
of pride, however, kept me from showing the remorse I felt; and, to
hide my chagrin, I asked Cecilio how he had managed to pick up so
much French without my knowledge.
"I have not been behind the chair of your lordship," he replied,
"especially when you dined with your countrymen, without acquiring
some of the language; and as for making you acquainted with that
fact, I was too wide awake. Your lordship, from that time, would
have kept your secrets to yourself."
Cecilio was evidently like one of that class of valets who figure so
largely in the picaresque romances of Spain. More than once he had
reminded me of Ambrosio of Lamela in Gil Blas. His physiognomy
had not deceived me. However, in spite of the impudence which he
here manifested for the first time, he seemed, when the parting
moment came, to suffer considerably. It was natural, in fact, to show
some emotion when he was leaving a master who had used him
kindly. Moved by this token of feeling on his part, I showed that I
was not without some affection for him.
"Cecilio, my friend," I said, "the horse you have won from me would
have been yours before many days had passed. Are you grieved
because you have been the means of taking him from me?"
Cecilio squeezed out a tear.
"The truth is," said he, "I regret seeing your beautiful saddle on the
back of such a sorry brute, and I am ashamed at the miserable
appointments that the horse I have won is provided with. But, if
your lordship is in the humor, would it suit you to play for the saddle
and bridle?"
This was too much. Overcome by this last piece of ingratitude, "Take
care," I cried, cocking a pistol, "that I do not take back a horse
which you are not worthy to mount."
Cecilio made no other reply to this threat than by spurring his horse
and whistling on the Spanish dog, which had looked upon this scene
with a painful air of dumb anxiety. I whistled also. Thus forced to
choose between two parties whom he had affectionately loved all his
life, the poor animal hesitated. He ran up to Storm, and then came
back to me with a most pitying expression in his face. The
convulsive movements of his body betrayed his anguish, and showed
the struggle that was going on within. His limbs shook for an
instant; he then gave three convulsive howls, darted-from me, and
was soon lost in the dust raised by his much-loved companion. I
remained alone. My heart was in a storm of rage and grief, and I
was even tempted to vent my ill-humor on the miserable hack that
fortune had left me, but this weakness lasted only for a moment. I
had learned, in the many crosses incident to a life of stirring
adventure, the difficult virtue of resignation, and the different phases
of this sentimental episode had been accompanied by circumstances
so ludicrous that I finished by throwing myself on the grass and
bursting into a violent fit of laughter.
FOOTNOTES:
[47] The women of Jalapa are renowned throughout the whole
republic for their beauty and grace, and their taste in fêtes, music,
and flowers is unrivaled.
[48] These huts are constructed of bamboos, wattled so as to admit
both air and light freely.
[49] Before the independence of Mexico this bridge was called
Puente del Rey (the King's Bridge).
[50] The game called monte is thus divided.
[51] The peasants of the sea-coast and the country round Vera Cruz
are so called.
[52] These hats, which take their name from the place where they
are made, are often worth from £10 to £12 each.
CHAPTER II.
I arrive at Manantial.—Superstitions of the Jarochos.
The unfortunate occurrence recorded in the preceding chapter
caused me to change my route. It was impossible for me to reach
Vera Cruz that day, mounted as I was; so I resolved to pass the
night at Manantial, a little village which I supposed to be not more
than a mile off. I had thus some time before me, and I thought it
could not be better employed than in taking a siesta under the
shade of the trees, amid the green solitude in which I found myself.
It was a spot in one of the most picturesque forests which cover
almost the entire country between Puente Nacional and Vergara.
Amid these matted thickets, narrow paths, cut by the hatchet, run in
different directions, overshadowed by the almost impenetrable
foliage of the trees, while a wall of luxuriant vegetation on each side
bars every where the entrance of man, and almost that of the fallow
deer. The long, pendent branches twist and interlace their tendrils
with the boughs of the neighboring trees. The cocoa-nut-tree covers,
with its large leaves, its necklace of green fruit; and the Bourbon
palms stretch their branches, covered with shining foliage to the
ground; the silk-cotton-tree shows its white flakes of cotton just
bursting from the dark green pod. In the deep shade of these
inhabitants of the forest the friar's cowl abounds with its polished
chalice; and at the bottom, as well as the top of this green vault, the
gobeas hang their little bell-flowers of variegated colors. Such is the
aspect of these woods—an appearance, however, which assumes a
different phase according to the hour of the day. At midday the rank
vegetation droops under the scorching rays of the sun, from the
palm, with its towering crest, to the lowly moss which covers the
ground. A hot breeze at that time rushes through the thickets, and
appears to arrest every where the progress of vegetation; wild
beasts, birds, insects, and plants—all animated nature, in fact,
seems to languish under this stifling heat; but when the sun's rays
no longer gild the tree-tops, and the vapors rise slowly from the
ground, to fall back again in dew, these forests and their denizens,
once so silent, start again into life.
Overcome by the powerful influence of the sun, I fell fast asleep
without any thought about my horse. The pettiest thief, indeed,
would have been ashamed of such booty; and I was, besides, in a
district where no stain of dishonesty rested on the character of the
inhabitants. The sun was yet high in the horizon when I awoke, but
a refreshing breeze was beginning to temper the sultry heat. High
up amid the branches of the trees which sheltered me, the
paroquets had begun their discordant noises, and their infernal
melody was of such a kind as to annoy even the strongest nerves. I
got impatient; and, hastily bestriding the wretched animal which
supplied the place of my excellent Storm, set out on the beaten path
that led to Manantial.
After riding slowly and painfully along for about half an hour, the
shrill croaking of the paroquets always paining my ears, I perceived
a horseman a little way in advance. This cavalier, attired exactly like
one of those who had interrupted Cecilio and me at our game,
seemed, like myself, to be quite out of humor. He rode, as all the
Jarochos do, with his body inclined more to one side of the saddle
than the other. His horse shuffled slowly along, and every now and
then he held up his fist to the skies in all the fury of passion.
Delighted that chance had sent me a companion in misfortune, I
wished to offer him my hearty condolence, and succeeded in that
design beyond my expectation. Scarcely had I managed, by dint of
hard spurring, to make up to him, than a loud ringing laugh replaced
the mental irritation in which I thought he had been indulging a
minute before.
"May I ask if you are laughing at me?" I said, abruptly; for, in the
bad humor I was in, this hilarity seemed quite out of place.
"At you? No, Señor Cavalier," answered the Jarocho. "But you will
excuse me if, at sight of your horse, I bid adieu for a time to all
customary politeness."
"My horse is in no worse condition than the andante[53] you are
on," I replied, almost choking.
"You may think so; but that hack of yours is a mere bag of bones,
and it is no small satisfaction to me to find one worse mounted than
myself."
The horseman then began to laugh in such a merry, unconstrained
fashion, that, tickled with the very absurdity of the thing, I could not
help joining him, and we had a good hearty laugh together. The
squabbling of the paroquets, struck with the unusual noise, ceased
all of a sudden. They recommenced their ear-splitting cries, till at
last I discharged a pistol at random among the foliage. To my great
surprise, a bird fell at my feet.
"Did you take aim at it?" asked the astonished Jarocho.
"Of course," I replied, sharply; "and this will serve to show you that
it is not altogether safe to jest with people you don't know."
At these words the Jarocho stopped his horse, and, straightening
himself in his saddle, placed one hand upon his haunch, and pulled
his straw hat over his eyes with the other. He then cried out,
"Oigajte, ñor deconocio.[54] I am of a caste and of a country where
words are few, and whose actions are prompt. I did not mean to
offend you; but if you seek a quarrel, I shall not flinch. In spite of
the disparity of our weapons, I am not afraid to try which of us is
the better man."
He hummed a tune, drew his sharp sword from the leathern belt
which encircled his waist, and flourished it in the air. I likewise drew
my sabre.
The idea of crossing swords, mounted as we were on such sorry
jades, was so absurd, that we at last burst into a mutual roar of
laughter, which ended the matter. I then hastened to explain to the
Jarocho that I had no inimical feeling toward him. He held out his
hand.
"I am glad you are satisfied," he replied, "for I should have been
very sorry to have an enemy in one so brave as you appear to be, as
at present I have a more serious quarrel on my hands."
We then rode along together quite amicably. To turn the
conversation, recalling, besides, to my recollection the parting words
of the two horsemen at the cross-road, I said, in a careless kind of a
tone, "Isn't there to be a fandango at Manantial to-morrow?"
"There is, confound it! I promised ña[55] Sacramenta a bow of red
ribbons for the occasion, and there is not a bit to be had in all the
neighborhood. At the very moment you joined me I was cursing my
unlucky star. Probably you are yourself going to the fandango?"
"Well, I am; but chance alone brought me to think of it, for I had
reckoned on sleeping to-night at Vera Cruz, had not an unfortunate
occurrence come in the way."
"You will have no cause to regret it, I hope, for the crowd will be as
thick as smoke. But where will you put up at Manantial? There is no
inn in the place."
"With you, perhaps, since you appear to be so desirous to have me
at the fête."
The Jarocho bowed in token of assent, and then began to give me
an account of the numerous pleasures that awaited me on the
morrow. Conversing thus, we reached Manantial. Night had come. A
few scattered lights gleaming from among the green foliage
announced our approach to the village. We soon reached a little
clearing in the wood, dotted with cabins formed of wattled bamboo.
This was Manantial. Some men and women, clad in the national
costume, were dancing to the monotonous sound of a mandolin,
while the mothers were rocking their infants to sleep in hammocks
formed of strips of aloe bark. I soon learned the name of my new
host.
"Ah! it's Calros,"[56] cried they, in a tone as if his arrival had long
been looked for. He paid no attention to the greeting of his friends,
who advanced to welcome him, but his eye roved about till it rested
on the slender and graceful form of a young girl, whose pretty little
feet were twinkling merrily in the dance. Her hair, black as ebony,
was ornamented with a wreath[57] of suchil flowers, interspersed
with fire-flies, whose pale bluish light encircled her forehead with a
mysterious and fantastic halo. Draped in a white robe, whose waving
folds were every moment blanched by the pale rays of the moon,
Sacramenta, with her bare shoulders and variegated hair, looked like
a fairy dancing by night in a glade of the forest, when all around is
at rest.
The almost disdainful glance which she threw at him showed me at
once the true state of affairs. The Jarocho waited till the dance was
finished, and then advanced toward the girl. By the entreating tone
of his voice, it was clear that he was excusing himself about the red
ribbons he had promised her. I was too far off to hear his words, but
the light which streamed from a neighboring cottage showed me the
full expression of her features. It was evident that all Calros's
rhetoric had been useless, and he remounted, but with a saddened,
irritated air. Sacramenta, in shaking her head to a remark of his,
allowed one of the suchil flowers to fall from her chaplet. The
Jarocho regarded it for some time with an undecided air; and she,
marking his hesitation, and while pressing the wreath on her
forehead, in a fit of coquetry, raised the flower on the tip of her tiny
foot, and presented it to him. The cloudy countenance of the
Jarocho was now lit up with joy; he seized the flower eagerly,
spurred his horse, and was soon lost in the darkness.
It was quite clear that he had completely forgotten me, but it was as
clear that I had no intention of taking up my quarters for the night in
the forest.
"Halloo! Señor Don Calros," I shouted after him, "you have left me
behind."
"Pardon me, Señor Cavalier," cried he, pulling up; "but there are
times when I am hardly master of myself."
"I am convinced of that," I said; "and it is certainly no indiscretion in
you to forget a stranger whom you met by the merest chance."
"In my country the stranger is at home every where; but you shall
not have my hospitality for nothing, for you must pay me either by
doing me a particular piece of service, or assisting me with your
advice."
"With pleasure," I answered, "if it is in my power."
The dwelling of the Jarocho, called a jacal, was situated at the other
end of the village. A small inclosure, in which a few goats were
penned, was attached to it. The cabin was divided into three
apartments by reed partitions. In one of these, the mother of the
Jarocho was preparing the evening meal over a fire whose reddish
glow lighted up the whole jacal. The repast consisted of rice boiled
in milk, fried bananas, and red haricots from the Tierra Caliente,
which enjoy a proverbial celebrity in Mexico. When supper was
ended the old woman left the room, wishing me a pleasant sleep.
The distant thrumming of guitars apprised us that the company we
had left were still keeping up their merriment. The voice of the
Jarocho awoke me from the reverie in which I had been indulging.
"Do you see," said he to me, as we were lying at the door of the
cabin, "that fleecy mist which dulls the light of the stars? These are
the vapors which, at the end of every hot day, arise from the lakes,
brooks, and waterfalls. Do you think it possible that, at the
command of a mortal like ourselves, this shadowy impalpable fog
should assume the form of a friend who has been lost, or an enemy
that has been murdered?"
"I doubt that much," I replied, astonished at this preamble; "I
fancied that these superstitious notions were peculiar only to
northern climes."
"Here," said Calros, in a solemn tone, "ghosts haunt not the abodes
of the living; they love to flit about in the woods, and to frisk among
the leaves and flowers. But you smile. Let us talk of something else.
Did you see ña Sacramenta this evening?"
"The pretty girl with the wreath of cucuyos and the suchil chaplet?"
"The same. She is very beautiful, is she not? Six months ago, at a
fandango in the neighborhood, a quarrel arose on her account,
which was followed by the death of a man. The victim was a relation
of mine; and, according to universal custom, it became my duty to
avenge his death. I had, besides, an additional inducement in
seeking the murderer; he adored Sacramenta, and every one who
loves her is my sworn enemy. Twenty times have I persuaded myself
into a belief that Sacramenta loved me, and twenty times have I
been forced to confess to myself that I was deceived. I feel that I
love Sacramenta more than my life—than my honor, perhaps—else I
should have been on the murderer's traces long ago; and yet this
evening I have even ventured to hope."
"Yes, a mere suchil flower may sometimes work miracles," said I,
interrupting him.
"What!" cried Jarocho, "have you the gift of seeing what no one else
has seen?"
"I only observed what every body else might have seen, had they
chose; but when a man receives a flower from the hand of a girl he
loves, he needn't, I think, despair."
"Thank Heaven!" cried the Jarocho, cheerfully. "Yet," he added, with
a sigh, "this is not the first token I have had from her; to-morrow
the illusions of this night may be dispelled. Ever since ña Sacramenta
came to live at Manantial I have suffered the utmost tortures of
anxiety, and yet vengeance has not been done on my cousin's
murderer. I have tried to forget that duty; unluckily, there are others
who do not. The dead man's mother reminds me every day of the
charge which has devolved upon me. Eight days ago I met the old
woman. I wished to avoid her, but it was impossible. She is looked
upon as a sort of witch by the people around. On passing me she
cried out, 'The dead have better memories than the living.' I asked
her what she meant, although I knew full well. 'You will see him to-
night,' she replied. In truth, that very evening," Calros continued, in
an altered voice, "I was seated at the same place where we now
are, Señor Cavalier; the door was open, and my thoughts were
engaged about nothing in particular. I was only listening to the
voices in the trees and on the wind; a pale white mist was creeping
up to the sky, as it is doing now. All at once a cloud came between
my eyes and the stars; it took a human form, and the dead man was
before me! I saw him distinctly, right in front of me. I closed my
eyes, and when I opened them he was gone. You will now
understand why I asked you, señor, who, as a European, must be a
learned man, if mortals like ourselves can raise the dead."
These superstitious notions are not at all prevalent in Mexico, and
the Jarochos seem to have a complete monopoly of them. I gently
hinted that all this was nothing but the result of a diseased
imagination.
"I know well," said he, "that the ghost of my deceased relative has
not been raised by any human power, but I believe that God himself
has sent it to me. I have taken my resolution. I shall not stay in the
village a day after to-morrow, although I leave it with a broken
heart."
"But is there no way of reconciling your duty with your love?"
"That can only be done by delegating my powers to a devoted
friend. A guest makes a part of the family; and in this quality, señor,
you might take my place and seek the murderer, who would not
hesitate to give you satisfaction."
"That would be too glorious a mission for me, and I fear I should not
be successful in the search," I said, modestly; "but I have no
objections to accompany you, and aid you in your task."
"That is an offer which I will not refuse," Calros answered. "We shall
then set out the day after to-morrow."
This delicate point settled to our mutual satisfaction, we stretched
ourselves under a shed which served as a sort of veranda to the
cabin. A gentle breeze was beginning to dissipate the heat of the
day. The lizards were silent in the grass; and in the savannas, the
wild cattle, by their joyful lowing, testified to the grateful freshness
of the night. Lulled by the soft murmur of the twittering leaves, I
soon fell asleep.
FOOTNOTES:
[53] Local synonym for a horse.
[54] Listen, Sir Stranger.
[55] Abbreviated form of Doña, used in this part of Mexico.
[56] Calros, Charles.
[57] A head-dress greatly in vogue among Mexican females.
CHAPTER III.
The Fête of Manantial.—The Combat.
The name of Jarochos is given to those peasants who live on the
sea-board round Vera Cruz. Their costume bears no resemblance
whatever to that of the people around them. The inhabitants of
Andalusia wear a dress very similar to theirs, and it is the general
opinion, from their manners and character, that they are the
descendants of the Gitanos of that Spanish province. Their dialect is,
like their attire, strange and singular. It abounds in words of the
purest Castilian, interspersed with local terms disfigured by a vicious
pronunciation, and can not be understood, even by those who know
Spanish, without diligent and careful study. They are impatient of
restraint, and, consequently, ill fitted for acting as soldiers or sailors,
although well versed in the use of arms, and not unacquainted with
the dangers of the sea. It is their love of independence which causes
them to prefer the wandering life of the herdsman and the horse-
dealer, and the machete plays no unimportant part in all their
difficulties. The Jarocho would rather want the most indispensable
part of his dress than be deprived of the long, sharp, glittering blade
which he wears in his belt. This sabre is more generally in the hand
of the Jarocho than at his side. A small point of honor, or the most
futile remark, has often been the means of bringing on the most
bloody and long-continued series of combats. They are possessed,
however, of some rare qualities, which atone for their defects. The
Jarocho is temperate, frank, loyal, and hospitable to the whites (by
this term he means the higher classes); he looks upon theft with
horror; he loves the place of his birth. A stranger to every desire for
wealth, he lives contented with a little in the midst of a fertile
country where three harvests a year cover the ground, which is
sown but not tilled. The inhabitants of the country round Vera Cruz
are in general robust and well made. They are strong and muscular;
and nature has thrown round their persons an air of elegance in
exact harmony with the devotion the Jarocho pays to three things:
his horse, his sword, and his mistress.
Seven years before my arrival in Mexico, I once had an opportunity
of meeting with one of this singular race; but, from want of
familiarity with Spanish, I could not well understand his peculiar
dialect.
As soon as I awoke in the morning, I was reminded, by the
handsome and elegant dress of my host, that it was the fête-day of
Manantial. A twisted fringe, strung with Venetian pearls, and
studded at regular distances with little mirrors, ran round his hat; his
shirt, of the finest linen, was embroidered in the most beautiful
manner; the buttons of his velvet calzonera at his girdle were made
of solid piastres, and those which ran down his legs of reals and half
reals. On his feet were half-boots of Cordovan leather. His cortante,
[58] polished to the highest degree of brilliancy, hung suspended
from his girdle of scarlet silk, and two bows of the same color
adorned its hilt. Set out thus to the best advantage, the Jarocho had
an air of refinement about him which augured well for his success.
In spite of a degree of satisfaction which shone upon his
countenance, Calros could not help twirling the end of his mustache
with an anxious expression. His joy seemed to be mixed with an
alloy of bitterness. I asked him the cause of it.
"Ah! if you could only free me of my vow of vengeance, I should be
relieved of a charge which will embitter, I fear, all my pleasures."
"What! will your oath keep you from drinking, singing, and playing?"
"No, but it will hinder me from knocking a fellow down; and what is
a fandango without some little quarrel to enliven it? No matter; one
can not have all one's pleasures at once. I shall sing louder, play
more, and drink as much as will soothe me for the disappointment."
I doubted much the calming efficacy of Catalonian brandy, but I
affected to believe fully in the power of the remedy.
Manantial, like the Jarocho, had put on its holiday garb for the
occasion. An unusual stir was visible in the village. At the doors of
the cabins, women, arrayed in abundance of muslin and lace,
appeared from time to time, decked with gold and coral ornaments,
so dear to the swarthy beauties of Southern countries. In a glade,
an estrade had been erected for the accommodation of the dancers;
little shops had been improvised for the supply of water, tepache,
and Catalonian brandy; gambling-tables had been set up. In a few
hours the Jarochos from the surrounding villages would come
pouring in. The sun was shining full upon the spot in all its dazzling
brilliancy. The shadow cast by the palm-trees, already a little off the
perpendicular, showed that it was two hours past noon. Crowds of
horsemen now began to arrive, who, after alighting, tied their
foaming steeds to the trunks of the trees or the pillars of the houses.
Horses and men were soon mingled together in strange confusion;
the cries of the men, the neighing of the steeds, and the tuning of
guitars, were now heard on all sides. Circles were speedily formed
round the gambling-tables, the ventorillos,[59] or the estrade
reserved for the female dancers. Here I stationed myself.
The estrade, on which female dancers were alone to figure, was
elevated a few inches above the ground. According to a singular
custom prevailing in all the villages round Vera Cruz, the men on this
occasion are mere spectators of the women's performances. A
Jarocho squatted himself down on the ground close to the estrade,
and commenced strumming his mandolin. Eight or ten girls
answered to his call, and began to dance. I could not help admiring
the graceful dexterity with which many of them carried a glass of
water on their heads without spilling a drop, dancing, too, all the
while with the greatest vigor; or the agility with which they untied,
without using their hands, the silk bows attached to their shoes,[60]
When this dance, very coldly applauded, was finished, the guitar
struck up a new tune, that of the dance called petenera.
This time the estrade was quite full, and among the women who
advanced to take a part in this measure I recognized, by her graceful
mien and dazzling beauty, Doña Sacramenta, whom my host called,
in his flowery language, his dearly-beloved angel on earth. She was
attired in a beautiful dress of transparent muslin. Her rounded arms
were adorned in the upper part by the embroidery and lace of her
cambric chemise, the rest remained bare. The contour of her fair
shoulders was masked, but not entirely concealed, by a gorget of
lace very like Arlesian. She wore shoes of the most beautiful satin,
and a tress of her magnificent black hair was wound round a
tortoise-shell comb mounted with massy gold. Her eyelids, cast
down under the fiery glances that were shot from all sides at her,
allowed one to see the long silken lashes with which they were
fringed. She was not now the calm beauty that I had admired the
evening before in the moonlight, but an impassioned daughter of the
tropics in all her brilliancy.
The excitement among the spectators, increased by their frequent
libations, became greater and greater every minute, but another and
a more intense interest was soon awakened in the minds of the
crowd.
"Ah!" cried a Jarocho at my side, whose hair was beginning to turn
gray, "at the last fandango held at Malibran,[61] Quilimaco lost one
of his ears, and Juan de Dios the point of his nose, in a quarrel that
arose about a beauty who was not worth a lock of hair compared
with that girl there."
"Have patience, tio,"[62] answered another; "the beautiful
Sacramenta has more than one aspirant in this village, and I venture
to predict that, before nightfall, she will have danced the machete
and chamarra for two at least among us."
I did not understand what they meant, but the events that followed
soon explained it. Two groups had by this time formed round the
estrade occupied by the dancers. In the first, a Jarocho, as richly
dressed as Calros, seemed to exercise a marked ascendency. In the
second, my host appeared to be the head of another party.
Animated by the hope of some quarrel arising between the two
factions, the musicians strummed their guitars with redoubled ardor,
and a fearful discord filled the air. Just when the dancers were
beginning to put themselves in motion, some singers chanted, in a
nasal tone of voice, a couplet whose words bore no relation
whatever to the present circumstances, and which consisted of a
series of proverbs put in verse, almost devoid of meaning, but
strongly tinged with obscene allusions. I was then standing near my
host, whose eye was following with a jealous attention the least
movement of Sacramenta, but she did not deign to bestow upon him
the slightest glance.
"You see my hard fate," said he to me, in a low voice; "in high hope
one day, in despair the next. We shall set out to-morrow."
These last words betrayed such poignant grief that I could not help
cursing in my heart that pitiless coquetry which could wound the
feelings of so ardent a lover.
"Ah!" he resumed, "she has not yet forgiven me for that confounded
bow of red ribbons which I was unable to procure for her."
At this moment his rival advanced to the estrade, and uncovering,
presented his hat to Sacramenta with a very gallant air. She received
it with a smile, without interrupting for a moment the evolutions in
which she was engaged. Calros's face appeared quite impassible,
and he contented himself with making an almost imperceptible
gesture to one of his partisans. This person then advanced in his
turn and did the same. Custom demanded that, in a case like this,
the maiden should show preference to neither; she therefore
continued to dance with the two hats in her hand. The advantage of
seeing his hat placed upon the head of the dancer would by right
belong to the third gallant; and, as I expected, Calros was the one
who profited by this usage. The two rivals then exchanged looks of
mutual defiance, while the first, untying his sash of China crape,
formed it into a rosette, and stepped forward to suspend it to the
bare shoulder of Sacramenta.
The guitars, now struck with the greatest vigor, made almost as
much noise as a band of trumpeters, and the voices of the singers
increased in proportion. The men were exchanging looks of evident
satisfaction, but the women were chattering among themselves,
evidently envying the homage paid to Sacramenta. This young girl
kept her feet in motion; her complexion was heightened by a reddish
glow, which lent an additional charm to her radiant black eyes. A
vague apprehension, however, seemed to agitate her bosom. At
once happy and miserable, she dared not turn her eyes upon him
whose heart yearned for her with such true affection. In spite, also,
of Calros's apparent calm, the involuntary working of the muscles of
his face disclosed the torture he was suffering.
"Courage!" said I to him, in a whisper; "have you not on your heart
the suchil flower?"
Calros raised his head, as if the remembrance of that had restored
all his confidence. He seized his machete, and went to suspend it at
Sacramenta's shoulder. I then understood the meaning of the
prediction that I had heard some time before. Sacramenta danced
with the machete and chamarra of two of her suitors. It was a
singular sight to see a long, sharp, glittering blade dangling from the
nude shoulder of the young girl, in such close proximity to her
heaving bosom.
A sudden silence now fell upon the crowd, similar to what
sometimes takes place at a bull-fight when the arena has received
its first stains of blood. All at once a loud and imposing male voice
near the orchestra exclaimed "Bomba!" The instruments ceased to
sound, and the song died away. The voice was that of Calros's rival,
who now chanted a couplet expressive of his confidence in his
mistress's tenderness, while the friends of the Jarocho repeated the
last line in chorus. Calros then answered in a high key by saying that
he would not have a divided heart, and that his rival was a traitor.
The Jarocho replied in another recitative, by inquiring if he had spirit
sufficient to meet him in fair combat. Calros then, with a smile upon
his face, expressed his willingness to meet this traitor, this
vagabond, this false friend.
Whether Sacramenta was weary of the dance, or overcome by the
general emotion which was manifested when this last couplet was
chanted, I know not, but she stepped hastily from the estrade, and
her companions followed her. Instructed by past experience not to
wait for the commencement of the melee, as their instruments
generally suffer in the fray, the musicians hurriedly retired. Some
customary pieces of ceremony were still, however, to be gone
through; the suitors must redeem the pledges given to the dancer.
The customary fee for these is half a real each. The two rivals
advanced, one after the other, and filled both hands of Sacramenta
with silver coin. While she was receiving the forfeits, in the midst of
murmurs of applause excited by the prodigality of the two Jarochos,
and which she could not refuse without being guilty of rudeness, her
two little outstretched hands trembled involuntarily, and her pale lips
tried, but in vain, to smile. Calros fruitlessly sought a look of
encouragement from her. Pale and mute, and evidently laboring
under an emotion too powerful for concealment, she kept her eyes
fixed upon the ground. The machete would decide the question; and
the pleasures of the fête were going to be wound up by my host in
spite of his sage resolutions, when an old woman, elbowing her way
through the crowd, reminded him of the oath he was about to
violate. She was the mother of his dead relative.
"It is a shame, ñor Don Calros," cried the beldame, "to take a new
quarrel upon you when your cousin's death has not yet been
avenged."
The Jarocho was evidently taken aback at this unseasonable
interruption, and he made all the efforts he could to induce the old
woman to retract what she had said, but to all his reasons she had
one unvarying reply.
"Well, ña Josefita," said Calros at last, good-humoredly, "you are
making a great work about nothing, and are mistrusting my good
intention; for, if I fight this man, am I not keeping my hand in
exercise?"
"And should you happen to be run through the body, who will then
avenge my son?"
"You are right there," replied Calros, thrown off his guard by this
argument; "but that's just the way: the women are always mixing
themselves up in business that does not concern them. Any one may
now take my place," he continued, with an ill-natured air, "if my
adversary consent."
His rival bowed, and, poising his hat jauntily over his right ear,
placed at the same time his hand upon the hilt of his machete, and
with his right leg thrown slightly in advance, exclaimed, with an air
of haughty condescension, "What do I mean by all this? Will the
good folks of Manantial allow it to be said that they suffered their
fandango to be terminated without bestowing the customary honors
upon their visitors? Now," he continued, his eyes winking with
increased rapidity, "if I can not knock a man down for the sweet
eyes of ña Sacramenta, I shall forfeit to any one who draws the first
blood a bottle of Catalonian brandy."
Loud shouts of applause interrupted the orator, who, raising his head
with an air of assurance, thus went on: "I must say, however, that,
having expended my last real not an hour ago, I can not pay and
must conquer. Will any one here fight me on these conditions?"
This ridiculous fanfaronade, quite in the spirit of a Jarocho, was
welcomed enthusiastically by the by-standers. As for the speaker,
looking upon Calros, who was biting his thumbs, he cried
impudently, "Come, now, Don Calros, you have no lack of friends to
take your place."
But the enthusiasm of the crowd had died away. The prospect of
paying the forfeit in one's own person, and out of one's own purse,
did not appear to be welcomed by any of the on-lookers, and I was
not without some apprehension that Calros would revert to his
former idea by asking me to become his substitute. Happily, an
unexpected incident occurred which saved the honor of the villagers
of Manantial.
By the same road that I had reached the village the evening before,
a horseman was descried galloping along at his utmost speed. All
eyes were turned upon the new-comer, who appeared to be a
stranger, and whom I recognized as one of the horsemen who had
interrupted my game with Cecilio. The unknown alighted, and,
without saying a word, tied his horse to one of the wooden pillars of
a house; then, still silent, he stepped to the estrade, drew his
machete, at whose hilt fluttered a bow of red ribbons, with its point
traced a circle in the sand, and then stuck his sword in the centre.
A dead silence welcomed this strange visitant. The sword stuck in
the ground seemed to me to convey a defiance to all the village. The
antagonist desired by the rival of Calros appeared to have stepped in
at the proper time. The general gaze was now directed to the former
boaster, but he evidently did not feel inclined to take up this
unlooked-for challenge. The stranger, who looked like one of those
Paladins on whom a vow of silence has been imposed, advanced as
haughtily as he had come to one of the ventorillos, called for a glass
of brandy, and raised it to his mouth; but, with the air of a man who
disdains to assist his courage by artificial stimulants, instead of
drinking it, he tossed the liquor over his shoulder. He then cast upon
all the by-standers a proud glance of defiance.
All the villagers viewed the unknown with admiration, but none
seemed so impatient to measure their strength with this brilliant
champion as Calros. If the reader remember, he was not in favor
with Sacramenta, owing to the affair of the bow of red ribbons. Now
at the hilt of the stranger's sword hung a bow of ribbons of the very
color she wanted.
"Viva!" he whispered to me; "the old woman may go to the devil;
Sacramenta shall have her ribbons."
He then went and planted his sword beside that of the unknown.
The challenge was accepted. The stranger courteously carried his
hand to his hat, and, having considered his adversary for a moment,
cast a rapid look among the group of females, as if singling out
some one on whom to bestow the homage of his valor. He was not
long in discovering the beautiful Sacramenta, and, stepping toward
her, exclaimed, with admirable self-possession, "The fandangoes of
Medellin have lost all their attraction since ña Sacramenta is no
longer there to enliven them with her presence. May I flatter myself
that she has not forgotten them, and one of her most fervent
apasionados?"
The young woman was going to reply, when Calros, whose jealousy
was ever awake, approached the unknown, and said, "Pardon me,
Señor Cavalier, but I have a particular liking for red ribbons. Will you
surrender those that adorn your machete as forfeit for the first blood
drawn?"
"With pleasure," answered the stranger. "I should hardly have
ventured to offer them in homage to Doña Sacramenta; henceforth
they shall have a certain value in my eyes, as being the price of
blood shed for her."
After saying these words with a gracious smile, he uncovered
himself, and plucked his sword out of the ground. Calros did so too.
A polite altercation then took place between them as to who should
be the first to place his hat on his head; but this was soon decided
by bonneting at the same time. The most experienced of the
spectators undertook the task of selecting a spot free from the sun's
rays. This done, the combatants stood face to face, the villagers
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.
More than just a book-buying platform, we strive to be a bridge
connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.
Join us on a journey of knowledge exploration, passion nurturing, and
personal growth every day!
ebookbell.com

More Related Content

PDF
Assembly Language for X86 Processors 8th Edition Kip R. Irvine
PDF
Assembly Language for X86 Processors 8th Edition Kip R. Irvine
PDF
Assembly Language for x86 Processors 6th Edition Kip Irvine
PDF
Assembly Language for x86 Processors 6th Edition Kip Irvine
PDF
Assembly Language For X86 Processors 6th Edition 6th Kip Irvine
PDF
Assembly Language For X86 Processors 6th Edition 6th Kip Irvine
PDF
Assembly Language for x86 Processors 6th Edition Kip Irvine
PDF
Assembly Language for x86 Processors 6th Edition Kip Irvine
Assembly Language for X86 Processors 8th Edition Kip R. Irvine
Assembly Language for X86 Processors 8th Edition Kip R. Irvine
Assembly Language for x86 Processors 6th Edition Kip Irvine
Assembly Language for x86 Processors 6th Edition Kip Irvine
Assembly Language For X86 Processors 6th Edition 6th Kip Irvine
Assembly Language For X86 Processors 6th Edition 6th Kip Irvine
Assembly Language for x86 Processors 6th Edition Kip Irvine
Assembly Language for x86 Processors 6th Edition Kip Irvine

Similar to Assembly Language For X86 Processors 8th Edition Kip R Irvine (20)

PDF
Intro To 80x86 Assembly Lang Computer Arch Wcd P Richard C Detmer
PDF
Intro To 80x86 Assembly Lang Computer Arch Wcd P Richard C Detmer
PPTX
CMP 221.pptx computer science machine and assembly language
PPTX
CMP 221.pptx computer science machine and assembly language
PPT
computer architecture and organization.ppt
PPT
computer architecture and organization.ppt
PPTX
Lecture for computer organization COAL Lec-1.pptx
PPTX
Lecture for computer organization COAL Lec-1.pptx
PDF
chapt_01.pdf
PDF
chapt_01.pdf
PPTX
Microprocessor 8085 vtnnfgnrtnrtnbntynym
PPTX
Microprocessor 8085 vtnnfgnrtnrtnbntynym
PPTX
CO&AL-lecture-04 about the procedures in c language (1).pptx
PPTX
CO&AL-lecture-04 about the procedures in c language (1).pptx
PDF
Cao 2012
PDF
Cao 2012
PPTX
Assembly chapter One.pptx
PPTX
Assembly chapter One.pptx
PPTX
kg0000931 Chapter 1 introduction to computers, programs part ia
PPTX
kg0000931 Chapter 1 introduction to computers, programs part ia
Intro To 80x86 Assembly Lang Computer Arch Wcd P Richard C Detmer
Intro To 80x86 Assembly Lang Computer Arch Wcd P Richard C Detmer
CMP 221.pptx computer science machine and assembly language
CMP 221.pptx computer science machine and assembly language
computer architecture and organization.ppt
computer architecture and organization.ppt
Lecture for computer organization COAL Lec-1.pptx
Lecture for computer organization COAL Lec-1.pptx
chapt_01.pdf
chapt_01.pdf
Microprocessor 8085 vtnnfgnrtnrtnbntynym
Microprocessor 8085 vtnnfgnrtnrtnbntynym
CO&AL-lecture-04 about the procedures in c language (1).pptx
CO&AL-lecture-04 about the procedures in c language (1).pptx
Cao 2012
Cao 2012
Assembly chapter One.pptx
Assembly chapter One.pptx
kg0000931 Chapter 1 introduction to computers, programs part ia
kg0000931 Chapter 1 introduction to computers, programs part ia
Ad

Recently uploaded (20)

PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
master seminar digital applications in india
PDF
Computing-Curriculum for Schools in Ghana
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
RMMM.pdf make it easy to upload and study
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Insiders guide to clinical Medicine.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
Institutional Correction lecture only . . .
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Microbial disease of the cardiovascular and lymphatic systems
Sports Quiz easy sports quiz sports quiz
PPH.pptx obstetrics and gynecology in nursing
VCE English Exam - Section C Student Revision Booklet
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
master seminar digital applications in india
Computing-Curriculum for Schools in Ghana
FourierSeries-QuestionsWithAnswers(Part-A).pdf
RMMM.pdf make it easy to upload and study
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Insiders guide to clinical Medicine.pdf
GDM (1) (1).pptx small presentation for students
2.FourierTransform-ShortQuestionswithAnswers.pdf
Institutional Correction lecture only . . .
Renaissance Architecture: A Journey from Faith to Humanism
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Supply Chain Operations Speaking Notes -ICLT Program
Ad

Assembly Language For X86 Processors 8th Edition Kip R Irvine

  • 1. Assembly Language For X86 Processors 8th Edition Kip R Irvine download https://ebookbell.com/product/assembly-language- for-x86-processors-8th-edition-kip-r-irvine-57018230 Explore and download more ebooks at ebookbell.com
  • 2. Here are some recommended products that we believe you will be interested in. You can click the link to download. Assembly Language For X86 Processors Seventh Edition Irvine Kip R https://ebookbell.com/product/assembly-language-for-x86-processors- seventh-edition-irvine-kip-r-22041816 Assembly Language For X86 Processors 6th Edition 6th Kip Irvine https://ebookbell.com/product/assembly-language- for-x86-processors-6th-edition-6th-kip-irvine-2540012 Assembly Language For X86 Processors Eigth Edition 8th Kip R Irvine https://ebookbell.com/product/assembly-language-for-x86-processors- eigth-edition-8th-kip-r-irvine-11749486 Assembly Language For X86 Processors 6th Edition 6th Kip Irvine https://ebookbell.com/product/assembly-language- for-x86-processors-6th-edition-6th-kip-irvine-55389064
  • 3. Assembly Language For Intelbased Computers 5th Edition China Reprint 5th Edition Irvine https://ebookbell.com/product/assembly-language-for-intelbased- computers-5th-edition-china-reprint-5th-edition-irvine-31426294 Assembly Language For Intelbased Computers 4th Edition Kip R Irvine https://ebookbell.com/product/assembly-language-for-intelbased- computers-4th-edition-kip-r-irvine-1021014 Assembly Language For Beginners Itebooks https://ebookbell.com/product/assembly-language-for-beginners- itebooks-23836018 Assembly Language For Intelbased Computers 4th Edition Kiprirvine https://ebookbell.com/product/assembly-language-for-intelbased- computers-4th-edition-kiprirvine-1021012 Assembly Programming Language For Beginners Learn Assembly Programming Language Panchtilak https://ebookbell.com/product/assembly-programming-language-for- beginners-learn-assembly-programming-language-panchtilak-56519696
  • 6. Senior Vice President Courseware Portfolio Management: Marcia J. Horton Vice President, Portfolio Management: Engineering, Computer Science & Global Editions: Julian Partridge Executive Portfolio Manager: Tracy Johnson Portfolio Management Assistant: Meghan Jacoby Product Marketing Manager: Yvonne Vannatta Field Marketing Manager: Demetrius Hall Marketing Assistant: Jon Bryant Managing Content Producer: Scott Disanno Content Producer: Amanda Brands Manufacturing Buyer, Higher Ed, Lake Side Communications, Inc. (LSC): Maura Zaldivar-Garcia Inventory Manager: Bruce Boundy Rights and Permissions Manager: Ben Ferrini Full-Service Project Management: Vanitha Puela, SPi Global Cover Image: Tetra Images/Alamy Stock Photo Printer/Binder: LSC Communications, Inc. IA-32, Pentium, i486, Intel64, Celeron, and Intel 386 are trademarks of Intel Corporation. Athlon, Phenom, and Opteron are trademarks of Advanced Micro Devices. TASM and Turbo Debugger are trademarks of Borland International. Microsoft Assembler (MASM), Windows Vista, Windows 7, Windows NT, Windows Me, Windows 95, Windows 98, Windows 2000, Windows XP, MS-Windows, PowerPoint, Win32, DEBUG, WinDbg, MS-DOS, Visual Studio, Visual C++, and CodeView are registered trademarks of Microsoft Corporation. Autocad is a trademark of Autodesk. Java is a trademark of Sun Microsystems. PartitionMagic is a trademark of Symantec. All other trademarks or product names are the property of their respective owners.
  • 7. Copyright © 2020, 2015, 2011, 2007, 2003 by Pearson Inc. 221 River Street, Hoboken, NJ 07030. All rights reserved. Manufactured in the United States of America. This publication is protected by Copyright and permissions should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission(s) to use materials from this work, please visit http://www.pearsoned.com/permissions/. Previously published as Assembly Language for Intel-Based Computers. The author and publisher of this book have used their best efforts in preparing this book. These efforts include the development, research, and testing of the theories and programs to determine their effectiveness. The author and publisher make no warranty of any kind, expressed or implied, with regard to these programs or the documentation contained in this book. The author and publisher shall not be liable in any event for incidental or consequential damages in connection with, or arising out of, the furnishing, performance, or use of these programs. Microsoft and/or its respective suppliers make no representations about the suitability of the information contained in the documents and related graphics published as part of the services for any purpose. All such documents and related graphics are provided “as is” without warranty of any kind. Microsoft and/or its respective suppliers hereby disclaim all warranties and conditions with regard to this information, including all warranties and conditions of merchantability, whether express, implied or statutory, fitness for a particular purpose, title and non-infringement. In no event shall microsoft and/or its respective suppliers be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in
  • 8. connection with the use or performance of information available from the services. The documents and related graphics contained herein could include technical inaccuracies or typographical errors. changes are periodically added to the information herein. Microsoft and/or its respective suppliers may make improvements and/or changes in the product(s) and/or the program(s) described herein at any time. Partial screen shots may be viewed in full within the software version specified. Microsoft® and Windows® are registered trademarks of the microsoft corporation in the usa and other countries. screen shots and icons reprinted with permission from the microsoft corporation. This book is not sponsored or endorsed by or affiliated with the microsoft corporation. 1 19 ISBN-13: 978-0-13-538165-6 ISBN-10: 0-13-538165-7
  • 9. Preface Assembly Language for x86 Processors, Eighth Edition, teaches assembly language programming and architecture for x86 and Intel64 processors. It is an appropriate text for the following types of college courses: Assembly Language Programming Fundamentals of Computer Systems Fundamentals of Computer Architecture Students use Intel or AMD processors and program with Microsoft Macro Assembler (MASM), running on recent versions of Microsoft Windows. Although this book was originally designed as a programming textbook for college students, it serves as an effective supplement to computer architecture courses. As a testament to its popularity, previous editions have been translated into numerous languages. Emphasis of Topics This edition includes topics that lead naturally into subsequent courses in computer architecture, operating systems, and compiler writing: Virtual machine concept Instruction set architecture Elementary Boolean operations Instruction execution cycle Memory access and handshaking Interrupts and polling Hardware-based I/O Floating-point binary representation
  • 10. Other topics relate specially to x86 and Intel64 architecture: Protected memory and paging Memory segmentation in real-address mode 16-Bit interrupt handling MS-DOS and BIOS system calls (interrupts) Floating-point unit architecture and programming Instruction encoding Certain examples presented in the book lend themselves to courses that occur later in a computer science curriculum: Searching and sorting algorithms High-level language structures Finite-state machines Code optimization examples What’s New in the Eighth Edition This edition represents this book’s transition into the world of interactive electronic textbooks. We’re very excited about this innovative concept, because for the first time readers will be able to experiment and interact with review questions, code animations, tutorial videos, and multiple- input exercises. All section reviews in the chapters have been rewritten as interactive questions, giving the reader immediate feedback on their answers. New questions were added, others removed, and many revised. Code animations allow the reader to step through program code and view both variable values and comments about the code. Readers no longer have to visually jump back and forth between program code and text explanations on the next page.
  • 11. Links to timely tutorial videos have been inserted in the text, so readers can receive tutoring on topics as they encounter them in the text. Previously, readers would need to purchase a separate subscription to gain access to the entire set of videos, presented as a list. In this edition, videos are free. Multiple-input exercises allow readers to browse a program listing and insert variable values into boxes next to the code. They receive immediate colorized feedback, giving them the opportunity to experiment until all input values are correct. Hypertexted definitions of key terms are placed throughout the text, connected to an online glossary. In short, we have taken the successful content of this book (refined through many editions) and brought it into the interactive electronic textbook world. This book is still focused on its primary goal, to teach students how to write and debug programs at the machine level. It will never replace a complete book on computer architecture, but it does give students the first-hand experience of writing software in an environment that teaches them how a computer works. Our premise is that students retain knowledge better when theory is combined with experience. In an engineering course, students construct prototypes; in a computer architecture course, students should write machine-level programs. In both cases, they have a memorable experience that gives them confidence to work in any OS/machine-oriented environment. Protected mode programming is entirely the focus of chapters 1 through 13 . As such, students can create 32-bit and 64-bit programs that run under the most recent versions of Microsoft Windows. The remaining three legacy chapters cover 16-bit programming. These chapters cover  
  • 12. BIOS programming, MS-DOS services, keyboard and mouse input, dist storage fundamentals, video programming, and graphics. Subroutine Libraries We supply three versions of the subroutine library that students use for basic input/output, simulations, timing, and other useful tasks. The Irvine32 and Irvine64 libraries run in protected mode. The 16-bit version (Irvine16.lib) runs in real-address mode and is used only by Chapter 14 through Chapter 16 . Full source code for the libraries is supplied on the companion website. The link libraries are available only for convenience, not to prevent students from learning how to program input–output themselves. Students are encouraged to create their own libraries. Included Software and Examples All the example programs were tested with Microsoft Macro Assembler, running in a recent version of Microsoft Visual Studio. In addition, batch files are supplied that permit students to assemble and run applications from the Windows command prompt. Information Updates and corrections to this book may be found at the Companion website, including additional programming projects for instructors to assign at the ends of chapters. Overall Goals The following goals of this book are designed to broaden the student’s interest and knowledge in topics related to assembly language: Intel and AMD processor architecture and programming Real-address mode and protected mode programming  
  • 13. Assembly language directives, macros, operators, and program structure Programming methodology, showing how to use assembly language to create system-level software tools and application programs Computer hardware manipulation Interaction between assembly language programs, the operating system, and other application programs One of our goals is to help students approach programming problems with a machine-level mind set. It is important to think of the CPU as an interactive tool, and to learn to monitor its operation as directly as possible. A debugger is a programmer’s best friend, not only for catching errors, but as an educational tool that teaches about the CPU and operating system. We encourage students to look beneath the surface of high-level languages and to realize that most programming languages are designed to be portable and, therefore, independent of their host machines. In addition to the short examples, this book contains hundreds of ready-to-run programs that demonstrate instructions or ideas as they are presented in the text. Reference materials, such as guides to MS-DOS interrupts and instruction mnemonics, are available at the end of the book. Required Background The reader should already be able to program confidently in at least one high-level programming language such as Python, Java, C, or C++. One chapter covers C++ interfacing, so it is very helpful to have a compiler on hand. I have used this book in the classroom with majors in both computer science and management information systems, and it has been used elsewhere in engineering courses. Features
  • 14. Complete Program Listings The author’s website contains supplemental learning materials, study guides, and all the source code from the book’s examples. Two link libraries (32-bit and 64-bit) are supplied with the book, containing more than 40 procedures that simplify user input–output, numeric processing, disk and file handling, and string handling. In the beginning stages of the course, students can use this library to enhance their programs. Later, they can create their own procedures and add them to the library. Programming Logic Two chapters emphasize Boolean logic and bit-level manipulation. A conscious attempt is made to relate high-level programming logic to the low-level details of the machine. This approach helps students to create more efficient implementations and to better understand how compilers generate object code. Hardware and Operating System Concepts The first two chapters introduce basic hardware and data representation concepts, including binary numbers, CPU architecture, status flags, and memory mapping. A survey of the computer’s hardware and a historical perspective of the Intel processor family helps students to better understand their target computer system. Structured Programming Approach Beginning with Chapter 5 , procedures and functional decomposition are emphasized. Students are given more complex programming exercises, requiring them to focus on design before starting to write code. 
  • 15. Java Bytecodes and the Java Virtual Machine In Chapters 8 and 9 , the author explains the basic operation of Java bytecodes with short illustrative examples. Numerous short examples are shown in disassembled bytecode format, followed by detailed step-by- step explanations. Creating Link Libraries Students are free to add their own procedures to the book’s link library and create new libraries. They learn to use a toolbox approach to programming and to write code that is useful in more than one program. Macros and Structures A chapter is devoted to creating structures, unions, and macros, which are essential in assembly language and systems programming. Conditional macros with advanced operators serve to make the macros more professional. Interfacing to High-Level Languages A chapter is devoted to interfacing assembly language to C and C++. This is an important job skill for students who are likely to find jobs programming in high-level languages. They can learn to optimize their code and see examples of how C++ compilers optimize code. Instructional Aids All the program listings are available on the Web. Instructors are provided a test bank, answers to review questions, solutions to programming exercises, and a Microsoft PowerPoint slide presentation for each chapter. More details can be found on Page xxvi .   
  • 16. VideoNotes VideoNotes are Pearson’s visual tool designed to teach students key programming concepts and techniques. These short step-by-step videos demonstrate basic assembly language concepts. VideoNotes allow for self-paced instruction with easy navigation including the ability to select, play, rewind, fast-forward, and stop within each VideoNote exercise. Details below.
  • 17. Chapter Descriptions Chapters 1 to 8 contain core concepts of assembly language and should be covered in sequence. After that, you have a fair amount of freedom. The following chapter dependency graph shows how later chapters depend on knowledge gained from other chapters. 1. Basic Concepts: Applications of assembly language, basic concepts, machine language, and data representation. 2. x86 Processor Architecture: Basic microcomputer design, instruction execution cycle, x86 processor architecture, Intel64 architecture, x86 memory management, components of a microcomputer, and the input–output system. 3. Assembly Language Fundamentals: Introduction to assembly language, linking and debugging, and defining constants and variables. 4. Data Transfers, Addressing, and Arithmetic: Simple data transfer and arithmetic instructions, assemble-link-execute cycle, operators, directives, expressions, JMP and LOOP instructions, and indirect addressing. 5. Procedures: Linking to an external library, description of the book’s link library, stack operations, defining and using procedures, flowcharts, and top-down structured design.  
  • 18. 6. Conditional Processing: Boolean and comparison instructions, conditional jumps and loops, high-level logic structures, and finite-state machines. 7. Integer Arithmetic: Shift and rotate instructions with useful applications, multiplication and division, extended addition and subtraction, and ASCII and packed decimal arithmetic. 8. Advanced Procedures: Stack parameters, local variables, advanced PROC and INVOKE directives, and recursion. 9. Strings and Arrays: String primitives, manipulating arrays of characters and integers, two-dimensional arrays, sorting, and searching. 10. Structures and Macros: Structures, macros, conditional assembly directives, and defining repeat blocks. 11. MS-Windows Programming: Protected mode memory management concepts, using the Microsoft-Windows API to display text and colors, and dynamic memory allocation. 12. Floating-Point Processing and Instruction Encoding: Floating- point binary representation and floating-point arithmetic. Learning to program the 32-bit floating-point unit. Understanding the encoding of 32-bit machine instructions. 13. High-Level Language Interface: Parameter passing conventions, inline assembly code, and linking assembly language modules to C and C++ programs. 14. 16-Bit MS-DOS Programming: Memory organization, interrupts, function calls, and standard MS-DOS file I/O services. 15. Disk Fundamentals: Disk storage systems, sectors, clusters, directories, file allocation tables, handling MS-DOS error codes, and drive and directory manipulation. 16. BIOS-Level Programming: Keyboard input, video text, graphics, and mouse programming. Appendix A: MASM Reference Appendix B: The x86 Instruction Set  
  • 19. Appendix C: BIOS and MS-DOS Interrupts Appendix D: Answers to Review Questions (Chapters 14 – 16 ) Instructor and Student Resources Instructor Resource Materials The following protected instructor material is available on pearson.com For username and password information, please contact your Pearson Representative. Lecture PowerPoint Slides Instructor Solutions Manual Student Resource Materials The following useful materials are located at www.asmirvine.com: Getting Started, a comprehensive step-by-step tutorial that helps students customize Visual Studio for assembly language programming. Corrections to errors found in the book. Supplementary articles on assembly language programming topics. Required support files for assembling and linking your programs, complete source code for all example programs in the book, and complete source code for the author’s supplementary library. Assembly Language Workbook, an interactive workbook covering number conversions, addressing modes, register usage, debug programming, and floating-point binary numbers.    
  • 20. Debugging Tools: Tutorials on using the Microsoft Visual Studio debugger. Acknowledgments Many thanks are due to Tracy Johnson, Portfolio Manager for Computer Science at Pearson Education, who has provided friendly, helpful guidance for many years. Vanitha Puela of SPi Global did an excellent job on the book production, along with Amanda Brands as the Content Producer at Pearson. Previous Editions I offer my special thanks to the following individuals who were most helpful during the development of earlier editions of this book: William Barrett, San Jose State University Scott Blackledge James Brink, Pacific Lutheran University Gerald Cahill, Antelope Valley College John Taylor
  • 21. About the Author Kip Irvine has written five computer programming textbooks, for Intel Assembly Language, C++. Visual Basic (beginning and advanced), and COBOL. His book Assembly Language for Intel-Based Computers has been translated into six languages. His first college degrees (B.M., M.M., and doctorate) were in Music Composition, at University of Hawaii and University of Miami. He began programming computers for music synthesis around 1982 and taught programming at Miami-Dade Community College for 17 years. He earned an M.S. degree in Computer Science from the University of Miami, and taught computer programming in the School of Computing and Information Sciences at Florida International University for 18 years.
  • 22. Contents Preface 1 Basic Concepts 1.1 Welcome to Assembly Language 1.1.1 Questions You Might Ask 1.1.2 Assembly Language Applications 1.1.3 Section Review 1.2 Virtual Machine Concept 1.2.1 Section Review 1.3 Data Representation 1.3.1 Binary Integers 1.3.2 Binary Addition 1.3.3 Integer Storage Sizes 1.3.4 Hexadecimal Integers 1.3.5 Hexadecimal Addition 1.3.6 Signed Binary Integers 1.3.7 Binary Subtraction 1.3.8 Character Storage 1.3.9 Binary-Coded Decimal (BCD) Numbers 1.3.10 Section Review 1.4 Boolean Expressions                    
  • 23. 1.4.1 Truth Tables for Boolean Functions 1.4.2 Section Review 1.5 Chapter Summary 1.6 Key Terms 1.7 Review Questions and Exercises 1.7.1 Short Answer 1.7.2 Algorithm Workbench 2 x86 Processor Architecture 2.1 General Concepts 2.1.1 Basic Microcomputer Design 2.1.2 Instruction Execution Cycle 2.1.3 Reading from Memory 2.1.4 Loading and Executing a Program 2.1.5 Section Review 2.2 32-Bit x86 Processors 2.2.1 Modes of Operation 2.2.2 Basic Execution Environment 2.2.3 x86 Memory Management 2.2.4 Section Review 2.3 64-Bit x86-64 Processors 2.3.1 64-Bit Operation Modes 2.3.2 Basic 64-Bit Execution Environment 2.3.3 Section Review                       
  • 24. 2.4 Components of a Typical x86 Computer 2.4.1 Motherboard 2.4.2 Memory 2.4.3 Section Review 2.5 Input-Output System 2.5.1 Levels of I/O Access 2.5.2 Section Review 2.6 Chapter Summary 2.7 Key Terms 2.8 Review Questions 3 Assembly Language Fundamentals 3.1 Basic Language Elements 3.1.1 First Assembly Language Program 3.1.2 Integer Literals 3.1.3 Constant Integer Expressions 3.1.4 Real Number Literals 3.1.5 Character Literals 3.1.6 String Literals 3.1.7 Reserved Words 3.1.8 Identifiers 3.1.9 Directives 3.1.10 Instructions 3.1.11 Section Review                       
  • 25. 3.2 Example: Adding and Subtracting Integers 3.2.1 The AddTwo Program 3.2.2 Running and Debugging the AddTwo Program 3.2.3 Program Template 3.2.4 Section Review 3.3 Assembling, Linking, and Running Programs 3.3.1 The Assemble-Link-Execute Cycle 3.3.2 Listing File 3.3.3 Section Review 3.4 Defining Data 3.4.1 Intrinsic Data Types 3.4.2 Data Definition Statement 3.4.3 Adding a Variable to the AddTwo Program 3.4.4 Defining BYTE and SBYTE Data 3.4.5 Defining WORD and SWORD Data 3.4.6 Defining DWORD and SDWORD Data 3.4.7 Defining QWORD Data 3.4.8 Defining Packed BCD (TBYTE) Data 3.4.9 Defining Floating-Point Types 3.4.10 A Program That Adds Variables 3.4.11 Little-Endian Order 3.4.12 Declaring Uninitialized Data                      
  • 26. 3.4.13 Section Review 3.5 Symbolic Constants 3.5.1 Equal-Sign Directive 3.5.2 Calculating the Sizes of Arrays and Strings 3.5.3 EQU Directive 3.5.4 TEXTEQU Directive 3.5.5 Section Review 3.6 Introducing 64-Bit Programming 3.7 Chapter Summary 3.8 Key Terms 3.8.1 Terms 3.8.2 Instructions, Operators, and Directives 3.9 Review Questions and Exercises 3.9.1 Short Answer 3.9.2 Algorithm Workbench 3.10 Programming Exercises 4 Data Transfers, Addressing, and Arithmetic 4.1 Data Transfer Instructions 4.1.1 Introduction 4.1.2 Operand Types 4.1.3 Direct Memory Operands 4.1.4 MOV Instruction 4.1.5 Zero/Sign Extension of Integers                       
  • 27. 4.1.6 LAHF and SAHF Instructions 4.1.7 XCHG Instruction 4.1.8 Direct-Offset Operands 4.1.9 Examples of Moving Data 4.1.10 Section Review 4.2 Addition and Subtraction 4.2.1 INC and DEC Instructions 4.2.2 ADD Instruction 4.2.3 SUB Instruction 4.2.4 NEG Instruction 4.2.5 Implementing Arithmetic Expressions 4.2.6 Flags Affected by Addition and Subtraction 4.2.7 Example Program (AddSubTest) 4.2.8 Section Review 4.3 Data-Related Operators and Directives 4.3.1 OFFSET Operator 4.3.2 ALIGN Directive 4.3.3 PTR Operator 4.3.4 TYPE Operator 4.3.5 LENGTHOF Operator 4.3.6 SIZEOF Operator 4.3.7 LABEL Directive                      
  • 28. 4.3.8 Section Review 4.4 Indirect Addressing 4.4.1 Indirect Operands 4.4.2 Arrays 4.4.3 Indexed Operands 4.4.4 Pointers 4.4.5 Section Review 4.5 JMP and LOOP Instructions 4.5.1 JMP Instruction 4.5.2 LOOP Instruction 4.5.3 Displaying an Array in the Visual Studio Debugger 4.5.4 Summing an Integer Array 4.5.5 Copying a String 4.5.6 Section Review 4.6 64-Bit Programming 4.6.1 MOV Instruction 4.6.2 64-Bit Version of SumArray 4.6.3 Addition and Subtraction 4.6.4 Section Review 4.7 Chapter Summary 4.8 Key Terms 4.8.1 Terms 4.8.2 Instructions, Operators, and Directives                       
  • 29. 4.9 Review Questions and Exercises 4.9.1 Short Answer 4.9.2 Algorithm Workbench 4.10 Programming Exercises 5 Procedures 5.1 Stack Operations 5.1.1 Runtime Stack (32-Bit Mode) 5.1.2 PUSH and POP Instructions 5.1.3 Section Review 5.2 Defining and Using Procedures 5.2.1 PROC Directive 5.2.2 CALL and RET Instructions 5.2.3 Nested Procedure Calls 5.2.4 Passing Register Arguments to Procedures 5.2.5 Example: Summing an Integer Array 5.2.6 Saving and Restoring Registers 5.2.7 Section Review 5.3 Linking to an External Library 5.3.1 Background Information 5.3.2 Section Review 5.4 The Irvine32 Library 5.4.1 Motivation for Creating the Library 5.4.2 The Win32 Console Window                       
  • 30. 5.4.3 Individual Procedure Descriptions 5.4.4 Library Test Programs 5.4.5 Section Review 5.5 64-Bit Assembly Programming 5.5.1 The Irvine64 Library 5.5.2 Calling 64-Bit Subroutines 5.5.3 The x64 Calling Convention 5.5.4 Sample Program that Calls a Procedure 5.5.5 Section Review 5.6 Chapter Summary 5.7 Key Terms 5.7.1 Terms 5.7.2 Instructions, Operators, and Directives 5.8 Review Questions and Exercises 5.8.1 Short Answer 5.8.2 Algorithm Workbench 5.9 Programming Exercises 6 Conditional Processing 6.1 Boolean and Comparison Instructions 6.1.1 The CPU Status Flags 6.1.2 AND Instruction 6.1.3 OR Instruction 6.1.4 Bit-Mapped Sets                       
  • 31. 6.1.5 XOR Instruction 6.1.6 NOT Instruction 6.1.7 TEST Instruction 6.1.8 CMP Instruction 6.1.9 Setting and Clearing Individual CPU Flags 6.1.10 Boolean Instructions in 64-Bit Mode 6.1.11 Section Review 6.2 Conditional Jumps 6.2.1 Conditional Structures 6.2.2 Jcond Instruction 6.2.3 Types of Conditional Jump Instructions 6.2.4 Conditional Jump Applications 6.2.5 Section Review 6.3 Conditional Loop Instructions 6.3.1 LOOPZ and LOOPE Instructions 6.3.2 LOOPNZ and LOOPNE Instructions 6.3.3 Section Review 6.4 Conditional Structures 6.4.1 Block-Structured IF Statements 6.4.2 Compound Expressions 6.4.3 WHILE Loops 6.4.4 Table-Driven Selection                      
  • 32. 6.4.5 Section Review 6.5 Application: Finite-State Machines 6.5.1 Validating an Input String 6.5.2 Validating a Signed Integer 6.5.3 Section Review 6.6 Conditional Control Flow Directives (Optional topic) 6.6.1 Creating IF Statements 6.6.2 Signed and Unsigned Comparisons 6.6.3 Compound Expressions 6.6.4 Creating Loops with .REPEAT and .WHILE 6.7 Chapter Summary 6.8 Key Terms 6.8.1 Terms 6.8.2 Instructions, Operators, and Directives 6.9 Review Questions and Exercises 6.9.1 Short Answer 6.9.2 Algorithm Workbench 6.10 Programming Exercises 6.10.1 Suggestions for Testing Your Code 6.10.2 Exercise Descriptions 7 Integer Arithmetic 7.1 Shift and Rotate Instructions 7.1.1 Logical Shifts and Arithmetic Shifts 7.1.2 SHL Instruction                        
  • 33. 7.1.3 SHR Instruction 7.1.4 SAL and SAR Instructions 7.1.5 ROL Instruction 7.1.6 ROR Instruction 7.1.7 RCL and RCR Instructions 7.1.8 Signed Overflow 7.1.9 SHLD/SHRD Instructions 7.1.10 Section Review 7.2 Shift and Rotate Applications 7.2.1 Shifting Multiple Doublewords 7.2.2 Multiplication by Shifting Bits 7.2.3 Displaying Binary Bits 7.2.4 Extracting File Date Fields 7.2.5 Section Review 7.3 Multiplication and Division Instructions 7.3.1 Unsigned Integer Multiplication (MUL) 7.3.2 Signed Integer Multiplication (IMUL) 7.3.3 Measuring Program Execution Times 7.3.4 Unsigned Integer Division (DIV) 7.3.5 Signed Integer Division (IDIV) 7.3.6 Implementing Arithmetic Expressions 7.3.7 Section Review                      
  • 34. 7.4 Extended Addition and Subtraction 7.4.1 ADC Instruction 7.4.2 Extended Addition Example 7.4.3 SBB Instruction 7.4.4 Section Review 7.5 ASCII and Unpacked Decimal Arithmetic 7.5.1 AAA Instruction 7.5.2 AAS Instruction 7.5.3 AAM Instruction 7.5.4 AAD Instruction 7.5.5 Section Review 7.6 Packed Decimal Arithmetic 7.6.1 DAA Instruction 7.6.2 DAS Instruction 7.6.3 Section Review 7.7 Chapter Summary 7.8 Key Terms 7.8.1 Terms 7.8.2 Instructions, Operators, and Directives 7.9 Review Questions and Exercises 7.9.1 Short Answer 7.9.2 Algorithm Workbench 7.10 Programming Exercises                       
  • 35. 8 Advanced Procedures 8.1 Introduction 8.2 Stack Frames 8.2.1 Stack Parameters 8.2.2 Disadvantages of Register Parameters 8.2.3 Accessing Stack Parameters 8.2.4 32-Bit Calling Conventions 8.2.5 Local Variables 8.2.6 Reference Parameters 8.2.7 LEA Instruction 8.2.8 ENTER and LEAVE Instructions 8.2.9 LOCAL Directive 8.2.10 The Microsoft x64 Calling Convention 8.2.11 Section Review 8.3 Recursion 8.3.1 Recursively Calculating a Sum 8.3.2 Calculating a Factorial 8.3.3 Section Review 8.4 INVOKE, ADDR, PROC, and PROTO 8.4.1 INVOKE Directive 8.4.2 ADDR Operator 8.4.3 PROC Directive 8.4.4 PROTO Directive                       
  • 36. 8.4.5 Parameter Classifications 8.4.6 Example: Exchanging Two Integers 8.4.7 Debugging Tips 8.4.8 WriteStackFrame Procedure 8.4.9 Section Review 8.5 Creating Multimodule Programs 8.5.1 Hiding and Exporting Procedure Names 8.5.2 Calling External Procedures 8.5.3 Using Variables and Symbols across Module Boundaries 8.5.4 Example: ArraySum Program 8.5.5 Creating the Modules Using Extern 8.5.6 Creating the Modules Using INVOKE and PROTO 8.5.7 Section Review 8.6 Advanced Use of Parameters (Optional Topic) 8.6.1 Stack Affected by the USES Operator 8.6.2 Passing 8-Bit and 16-Bit Arguments on the Stack 8.6.3 Passing 64-Bit Arguments 8.6.4 Non-Doubleword Local Variables 8.7 Java Bytecodes (Optional Topic) 8.7.1 Java Virtual Machine 8.7.2 Instruction Set 8.7.3 Java Disassembly Examples                      
  • 37. 8.7.4 Example: Conditional Branch 8.8 Chapter Summary 8.9 Key Terms 8.9.1 Terms 8.9.2 Instructions, Operators, and Directives 8.10 Review Questions and Exercises 8.10.1 Short Answer 8.10.2 Algorithm Workbench 8.11 Programming Exercises 9 Strings and Arrays 9.1 Introduction 9.2 String Primitive Instructions 9.2.1 MOVSB, MOVSW, and MOVSD 9.2.2 CMPSB, CMPSW, and CMPSD 9.2.3 SCASB, SCASW, and SCASD 9.2.4 STOSB, STOSW, and STOSD 9.2.5 LODSB, LODSW, and LODSD 9.2.6 Section Review 9.3 Selected String Procedures 9.3.1 Str_compare Procedure 9.3.2 Str_length Procedure 9.3.3 Str_copy Procedure 9.3.4 Str_trim Procedure                       
  • 38. 9.3.5 Str_ucase Procedure 9.3.6 String Library Demo Program 9.3.7 String Procedures in the Irvine64 Library 9.3.8 Section Review 9.4 Two-Dimensional Arrays 9.4.1 Ordering of Rows and Columns 9.4.2 Base-Index Operands 9.4.3 Base-Index-Displacement Operands 9.4.4 Base-Index Operands in 64-Bit Mode 9.4.5 Section Review 9.5 Searching and Sorting Integer Arrays 9.5.1 Bubble Sort 9.5.2 Binary Search 9.5.3 Section Review 9.6 Java Bytecodes: String Processing (Optional Topic) 9.7 Chapter Summary 9.8 Key Terms and Instructions 9.9 Review Questions and Exercises 9.9.1 Short Answer 9.9.2 Algorithm Workbench 9.10 Programming Exercises 10 Structures and Macros 10.1 Structures                       
  • 39. 10.1.1 Defining Structures 10.1.2 Declaring Structure Objects 10.1.3 Referencing Structure Objects 10.1.4 Example: Displaying the System Time 10.1.5 Structures Containing Structures 10.1.6 Example: Drunkard’s Walk 10.1.7 Declaring and Using Unions 10.1.8 Section Review 10.2 Macros 10.2.1 Overview 10.2.2 Defining Macros 10.2.3 Invoking Macros 10.2.4 Additional Macro Features 10.2.5 Using Our Macro Library (32-Bit Mode Only) 10.2.6 Example Program: Wrappers 10.2.7 Section Review 10.3 Conditional-Assembly Directives 10.3.1 Checking for Missing Arguments 10.3.2 Default Argument Initializers 10.3.3 Boolean Expressions 10.3.4 IF, ELSE, and ENDIF Directives 10.3.5 The IFIDN and IFIDNI Directives                      
  • 40. 10.3.6 Example: Summing a Matrix Row 10.3.7 Special Operators 10.3.8 Macro Functions 10.3.9 Section Review 10.4 Defining Repeat Blocks 10.4.1 WHILE Directive 10.4.2 REPEAT Directive 10.4.3 FOR Directive 10.4.4 FORC Directive 10.4.5 Example: Linked List 10.4.6 Section Review 10.5 Chapter Summary 10.6 Key Terms 10.6.1 Terms 10.6.2 Operators and Directives 10.7 Review Questions and Exercises 10.7.1 Short Answer 10.7.2 Algorithm Workbench 10.8 Programming Exercises 11 MS-Windows Programming 11.1 Win32 Console Programming 11.1.1 Background Information 11.1.2 Win32 Console Functions                       
  • 41. 11.1.3 Displaying a Message Box 11.1.4 Console Input 11.1.5 Console Output 11.1.6 Reading and Writing Files 11.1.7 File I/O in the Irvine32 Library 11.1.8 Testing the File I/O Procedures 11.1.9 Console Window Manipulation 11.1.10 Controlling the Cursor 11.1.11 Controlling the Text Color 11.1.12 Time and Date Functions 11.1.13 Using the 64-Bit Windows API 11.1.14 Section Review 11.2 Writing a Graphical Windows Application 11.2.1 Necessary Structures 11.2.2 The MessageBox Function 11.2.3 The WinMain Procedure 11.2.4 The WinProc Procedure 11.2.5 The ErrorHandler Procedure 11.2.6 Program Listing 11.2.7 Section Review 11.3 Dynamic Memory Allocation 11.3.1 HeapTest Programs                      
  • 42. 11.3.2 Section Review 11.4 32-Bit x86 Memory Management 11.4.1 Linear Addresses 11.4.2 Page Translation 11.4.3 Section Review 11.5 Chapter Summary 11.6 Key Terms 11.7 Review Questions and Exercises 11.7.1 Short Answer 11.7.2 Algorithm Workbench 11.8 Programming Exercises 12 Floating-Point Processing and Instruction Encoding 12.1 Floating-Point Binary Representation 12.1.1 IEEE Binary Floating-Point Representation 12.1.2 The Exponent 12.1.3 Normalized Binary Floating-Point Numbers 12.1.4 Creating the IEEE Representation 12.1.5 Converting Decimal Fractions to Binary Reals 12.1.6 Section Review 12.2 Floating-Point Unit 12.2.1 FPU Register Stack 12.2.2 Rounding 12.2.3 Floating-Point Exceptions                       
  • 43. 12.2.4 Floating-Point Instruction Set 12.2.5 Arithmetic Instructions 12.2.6 Comparing Floating-Point Values 12.2.7 Reading and Writing Floating-Point Values 12.2.8 Exception Synchronization 12.2.9 Code Examples 12.2.10 Mixed-Mode Arithmetic 12.2.11 Masking and Unmasking Exceptions 12.2.12 Section Review 12.3 x86 Instruction Encoding 12.3.1 Instruction Format 12.3.2 Single-Byte Instructions 12.3.3 Move Immediate to Register 12.3.4 Register-Mode Instructions 12.3.5 Processor Operand-Size Prefix 12.3.6 Memory-Mode Instructions 12.3.7 Section Review 12.4 Chapter Summary 12.5 Key Terms 12.6 Review Questions and Exercises 12.6.1 Short Answer 12.6.2 Algorithm Workbench                      
  • 44. 12.7 Programming Exercises 13 High-Level Language Interface 13.1 Introduction 13.1.1 General Conventions 13.1.2 .MODEL Directive 13.1.3 Examining Compiler-Generated Code 13.1.4 Section Review 13.2 Inline Assembly Code 13.2.1 __asm Directive in Visual C++ 13.2.2 File Encryption Example 13.2.3 Section Review 13.3 Linking 32-Bit Assembly Language Code to C/C++ 13.3.1 IndexOf Example 13.3.2 Calling C and C++ Functions 13.3.3 Multiplication Table Example 13.3.4 Section Review 13.4 Chapter Summary 13.5 Key Terms 13.6 Review Questions 13.7 Programming Exercises 14 16-Bit MS-DOS Programming 622 14.1 MS-DOS and the IBM-PC 14.1.1 Memory Organization                       
  • 45. 14.1.2 Redirecting Input-Output 14.1.3 Software Interrupts 14.1.4 INT Instruction 14.1.5 Coding for 16-Bit Programs 14.1.6 Section Review 14.2 MS-DOS Function Calls (INT 21h) 14.2.1 Selected Output Functions 14.2.2 Hello World Program Example 14.2.3 Selected Input Functions 14.2.4 Date/Time Functions 14.2.5 Section Review 14.3 Standard MS-DOS File I/O Services 14.3.1 Create or Open File (716Ch) 14.3.2 Close File Handle (3Eh) 14.3.3 Move File Pointer (42h) 14.3.4 Get File Creation Date and Time 14.3.5 Selected Library Procedures 14.3.6 Example: Read and Copy a Text File 14.3.7 Reading the MS-DOS Command Tail 14.3.8 Example: Creating a Binary File 14.3.9 Section Review 14.4 Chapter Summary                      
  • 46. 14.5 Programming Exercises 15 Disk Fundamentals 15.1 Disk Storage Systems 15.1.1 Tracks, Cylinders, and Sectors 15.1.2 Disk Partitions (Volumes) 15.1.3 Section Review 15.2 File Systems 15.2.1 FAT12 15.2.2 FAT16 15.2.3 FAT32 15.2.4 NTFS 15.2.5 Primary Disk Areas 15.2.6 Section Review 15.3 Disk Directory 15.3.1 MS-DOS Directory Structure 15.3.2 Long Filenames in MS-Windows 15.3.3 File Allocation Table (FAT) 15.3.4 Section Review 15.4 Reading and Writing Disk Sectors 15.4.1 Sector Display Program 15.4.2 Section Review 15.5 System-Level File Functions 15.5.1 Get Disk Free Space (7303h)                       
  • 47. 15.5.2 Create Subdirectory (39h) 15.5.3 Remove Subdirectory (3Ah) 15.5.4 Set Current Directory (3Bh) 15.5.5 Get Current Directory (47h) 15.5.6 Get and Set File Attributes (7143h) 15.5.7 Section Review 15.6 Chapter Summary 15.7 Programming Exercises 15.8 Key Terms 16 BIOS-Level Programming 16.1 Introduction 16.1.1 BIOS Data Area 16.2 Keyboard Input with INT 16h 16.2.1 How the Keyboard Works 16.2.2 INT 16h Functions 16.2.3 Section Review 16.3 Video Programming with INT 10h 16.3.1 Basic Background 16.3.2 Controlling the Color 16.3.3 INT 10h Video Functions 16.3.4 Library Procedure Examples 16.3.5 Section Review 16.4 Drawing Graphics Using INT 10h                       
  • 48. 16.4.1 INT 10h Pixel-Related Functions 16.4.2 DrawLine Program 16.4.3 Cartesian Coordinates Program 16.4.4 Converting Cartesian Coordinates to Screen Coordinates 16.4.5 Section Review 16.5 Memory-Mapped Graphics 16.5.1 Mode 13h: 320 * 200, 256 Colors 16.5.2 Memory-Mapped Graphics Program 16.5.3 Section Review 16.6 Mouse Programming 16.6.1 Mouse INT 33h Functions 16.6.2 Mouse Tracking Program 16.6.3 Section Review 16.7 Chapter Summary 16.8 Programming Exercises A MASM Reference B The x86 Instruction Set C BIOS and MS-DOS Interrupts D Answers to Review Questions (Chapters 14–16) Glossary ASCII Character Reference Charts Supplemental Materials                      
  • 51. Chapter Outline Welcome to Assembly Language 1.1  Questions You Might Ask 1.1.1  Assembly Language Applications 1.1.2  Section Review 1.1.3  Virtual Machine Concept 1.2  Section Review 1.2.1  Data Representation 1.3  Binary Integers 1.3.1  Binary Addition 1.3.2  Integer Storage Sizes 1.3.3  Hexadecimal Integers 1.3.4  Hexadecimal Addition 1.3.5  Signed Binary Integers 1.3.6  Binary Subtraction 1.3.7  Character Storage 1.3.8  Binary-Coded Decimal (BCD) Numbers 1.3.9  Section Review 1.3.10  Boolean Expressions 1.4  Truth Tables for Boolean Functions 1.4.1  Section Review 1.4.2 
  • 52. This chapter establishes some core concepts relating to assembly language programming. For example, it shows how assembly language fits into the wide spectrum of languages and applications. We introduce the virtual machine concept, which is so important in understanding the relationship between software and hardware layers. A large part of the chapter is devoted to the binary and hexadecimal numbering systems, showing how to perform conversions and do basic arithmetic. Finally, this chapter introduces fundamental Boolean operations (AND, OR, NOT, XOR), which will prove to be essential in later chapters. Chapter Summary 1.5  Key Terms 1.6  Review Questions and Exercises 1.7  Short Answer 1.7.1  Algorithm Workbench 1.7.2 
  • 53. 1.1 Welcome to Assembly Language Assembly Language for x86 Processors focuses on programming microprocessors compatible with Intel and AMD processors running under current versions of Microsoft Windows. The latest version of Microsoft Macro Assembler (known as MASM) should be used with this book. MASM is included with Microsoft Visual Studio . Please check our website (www.asmirvine.com) for the latest details about using MASM in Visual Studio. Assembly language is the oldest programming language, and of all languages, bears the closest resemblance to native machine language. It provides direct access to computer hardware, requiring you to understand much about your computer’s architecture and operating system. Educational Value Why read this book? Perhaps you’re taking a college course whose title is similar to one of the following courses that often use our book: Microcomputer Assembly Language Assembly Language Programming Introduction to Computer Architecture Fundamentals of Computer Systems Embedded Systems Programming This book will help you learn basic principles about computer architecture, machine language, and low-level programming. You will learn enough assembly language to test your knowledge on today’s most widely used microprocessor family. You won’t be learning to program a   
  • 54. “toy” computer using a simulated assembler; MASM is an industrial- strength assembler, used by practicing professionals. You will learn the architecture of the Intel processor family from a programmer’s point of view. If you are planning to be a C or C++ developer, you need to develop an understanding of how memory, address, and instructions work at a low level. A lot of programming errors are not easily recognized at the high- level language level. You will often find it necessary to “drill down” into your program’s internals to find out why it isn’t working. If you doubt the value of low-level programming and studying details of computer software and hardware, take note of the following quote from a leading computer scientist, Donald Knuth, in discussing his famous book series, The Art of Computer Programming: Some people [say] that having machine language, at all, was the great mistake that I made. I really don’t think you can write a book for serious computer programmers unless you are able to discuss low-level detail. Visit this book’s website to get lots of supplemental information, tutorials, and exercises at www.asmirvine.com. 1.1.1 Questions You Might Ask What Background Should I Have? Before reading this book, you should have programmed in at least one structured high-level language, such as Java, C, Python, or C++. You should know how to use IF statements, arrays, and functions to solve programming problems. What Are Assemblers and Linkers? 1
  • 55. Random documents with unrelated content Scribd suggests to you:
  • 56. put down two cards from the pack. Cecilio chose one, I took the other; then, after laying down half a dozen cards in succession, I won the first albur. Not a frown crossed Cecilio's face; and, for my part, I thought that fortune was going to befriend me for once in my life, but I lost the second throw. The third albur remained, which would decide the affair. While thus engaged, we had not perceived two horsemen who were advancing toward us. I did not see them, for my part, till they were almost at my side. The sound of their voices caused me to raise my head, and at a single glance I saw in one of the new-comers a perfect specimen of the Jarocho.[51] He wore in all its purity the peculiar costume of this class of men, a straw hat with a broad brim turned up behind, a fine linen shirt with cambric frills, without any vest above it, a pair of blue cotton velvet breeches open at the knee, and falling in a point to the middle of his leg. In a belt of Chinese crape of a scarlet color hung a straight sword (machete), without guard or sheath, the sharp and glittering blade of which sparkled in the sun. His feet, which were bare, were held in the wooden stirrup only by the tips of his toes. This Jarocho, his head inclined indolently upon one shoulder, sat his horse in the attitude peculiar to people of his caste, whose easy manner and unconstrained demeanor suited him to perfection. His complexion partook equally of the darkness of the negro and the copper color of the Indian. It was a more difficult matter to define precisely what the other cavalier was, who was habited in an Indian robe, blue pantaloons, and bottines of Cordovan leather, while a rich hat of Jipijapa straw[52] sheltered him from the rays of the sun. His face, with a slight tinge of sternness in it, might have become equally well a merchant, a horse-dealer, or a highwayman, and the easy-going horse that he bestrode seemed to suit equally all three suppositions. Two gamesters at play, wherever they may be, are always an agreeable sight for Mexicans of all classes, and, to my great annoyance, the two horsemen stopped short to look at us. I sat quite motionless with the cards in my hand, and was much confused
  • 57. at being surprised at an occupation so contrary to my habits. As no stake was visible, however, I flattered myself that I would be able to keep up appearances so far as to make them believe that it was only the most innocent pastime; but I had to do with men who are acute judges of human character. "Might I ask if this beautiful horse is the stake?" asked the horseman in the Indian robe, saluting me, and accompanying his request with a piercing look. "Exactly so," I answered. "In that case you are playing high, señor," replied the cavalier; "and if, as I fancy, the horse is your own, I wish Fortune may be propitious to you; but would you not like any body to help you with their advice?" "I prefer finishing the game as I commenced it. I have always remarked that I have more luck when there is no one by." The cavalier was too much of a gamester himself not to see at once the full force of my scruples, and, turning to his companion, said, "'Tis as well as it is. Time presses. We must part here, although, if I have time, you may trust on my rejoining you at the fandango of Manantial; still, to speak truth, if certain infallible signs do not deceive me, the north wind will not be long in beginning to blow." "To-morrow, then, if it is possible," answered the Jarocho; and the two cavaliers separated, the first following the direct road, while the horseman in the Indian robe took a path on the left. "What the devil has the north wind to do with a fandango in a little village?" I asked, mechanically, of my valet. "The cavalier in the Indian robe is perhaps afraid of catching cold," said Cecilio, with an affected air. After this absurd explanation, we again began the game which had been so unexpectedly interrupted. I once more drew two cards out
  • 58. of the pack. One was the sota de bastos (knave of clubs). Cecilio chose it. I shuffled the cards this time with a trembling hand. My heart beat. Perhaps I was going to lose the daily companion of five long years. Cecilio wiped away the sweat which ran in streams down his forehead. Suddenly he uttered a cry which pierced to my innermost core. I was just turning up the knave of hearts. "You have lost, sir!" cried he. At these words, spoken in good French, I regarded Cecilio with mute surprise. He, meanwhile, stepping up proudly to my horse, put his foot in the stirrup, and was going to spring upon Storm's back. "Stop!" I cried; "the saddle does not go with the animal." I then ordered him to take the saddle off, and to put it on the back of the other horse. Cecilio executed this order, which would probably be the last he would ever receive from his old master, with sufficient readiness and good will. This done, he mounted that horse which was no longer mine. I cursed my folly, but it was too late. A feeling of pride, however, kept me from showing the remorse I felt; and, to hide my chagrin, I asked Cecilio how he had managed to pick up so much French without my knowledge. "I have not been behind the chair of your lordship," he replied, "especially when you dined with your countrymen, without acquiring some of the language; and as for making you acquainted with that fact, I was too wide awake. Your lordship, from that time, would have kept your secrets to yourself." Cecilio was evidently like one of that class of valets who figure so largely in the picaresque romances of Spain. More than once he had reminded me of Ambrosio of Lamela in Gil Blas. His physiognomy had not deceived me. However, in spite of the impudence which he here manifested for the first time, he seemed, when the parting moment came, to suffer considerably. It was natural, in fact, to show some emotion when he was leaving a master who had used him
  • 59. kindly. Moved by this token of feeling on his part, I showed that I was not without some affection for him. "Cecilio, my friend," I said, "the horse you have won from me would have been yours before many days had passed. Are you grieved because you have been the means of taking him from me?" Cecilio squeezed out a tear. "The truth is," said he, "I regret seeing your beautiful saddle on the back of such a sorry brute, and I am ashamed at the miserable appointments that the horse I have won is provided with. But, if your lordship is in the humor, would it suit you to play for the saddle and bridle?" This was too much. Overcome by this last piece of ingratitude, "Take care," I cried, cocking a pistol, "that I do not take back a horse which you are not worthy to mount." Cecilio made no other reply to this threat than by spurring his horse and whistling on the Spanish dog, which had looked upon this scene with a painful air of dumb anxiety. I whistled also. Thus forced to choose between two parties whom he had affectionately loved all his life, the poor animal hesitated. He ran up to Storm, and then came back to me with a most pitying expression in his face. The convulsive movements of his body betrayed his anguish, and showed the struggle that was going on within. His limbs shook for an instant; he then gave three convulsive howls, darted-from me, and was soon lost in the dust raised by his much-loved companion. I remained alone. My heart was in a storm of rage and grief, and I was even tempted to vent my ill-humor on the miserable hack that fortune had left me, but this weakness lasted only for a moment. I had learned, in the many crosses incident to a life of stirring adventure, the difficult virtue of resignation, and the different phases of this sentimental episode had been accompanied by circumstances so ludicrous that I finished by throwing myself on the grass and bursting into a violent fit of laughter.
  • 60. FOOTNOTES: [47] The women of Jalapa are renowned throughout the whole republic for their beauty and grace, and their taste in fêtes, music, and flowers is unrivaled. [48] These huts are constructed of bamboos, wattled so as to admit both air and light freely. [49] Before the independence of Mexico this bridge was called Puente del Rey (the King's Bridge). [50] The game called monte is thus divided. [51] The peasants of the sea-coast and the country round Vera Cruz are so called. [52] These hats, which take their name from the place where they are made, are often worth from £10 to £12 each. CHAPTER II. I arrive at Manantial.—Superstitions of the Jarochos. The unfortunate occurrence recorded in the preceding chapter caused me to change my route. It was impossible for me to reach Vera Cruz that day, mounted as I was; so I resolved to pass the night at Manantial, a little village which I supposed to be not more than a mile off. I had thus some time before me, and I thought it could not be better employed than in taking a siesta under the shade of the trees, amid the green solitude in which I found myself. It was a spot in one of the most picturesque forests which cover almost the entire country between Puente Nacional and Vergara. Amid these matted thickets, narrow paths, cut by the hatchet, run in different directions, overshadowed by the almost impenetrable
  • 61. foliage of the trees, while a wall of luxuriant vegetation on each side bars every where the entrance of man, and almost that of the fallow deer. The long, pendent branches twist and interlace their tendrils with the boughs of the neighboring trees. The cocoa-nut-tree covers, with its large leaves, its necklace of green fruit; and the Bourbon palms stretch their branches, covered with shining foliage to the ground; the silk-cotton-tree shows its white flakes of cotton just bursting from the dark green pod. In the deep shade of these inhabitants of the forest the friar's cowl abounds with its polished chalice; and at the bottom, as well as the top of this green vault, the gobeas hang their little bell-flowers of variegated colors. Such is the aspect of these woods—an appearance, however, which assumes a different phase according to the hour of the day. At midday the rank vegetation droops under the scorching rays of the sun, from the palm, with its towering crest, to the lowly moss which covers the ground. A hot breeze at that time rushes through the thickets, and appears to arrest every where the progress of vegetation; wild beasts, birds, insects, and plants—all animated nature, in fact, seems to languish under this stifling heat; but when the sun's rays no longer gild the tree-tops, and the vapors rise slowly from the ground, to fall back again in dew, these forests and their denizens, once so silent, start again into life. Overcome by the powerful influence of the sun, I fell fast asleep without any thought about my horse. The pettiest thief, indeed, would have been ashamed of such booty; and I was, besides, in a district where no stain of dishonesty rested on the character of the inhabitants. The sun was yet high in the horizon when I awoke, but a refreshing breeze was beginning to temper the sultry heat. High up amid the branches of the trees which sheltered me, the paroquets had begun their discordant noises, and their infernal melody was of such a kind as to annoy even the strongest nerves. I got impatient; and, hastily bestriding the wretched animal which supplied the place of my excellent Storm, set out on the beaten path that led to Manantial.
  • 62. After riding slowly and painfully along for about half an hour, the shrill croaking of the paroquets always paining my ears, I perceived a horseman a little way in advance. This cavalier, attired exactly like one of those who had interrupted Cecilio and me at our game, seemed, like myself, to be quite out of humor. He rode, as all the Jarochos do, with his body inclined more to one side of the saddle than the other. His horse shuffled slowly along, and every now and then he held up his fist to the skies in all the fury of passion. Delighted that chance had sent me a companion in misfortune, I wished to offer him my hearty condolence, and succeeded in that design beyond my expectation. Scarcely had I managed, by dint of hard spurring, to make up to him, than a loud ringing laugh replaced the mental irritation in which I thought he had been indulging a minute before. "May I ask if you are laughing at me?" I said, abruptly; for, in the bad humor I was in, this hilarity seemed quite out of place. "At you? No, Señor Cavalier," answered the Jarocho. "But you will excuse me if, at sight of your horse, I bid adieu for a time to all customary politeness." "My horse is in no worse condition than the andante[53] you are on," I replied, almost choking. "You may think so; but that hack of yours is a mere bag of bones, and it is no small satisfaction to me to find one worse mounted than myself." The horseman then began to laugh in such a merry, unconstrained fashion, that, tickled with the very absurdity of the thing, I could not help joining him, and we had a good hearty laugh together. The squabbling of the paroquets, struck with the unusual noise, ceased all of a sudden. They recommenced their ear-splitting cries, till at last I discharged a pistol at random among the foliage. To my great surprise, a bird fell at my feet. "Did you take aim at it?" asked the astonished Jarocho.
  • 63. "Of course," I replied, sharply; "and this will serve to show you that it is not altogether safe to jest with people you don't know." At these words the Jarocho stopped his horse, and, straightening himself in his saddle, placed one hand upon his haunch, and pulled his straw hat over his eyes with the other. He then cried out, "Oigajte, ñor deconocio.[54] I am of a caste and of a country where words are few, and whose actions are prompt. I did not mean to offend you; but if you seek a quarrel, I shall not flinch. In spite of the disparity of our weapons, I am not afraid to try which of us is the better man." He hummed a tune, drew his sharp sword from the leathern belt which encircled his waist, and flourished it in the air. I likewise drew my sabre. The idea of crossing swords, mounted as we were on such sorry jades, was so absurd, that we at last burst into a mutual roar of laughter, which ended the matter. I then hastened to explain to the Jarocho that I had no inimical feeling toward him. He held out his hand. "I am glad you are satisfied," he replied, "for I should have been very sorry to have an enemy in one so brave as you appear to be, as at present I have a more serious quarrel on my hands." We then rode along together quite amicably. To turn the conversation, recalling, besides, to my recollection the parting words of the two horsemen at the cross-road, I said, in a careless kind of a tone, "Isn't there to be a fandango at Manantial to-morrow?" "There is, confound it! I promised ña[55] Sacramenta a bow of red ribbons for the occasion, and there is not a bit to be had in all the neighborhood. At the very moment you joined me I was cursing my unlucky star. Probably you are yourself going to the fandango?" "Well, I am; but chance alone brought me to think of it, for I had reckoned on sleeping to-night at Vera Cruz, had not an unfortunate
  • 64. occurrence come in the way." "You will have no cause to regret it, I hope, for the crowd will be as thick as smoke. But where will you put up at Manantial? There is no inn in the place." "With you, perhaps, since you appear to be so desirous to have me at the fête." The Jarocho bowed in token of assent, and then began to give me an account of the numerous pleasures that awaited me on the morrow. Conversing thus, we reached Manantial. Night had come. A few scattered lights gleaming from among the green foliage announced our approach to the village. We soon reached a little clearing in the wood, dotted with cabins formed of wattled bamboo. This was Manantial. Some men and women, clad in the national costume, were dancing to the monotonous sound of a mandolin, while the mothers were rocking their infants to sleep in hammocks formed of strips of aloe bark. I soon learned the name of my new host. "Ah! it's Calros,"[56] cried they, in a tone as if his arrival had long been looked for. He paid no attention to the greeting of his friends, who advanced to welcome him, but his eye roved about till it rested on the slender and graceful form of a young girl, whose pretty little feet were twinkling merrily in the dance. Her hair, black as ebony, was ornamented with a wreath[57] of suchil flowers, interspersed with fire-flies, whose pale bluish light encircled her forehead with a mysterious and fantastic halo. Draped in a white robe, whose waving folds were every moment blanched by the pale rays of the moon, Sacramenta, with her bare shoulders and variegated hair, looked like a fairy dancing by night in a glade of the forest, when all around is at rest. The almost disdainful glance which she threw at him showed me at once the true state of affairs. The Jarocho waited till the dance was finished, and then advanced toward the girl. By the entreating tone
  • 65. of his voice, it was clear that he was excusing himself about the red ribbons he had promised her. I was too far off to hear his words, but the light which streamed from a neighboring cottage showed me the full expression of her features. It was evident that all Calros's rhetoric had been useless, and he remounted, but with a saddened, irritated air. Sacramenta, in shaking her head to a remark of his, allowed one of the suchil flowers to fall from her chaplet. The Jarocho regarded it for some time with an undecided air; and she, marking his hesitation, and while pressing the wreath on her forehead, in a fit of coquetry, raised the flower on the tip of her tiny foot, and presented it to him. The cloudy countenance of the Jarocho was now lit up with joy; he seized the flower eagerly, spurred his horse, and was soon lost in the darkness. It was quite clear that he had completely forgotten me, but it was as clear that I had no intention of taking up my quarters for the night in the forest. "Halloo! Señor Don Calros," I shouted after him, "you have left me behind." "Pardon me, Señor Cavalier," cried he, pulling up; "but there are times when I am hardly master of myself." "I am convinced of that," I said; "and it is certainly no indiscretion in you to forget a stranger whom you met by the merest chance." "In my country the stranger is at home every where; but you shall not have my hospitality for nothing, for you must pay me either by doing me a particular piece of service, or assisting me with your advice." "With pleasure," I answered, "if it is in my power." The dwelling of the Jarocho, called a jacal, was situated at the other end of the village. A small inclosure, in which a few goats were penned, was attached to it. The cabin was divided into three apartments by reed partitions. In one of these, the mother of the
  • 66. Jarocho was preparing the evening meal over a fire whose reddish glow lighted up the whole jacal. The repast consisted of rice boiled in milk, fried bananas, and red haricots from the Tierra Caliente, which enjoy a proverbial celebrity in Mexico. When supper was ended the old woman left the room, wishing me a pleasant sleep. The distant thrumming of guitars apprised us that the company we had left were still keeping up their merriment. The voice of the Jarocho awoke me from the reverie in which I had been indulging. "Do you see," said he to me, as we were lying at the door of the cabin, "that fleecy mist which dulls the light of the stars? These are the vapors which, at the end of every hot day, arise from the lakes, brooks, and waterfalls. Do you think it possible that, at the command of a mortal like ourselves, this shadowy impalpable fog should assume the form of a friend who has been lost, or an enemy that has been murdered?" "I doubt that much," I replied, astonished at this preamble; "I fancied that these superstitious notions were peculiar only to northern climes." "Here," said Calros, in a solemn tone, "ghosts haunt not the abodes of the living; they love to flit about in the woods, and to frisk among the leaves and flowers. But you smile. Let us talk of something else. Did you see ña Sacramenta this evening?" "The pretty girl with the wreath of cucuyos and the suchil chaplet?" "The same. She is very beautiful, is she not? Six months ago, at a fandango in the neighborhood, a quarrel arose on her account, which was followed by the death of a man. The victim was a relation of mine; and, according to universal custom, it became my duty to avenge his death. I had, besides, an additional inducement in seeking the murderer; he adored Sacramenta, and every one who loves her is my sworn enemy. Twenty times have I persuaded myself into a belief that Sacramenta loved me, and twenty times have I been forced to confess to myself that I was deceived. I feel that I
  • 67. love Sacramenta more than my life—than my honor, perhaps—else I should have been on the murderer's traces long ago; and yet this evening I have even ventured to hope." "Yes, a mere suchil flower may sometimes work miracles," said I, interrupting him. "What!" cried Jarocho, "have you the gift of seeing what no one else has seen?" "I only observed what every body else might have seen, had they chose; but when a man receives a flower from the hand of a girl he loves, he needn't, I think, despair." "Thank Heaven!" cried the Jarocho, cheerfully. "Yet," he added, with a sigh, "this is not the first token I have had from her; to-morrow the illusions of this night may be dispelled. Ever since ña Sacramenta came to live at Manantial I have suffered the utmost tortures of anxiety, and yet vengeance has not been done on my cousin's murderer. I have tried to forget that duty; unluckily, there are others who do not. The dead man's mother reminds me every day of the charge which has devolved upon me. Eight days ago I met the old woman. I wished to avoid her, but it was impossible. She is looked upon as a sort of witch by the people around. On passing me she cried out, 'The dead have better memories than the living.' I asked her what she meant, although I knew full well. 'You will see him to- night,' she replied. In truth, that very evening," Calros continued, in an altered voice, "I was seated at the same place where we now are, Señor Cavalier; the door was open, and my thoughts were engaged about nothing in particular. I was only listening to the voices in the trees and on the wind; a pale white mist was creeping up to the sky, as it is doing now. All at once a cloud came between my eyes and the stars; it took a human form, and the dead man was before me! I saw him distinctly, right in front of me. I closed my eyes, and when I opened them he was gone. You will now understand why I asked you, señor, who, as a European, must be a learned man, if mortals like ourselves can raise the dead."
  • 68. These superstitious notions are not at all prevalent in Mexico, and the Jarochos seem to have a complete monopoly of them. I gently hinted that all this was nothing but the result of a diseased imagination. "I know well," said he, "that the ghost of my deceased relative has not been raised by any human power, but I believe that God himself has sent it to me. I have taken my resolution. I shall not stay in the village a day after to-morrow, although I leave it with a broken heart." "But is there no way of reconciling your duty with your love?" "That can only be done by delegating my powers to a devoted friend. A guest makes a part of the family; and in this quality, señor, you might take my place and seek the murderer, who would not hesitate to give you satisfaction." "That would be too glorious a mission for me, and I fear I should not be successful in the search," I said, modestly; "but I have no objections to accompany you, and aid you in your task." "That is an offer which I will not refuse," Calros answered. "We shall then set out the day after to-morrow." This delicate point settled to our mutual satisfaction, we stretched ourselves under a shed which served as a sort of veranda to the cabin. A gentle breeze was beginning to dissipate the heat of the day. The lizards were silent in the grass; and in the savannas, the wild cattle, by their joyful lowing, testified to the grateful freshness of the night. Lulled by the soft murmur of the twittering leaves, I soon fell asleep. FOOTNOTES: [53] Local synonym for a horse. [54] Listen, Sir Stranger.
  • 69. [55] Abbreviated form of Doña, used in this part of Mexico. [56] Calros, Charles. [57] A head-dress greatly in vogue among Mexican females. CHAPTER III. The Fête of Manantial.—The Combat. The name of Jarochos is given to those peasants who live on the sea-board round Vera Cruz. Their costume bears no resemblance whatever to that of the people around them. The inhabitants of Andalusia wear a dress very similar to theirs, and it is the general opinion, from their manners and character, that they are the descendants of the Gitanos of that Spanish province. Their dialect is, like their attire, strange and singular. It abounds in words of the purest Castilian, interspersed with local terms disfigured by a vicious pronunciation, and can not be understood, even by those who know Spanish, without diligent and careful study. They are impatient of restraint, and, consequently, ill fitted for acting as soldiers or sailors, although well versed in the use of arms, and not unacquainted with the dangers of the sea. It is their love of independence which causes them to prefer the wandering life of the herdsman and the horse- dealer, and the machete plays no unimportant part in all their difficulties. The Jarocho would rather want the most indispensable part of his dress than be deprived of the long, sharp, glittering blade which he wears in his belt. This sabre is more generally in the hand of the Jarocho than at his side. A small point of honor, or the most futile remark, has often been the means of bringing on the most bloody and long-continued series of combats. They are possessed, however, of some rare qualities, which atone for their defects. The Jarocho is temperate, frank, loyal, and hospitable to the whites (by this term he means the higher classes); he looks upon theft with
  • 70. horror; he loves the place of his birth. A stranger to every desire for wealth, he lives contented with a little in the midst of a fertile country where three harvests a year cover the ground, which is sown but not tilled. The inhabitants of the country round Vera Cruz are in general robust and well made. They are strong and muscular; and nature has thrown round their persons an air of elegance in exact harmony with the devotion the Jarocho pays to three things: his horse, his sword, and his mistress. Seven years before my arrival in Mexico, I once had an opportunity of meeting with one of this singular race; but, from want of familiarity with Spanish, I could not well understand his peculiar dialect. As soon as I awoke in the morning, I was reminded, by the handsome and elegant dress of my host, that it was the fête-day of Manantial. A twisted fringe, strung with Venetian pearls, and studded at regular distances with little mirrors, ran round his hat; his shirt, of the finest linen, was embroidered in the most beautiful manner; the buttons of his velvet calzonera at his girdle were made of solid piastres, and those which ran down his legs of reals and half reals. On his feet were half-boots of Cordovan leather. His cortante, [58] polished to the highest degree of brilliancy, hung suspended from his girdle of scarlet silk, and two bows of the same color adorned its hilt. Set out thus to the best advantage, the Jarocho had an air of refinement about him which augured well for his success. In spite of a degree of satisfaction which shone upon his countenance, Calros could not help twirling the end of his mustache with an anxious expression. His joy seemed to be mixed with an alloy of bitterness. I asked him the cause of it. "Ah! if you could only free me of my vow of vengeance, I should be relieved of a charge which will embitter, I fear, all my pleasures." "What! will your oath keep you from drinking, singing, and playing?"
  • 71. "No, but it will hinder me from knocking a fellow down; and what is a fandango without some little quarrel to enliven it? No matter; one can not have all one's pleasures at once. I shall sing louder, play more, and drink as much as will soothe me for the disappointment." I doubted much the calming efficacy of Catalonian brandy, but I affected to believe fully in the power of the remedy. Manantial, like the Jarocho, had put on its holiday garb for the occasion. An unusual stir was visible in the village. At the doors of the cabins, women, arrayed in abundance of muslin and lace, appeared from time to time, decked with gold and coral ornaments, so dear to the swarthy beauties of Southern countries. In a glade, an estrade had been erected for the accommodation of the dancers; little shops had been improvised for the supply of water, tepache, and Catalonian brandy; gambling-tables had been set up. In a few hours the Jarochos from the surrounding villages would come pouring in. The sun was shining full upon the spot in all its dazzling brilliancy. The shadow cast by the palm-trees, already a little off the perpendicular, showed that it was two hours past noon. Crowds of horsemen now began to arrive, who, after alighting, tied their foaming steeds to the trunks of the trees or the pillars of the houses. Horses and men were soon mingled together in strange confusion; the cries of the men, the neighing of the steeds, and the tuning of guitars, were now heard on all sides. Circles were speedily formed round the gambling-tables, the ventorillos,[59] or the estrade reserved for the female dancers. Here I stationed myself. The estrade, on which female dancers were alone to figure, was elevated a few inches above the ground. According to a singular custom prevailing in all the villages round Vera Cruz, the men on this occasion are mere spectators of the women's performances. A Jarocho squatted himself down on the ground close to the estrade, and commenced strumming his mandolin. Eight or ten girls answered to his call, and began to dance. I could not help admiring the graceful dexterity with which many of them carried a glass of water on their heads without spilling a drop, dancing, too, all the
  • 72. while with the greatest vigor; or the agility with which they untied, without using their hands, the silk bows attached to their shoes,[60] When this dance, very coldly applauded, was finished, the guitar struck up a new tune, that of the dance called petenera. This time the estrade was quite full, and among the women who advanced to take a part in this measure I recognized, by her graceful mien and dazzling beauty, Doña Sacramenta, whom my host called, in his flowery language, his dearly-beloved angel on earth. She was attired in a beautiful dress of transparent muslin. Her rounded arms were adorned in the upper part by the embroidery and lace of her cambric chemise, the rest remained bare. The contour of her fair shoulders was masked, but not entirely concealed, by a gorget of lace very like Arlesian. She wore shoes of the most beautiful satin, and a tress of her magnificent black hair was wound round a tortoise-shell comb mounted with massy gold. Her eyelids, cast down under the fiery glances that were shot from all sides at her, allowed one to see the long silken lashes with which they were fringed. She was not now the calm beauty that I had admired the evening before in the moonlight, but an impassioned daughter of the tropics in all her brilliancy. The excitement among the spectators, increased by their frequent libations, became greater and greater every minute, but another and a more intense interest was soon awakened in the minds of the crowd. "Ah!" cried a Jarocho at my side, whose hair was beginning to turn gray, "at the last fandango held at Malibran,[61] Quilimaco lost one of his ears, and Juan de Dios the point of his nose, in a quarrel that arose about a beauty who was not worth a lock of hair compared with that girl there." "Have patience, tio,"[62] answered another; "the beautiful Sacramenta has more than one aspirant in this village, and I venture to predict that, before nightfall, she will have danced the machete and chamarra for two at least among us."
  • 73. I did not understand what they meant, but the events that followed soon explained it. Two groups had by this time formed round the estrade occupied by the dancers. In the first, a Jarocho, as richly dressed as Calros, seemed to exercise a marked ascendency. In the second, my host appeared to be the head of another party. Animated by the hope of some quarrel arising between the two factions, the musicians strummed their guitars with redoubled ardor, and a fearful discord filled the air. Just when the dancers were beginning to put themselves in motion, some singers chanted, in a nasal tone of voice, a couplet whose words bore no relation whatever to the present circumstances, and which consisted of a series of proverbs put in verse, almost devoid of meaning, but strongly tinged with obscene allusions. I was then standing near my host, whose eye was following with a jealous attention the least movement of Sacramenta, but she did not deign to bestow upon him the slightest glance. "You see my hard fate," said he to me, in a low voice; "in high hope one day, in despair the next. We shall set out to-morrow." These last words betrayed such poignant grief that I could not help cursing in my heart that pitiless coquetry which could wound the feelings of so ardent a lover. "Ah!" he resumed, "she has not yet forgiven me for that confounded bow of red ribbons which I was unable to procure for her." At this moment his rival advanced to the estrade, and uncovering, presented his hat to Sacramenta with a very gallant air. She received it with a smile, without interrupting for a moment the evolutions in which she was engaged. Calros's face appeared quite impassible, and he contented himself with making an almost imperceptible gesture to one of his partisans. This person then advanced in his turn and did the same. Custom demanded that, in a case like this, the maiden should show preference to neither; she therefore continued to dance with the two hats in her hand. The advantage of seeing his hat placed upon the head of the dancer would by right
  • 74. belong to the third gallant; and, as I expected, Calros was the one who profited by this usage. The two rivals then exchanged looks of mutual defiance, while the first, untying his sash of China crape, formed it into a rosette, and stepped forward to suspend it to the bare shoulder of Sacramenta. The guitars, now struck with the greatest vigor, made almost as much noise as a band of trumpeters, and the voices of the singers increased in proportion. The men were exchanging looks of evident satisfaction, but the women were chattering among themselves, evidently envying the homage paid to Sacramenta. This young girl kept her feet in motion; her complexion was heightened by a reddish glow, which lent an additional charm to her radiant black eyes. A vague apprehension, however, seemed to agitate her bosom. At once happy and miserable, she dared not turn her eyes upon him whose heart yearned for her with such true affection. In spite, also, of Calros's apparent calm, the involuntary working of the muscles of his face disclosed the torture he was suffering. "Courage!" said I to him, in a whisper; "have you not on your heart the suchil flower?" Calros raised his head, as if the remembrance of that had restored all his confidence. He seized his machete, and went to suspend it at Sacramenta's shoulder. I then understood the meaning of the prediction that I had heard some time before. Sacramenta danced with the machete and chamarra of two of her suitors. It was a singular sight to see a long, sharp, glittering blade dangling from the nude shoulder of the young girl, in such close proximity to her heaving bosom. A sudden silence now fell upon the crowd, similar to what sometimes takes place at a bull-fight when the arena has received its first stains of blood. All at once a loud and imposing male voice near the orchestra exclaimed "Bomba!" The instruments ceased to sound, and the song died away. The voice was that of Calros's rival, who now chanted a couplet expressive of his confidence in his
  • 75. mistress's tenderness, while the friends of the Jarocho repeated the last line in chorus. Calros then answered in a high key by saying that he would not have a divided heart, and that his rival was a traitor. The Jarocho replied in another recitative, by inquiring if he had spirit sufficient to meet him in fair combat. Calros then, with a smile upon his face, expressed his willingness to meet this traitor, this vagabond, this false friend. Whether Sacramenta was weary of the dance, or overcome by the general emotion which was manifested when this last couplet was chanted, I know not, but she stepped hastily from the estrade, and her companions followed her. Instructed by past experience not to wait for the commencement of the melee, as their instruments generally suffer in the fray, the musicians hurriedly retired. Some customary pieces of ceremony were still, however, to be gone through; the suitors must redeem the pledges given to the dancer. The customary fee for these is half a real each. The two rivals advanced, one after the other, and filled both hands of Sacramenta with silver coin. While she was receiving the forfeits, in the midst of murmurs of applause excited by the prodigality of the two Jarochos, and which she could not refuse without being guilty of rudeness, her two little outstretched hands trembled involuntarily, and her pale lips tried, but in vain, to smile. Calros fruitlessly sought a look of encouragement from her. Pale and mute, and evidently laboring under an emotion too powerful for concealment, she kept her eyes fixed upon the ground. The machete would decide the question; and the pleasures of the fête were going to be wound up by my host in spite of his sage resolutions, when an old woman, elbowing her way through the crowd, reminded him of the oath he was about to violate. She was the mother of his dead relative. "It is a shame, ñor Don Calros," cried the beldame, "to take a new quarrel upon you when your cousin's death has not yet been avenged."
  • 76. The Jarocho was evidently taken aback at this unseasonable interruption, and he made all the efforts he could to induce the old woman to retract what she had said, but to all his reasons she had one unvarying reply. "Well, ña Josefita," said Calros at last, good-humoredly, "you are making a great work about nothing, and are mistrusting my good intention; for, if I fight this man, am I not keeping my hand in exercise?" "And should you happen to be run through the body, who will then avenge my son?" "You are right there," replied Calros, thrown off his guard by this argument; "but that's just the way: the women are always mixing themselves up in business that does not concern them. Any one may now take my place," he continued, with an ill-natured air, "if my adversary consent." His rival bowed, and, poising his hat jauntily over his right ear, placed at the same time his hand upon the hilt of his machete, and with his right leg thrown slightly in advance, exclaimed, with an air of haughty condescension, "What do I mean by all this? Will the good folks of Manantial allow it to be said that they suffered their fandango to be terminated without bestowing the customary honors upon their visitors? Now," he continued, his eyes winking with increased rapidity, "if I can not knock a man down for the sweet eyes of ña Sacramenta, I shall forfeit to any one who draws the first blood a bottle of Catalonian brandy." Loud shouts of applause interrupted the orator, who, raising his head with an air of assurance, thus went on: "I must say, however, that, having expended my last real not an hour ago, I can not pay and must conquer. Will any one here fight me on these conditions?" This ridiculous fanfaronade, quite in the spirit of a Jarocho, was welcomed enthusiastically by the by-standers. As for the speaker, looking upon Calros, who was biting his thumbs, he cried
  • 77. impudently, "Come, now, Don Calros, you have no lack of friends to take your place." But the enthusiasm of the crowd had died away. The prospect of paying the forfeit in one's own person, and out of one's own purse, did not appear to be welcomed by any of the on-lookers, and I was not without some apprehension that Calros would revert to his former idea by asking me to become his substitute. Happily, an unexpected incident occurred which saved the honor of the villagers of Manantial. By the same road that I had reached the village the evening before, a horseman was descried galloping along at his utmost speed. All eyes were turned upon the new-comer, who appeared to be a stranger, and whom I recognized as one of the horsemen who had interrupted my game with Cecilio. The unknown alighted, and, without saying a word, tied his horse to one of the wooden pillars of a house; then, still silent, he stepped to the estrade, drew his machete, at whose hilt fluttered a bow of red ribbons, with its point traced a circle in the sand, and then stuck his sword in the centre. A dead silence welcomed this strange visitant. The sword stuck in the ground seemed to me to convey a defiance to all the village. The antagonist desired by the rival of Calros appeared to have stepped in at the proper time. The general gaze was now directed to the former boaster, but he evidently did not feel inclined to take up this unlooked-for challenge. The stranger, who looked like one of those Paladins on whom a vow of silence has been imposed, advanced as haughtily as he had come to one of the ventorillos, called for a glass of brandy, and raised it to his mouth; but, with the air of a man who disdains to assist his courage by artificial stimulants, instead of drinking it, he tossed the liquor over his shoulder. He then cast upon all the by-standers a proud glance of defiance. All the villagers viewed the unknown with admiration, but none seemed so impatient to measure their strength with this brilliant champion as Calros. If the reader remember, he was not in favor
  • 78. with Sacramenta, owing to the affair of the bow of red ribbons. Now at the hilt of the stranger's sword hung a bow of ribbons of the very color she wanted. "Viva!" he whispered to me; "the old woman may go to the devil; Sacramenta shall have her ribbons." He then went and planted his sword beside that of the unknown. The challenge was accepted. The stranger courteously carried his hand to his hat, and, having considered his adversary for a moment, cast a rapid look among the group of females, as if singling out some one on whom to bestow the homage of his valor. He was not long in discovering the beautiful Sacramenta, and, stepping toward her, exclaimed, with admirable self-possession, "The fandangoes of Medellin have lost all their attraction since ña Sacramenta is no longer there to enliven them with her presence. May I flatter myself that she has not forgotten them, and one of her most fervent apasionados?" The young woman was going to reply, when Calros, whose jealousy was ever awake, approached the unknown, and said, "Pardon me, Señor Cavalier, but I have a particular liking for red ribbons. Will you surrender those that adorn your machete as forfeit for the first blood drawn?" "With pleasure," answered the stranger. "I should hardly have ventured to offer them in homage to Doña Sacramenta; henceforth they shall have a certain value in my eyes, as being the price of blood shed for her." After saying these words with a gracious smile, he uncovered himself, and plucked his sword out of the ground. Calros did so too. A polite altercation then took place between them as to who should be the first to place his hat on his head; but this was soon decided by bonneting at the same time. The most experienced of the spectators undertook the task of selecting a spot free from the sun's rays. This done, the combatants stood face to face, the villagers
  • 79. Welcome to our website – the perfect destination for book lovers and knowledge seekers. We believe that every book holds a new world, offering opportunities for learning, discovery, and personal growth. That’s why we are dedicated to bringing you a diverse collection of books, ranging from classic literature and specialized publications to self-development guides and children's books. More than just a book-buying platform, we strive to be a bridge connecting you with timeless cultural and intellectual values. With an elegant, user-friendly interface and a smart search system, you can quickly find the books that best suit your interests. Additionally, our special promotions and home delivery services help you save time and fully enjoy the joy of reading. Join us on a journey of knowledge exploration, passion nurturing, and personal growth every day! ebookbell.com