World Headquarters
Jones & Bartlett Learning
5 Wall Street
Burlington, MA 01803
978-443-5000
www.jblearning.com
Jones & Bartlett Learning books and products are available through most bookstores and online booksellers. To contact Jones & Bartlett Learning directly, call 800-832-0034, fax 978-443-8000, or visit our website, www.jblearning.com.
Substantial discounts on bulk quantities of Jones & Bartlett Learning publications are available to corporations, professional associations, and other qualified organizations. For details and specific discount information, contact the special sales department at Jones & Bartlett Learning via the above contact information or send an email to .
Copyright 2015 by Jones & Bartlett Learning, LLC, an Ascend Learning Company
All rights reserved. No part of the material protected by this copyright may be reproduced or utilized in any form, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system, without written permission from the copyright owner.
The content, statements, views, and opinions herein are the sole expression of the respective authors and not that of Jones & Bartlett Learning, LLC. Reference herein to any specific commercial product, process, or service by trade name, trademark, manufacturer, or otherwise does not constitute or imply its endorsement or recommendation by Jones & Bartlett Learning, LLC and such reference shall not be used for advertising or product endorsement purposes. All trademarks displayed are the trademarks of the parties noted herein. Introduction to 80x86 Assembly Language and Computer Architecture, Third Edition, is an independent publication and has not been authorized, sponsored, or otherwise approved by the owners of the trademarks or service marks referenced in this product.
There may be images in this book that feature models; these models do not necessarily endorse, represent, or participate in the activities represented in the images. Any screenshots in this product are for educational and instructive purposes only. Any individuals and scenarios featured in the case studies throughout this product may be real or fictitious, but are used for instructional purposes only.
Production Credits
Chief Executive Officer: Ty Field
President: James Homer
Chief Product Officer: Eduardo Moura
Executive Publisher: William Brottmiller
Publisher: Cathy L. Esperti
Acquisitions Editor: Laura Pagluica
Editorial Assistant: Brooke Yee
Associate Marketing Manager: Cassandra Peterson
Director of Production: Amy Rose
Composition: Laserwords Private Limited, Chennai, India
Cover Design: Kristin E. Parker
Director of Photo Research and Permissions: Amy Wrynn
Cover Image: Lines: echo3005/ShutterStock, Inc.; binary code: echo3005/ShutterStock, Inc.
Printing and Binding: Edwards Brothers Malloy
Cover Printing: Edwards Brothers Malloy
Library of Congress Cataloging-in-Publication Data
Detmer, Richard C.
Introduction to 80X86 assembly language and computer architecture / Richard C. Detmer. Third edition.
pages cm
Includes index.
ISBN 978-1-284-03612-1 (pbk.) ISBN 1-284-03612-X (pbk.) 1. Computer architecture. 2. Assembly languages (Electronic computers) 3. Intel 80x86 series microprocessors. I. Title.
QA76.9.A73D48 2015
004.22dc23
2013034084
6048
Printed in the United States of America
18 17 16 15 14 10 9 8 7 6 5 4 3 2 1
For my mother, Emma Langenhop Detmer Baldwin Toombs, and my uncle,
Carl E. Langenhop, both of whom encouraged me to become a scholar.
The first edition of Introduction to 80x86 Assembly Language and Computer Architec ture emphasized computer architecture over assembly language. In the years since it was published, assembly language use has declined but the need for a computer scientist to understand how the computer works on the inside has not. The Second Edition emphasized basic 80x86 architecture even more than the first. I remain convinced that learning a real instruction set and writing assembly language programs for a real computer are excellent ways to become acquainted with the basics of computer architecture. This emphasis on computer architecture continues with the Third Edition.
New to theThird Edition
The text has been updated to be used with Visual Studio 2012, although it remains compatible with earlier versions of Visual Studio. All programs presented in this book have been tested using Visual Studio 2012, Professional Edition. There are over 100 new exercises and programming exercises. The design has been improved, with clearer layout and easier-to-read illustrations. There has been a major effort to eliminate errors. Ancillary materials include PowerPoint lecture outlines, sample examinations, and answers to all exercises for instructors. Additionally, all program examples in this text are provided for students and instructors on the books website at http://www.jblearning.com/catalog/9781284036121/. The book remains suitable as a standalone text in an assembly language course or as a supplement in a computer architecture course
Features of theSecond Edition
There were several major changes in the Second Edition, also incorporated in the Third Edition. For many people the most significant was the use of the Microsoft Visual Studio environment instead of stand-alone software. Visual Studio is widely used in academic and professional settings, and provides a robust environment for editing, assembling, debugging, and executing programs. Microsoft DreamSpark (https://www.dreamspark.com/) (formerly the Microsoft Academic Alliance) makes Visual Studio and other development software available to academic institutions at very low cost.
The 80x86 microprocessor family has expanded considerably in the past few years. This book continues to emphasize basic architecture; that is, features that are found on most CPUs, not just the 80x86 line. Since 64-bit processors now commonly power new PCs and 64-bit operating systems are now popular, this book includes 64-bit architecture. Much of the time 64-bit instructions are just more of the same, but there are a few major differences. This books topics are arranged so that 64-bit operations can be covered or omitted at the instructors discretion. It is impossible in a textbook to provide full coverage of all 80x86 instructions. Intel provides comprehensive documentation on their website (http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html).
The Second Edition had decreased emphasis on input/output, with corresponding increased emphasis on using the debugger to see what is going on inside the computer. Macros for I/O, macros for converting from an ASCII string to a 2s complement integer, and macros for converting from a 2s complement integer to an ASCII string were included. The macros for I/O used dialog boxes and message boxes instead of console I/O.
, Procedures, was changed to focus on the cdecl protocol. Using a standard protocol makes it possible to cover calling assembly language procedures from a high-level language or an HLL procedure from assembly language. The very different 64-bit procedure protocol was also covered.
, Floating Point Operations, had major updates. Since all current 80x86 CPUs have floating point units, it no longer discussed how to code floating point operations using processors without an FPU. It covered some SSE instructions because these are normally used instead of the FPU for FP operations in 64-bit mode. It omitted inline assembly but includes calling assembly language procedures with floating point parameters from a high-level language.
Next page