The Art of Assembly Language, 2nd Edition pot

764 2.3K 0
The Art of Assembly Language, 2nd Edition pot

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

www.it-ebooks.info www.it-ebooks.info PRAISE FOR THE FIRST EDITION OF THE ART OF ASSEMBLY LANGUAGE “My flat-out favorite book of 2003 was Randall Hyde’s The Art of Assembly Language.” —S OFTWARE DEVELOPER TIMES “You would be hard-pressed to find a better book on assembly out there.” —S ECURITY-FORUMS.COM “This is a large book that is comprehensive and detailed. The author and publishers have done a remarkable job of packing so much in without making the explanatory text too terse. If you want to use assembly language, or add it to your list of programming skills, this is the book to have.” —B OOK NEWS (AUSTRALIA) “Allows the reader to focus on what’s really important, writing programs without hitting the proverbial brick wall that dooms many who attempt to learn assembly language to failure. . . . Topics are discussed in detail and no stone is left unturned.” —M AINE LINUX USERS GROUP-CENTRAL “The text is well authored and easy to understand. The tutorials are thoroughly explained, and the example code segments are superbly commented.” —T ECHIMO “This big book is a very complete treatment [of assembly language].” —M STATION.ORG AAL2E_03.book Page i Thursday, February 18, 2010 12:49 PM www.it-ebooks.info AAL2E_03.book Page ii Thursday, February 18, 2010 12:49 PM www.it-ebooks.info THE ART OF ASSEMBLY LANGUAGE, 2ND EDITION AAL2E_03.book Page iii Thursday, February 18, 2010 12:49 PM www.it-ebooks.info AAL2E_03.book Page iv Thursday, February 18, 2010 12:49 PM www.it-ebooks.info THE ART OF ASSEMBLY L ANGUAGE 2ND EDITION by Randall Hyde San Francisco AAL2E_03.book Page v Thursday, February 18, 2010 12:49 PM www.it-ebooks.info THE ART OF ASSEMBLY LANGUAGE, 2ND EDITION. Copyright © 2010 by Randall Hyde. All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. 14 13 12 11 10 1 2 3 4 5 6 7 8 9 Printed in Canada ISBN-10: 1-59327-207-3 ISBN-13: 978-1-59327-207-4 Publisher: William Pollock Production Editor: Riley Hoffman Cover and Interior Design: Octopod Studios Developmental Editor: William Pollock Technical Reviewer: Nathan Baker Copyeditor: Linda Recktenwald Compositor: Susan Glinert Stevens Proofreader: Nancy Bell For information on book distributors or translations, please contact No Starch Press, Inc. directly: No Starch Press, Inc. 555 De Haro Street, Suite 250, San Francisco, CA 94107 phone: 415.863.9900; fax: 415.863.9950; info@nostarch.com; www.nostarch.com Library of Congress Cataloging-in-Publication Data Hyde, Randall. The art of Assembly language / by Randall Hyde. 2nd ed. p. cm. ISBN 978-1-59327-207-4 (pbk.) 1. Assembler language (Computer program language) 2. Programming languages (Electronic computers) I. Title. QA76.73.A8H97 2010 005.13'6 dc22 2009040777 No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press, Inc. Other product and company names mentioned herein may be the trademarks of their respective owners. Rather than use a trademark symbol with every occurrence of a trademarked name, we are using the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The information in this book is distributed on an “As Is” basis, without warranty. While every precaution has been taken in the preparation of this work, neither the author nor No Starch Press, Inc. shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in it. aal2e_TITLE_COPY.fm Page vi Wednesday, February 24, 2010 12:52 PM www.it-ebooks.info BRIEF CONTENTS Acknowledgments xix Chapter 1: Hello, World of Assembly Language 1 Chapter 2: Data Representation 53 Chapter 3: Memory Access and Organization 111 Chapter 4: Constants, Variables, and Data Types 155 Chapter 5: Procedures and Units 255 Chapter 6: Arithmetic 351 Chapter 7: Low-Level Control Structures 413 Chapter 8: Advanced Arithmetic 477 Chapter 9: Macros and the HLA Compile-Time Language 551 Chapter 10: Bit Manipulation 599 Chapter 11: The String Instructions 633 Chapter 12: Classes and Objects 651 Appendix: ASCII Character Set 701 Index 705 AAL2E_03.book Page vii Thursday, February 18, 2010 12:49 PM www.it-ebooks.info AAL2E_03.book Page viii Thursday, February 18, 2010 12:49 PM www.it-ebooks.info [...]... Chapter 2) Think of memory as a linear array of bytes The address of the first byte is 0 and the address of the last byte is 232−1 For an 80x86 processor, the following pseudo-Pascal array declaration is a good approximation of memory: Memory: array [0 4294967295] of byte; C/C++ and Java users might prefer the following syntax: byte Memory[4294967296]; To execute the equivalent of the Pascal statement... details All of the software you need to compile and run HLA programs can be found at http://www.artofasm.com/ or at http://webster.cs.ucr.edu/ Select High Level Assembly from the Quick Navigation Panel and then the Download HLA link from that page HLA is currently available for Windows, Mac OS X, Linux, and FreeBSD Download the appropriate version of the HLA software for your system From the Download... 1-6 shows the layout of the flags within the lower 16 bits of the EFLAGS register 0 15 Overflow Direction Interrupt Disable Not very interesting to application programmers Sign Zero Auxiliary Carry Parity Carry Figure 1-6: Layout of the FLAGS register (lower 16 bits of EFLAGS) Of the eight flags that are of interest to application programmers, four flags in particular are extremely valuable: the overflow,... variable, you must load one of the variables into a register, add the second operand to the value in the register, and then store the register away in the destination variable Registers are a middleman in nearly every calculation Therefore, registers are very important in 80x86 assembly language programs Another thing you should be aware of is that although the registers have the name “general purpose,”... original plan was to make the necessary changes and get the book out as quickly as possible However, the kind folks at No Starch Press have spent countless hours improving the readability, consistency, and accuracy of this book The second edition you hold in your hands is a huge improvement over the first edition and a large part of the credit belongs to No Starch In particular, the following No Starch... registers The EFLAGS register is a 32-bit register that encapsulates several singlebit boolean (true/false) values Most of the bits in the EFLAGS register are either reserved for kernel mode (operating system) functions or are of little interest to the application programmer Eight of these bits (or flags) are of interest to application programmers writing assembly language programs These are the overflow,... 12:49 PM The #include statement in this program tells the HLA compiler to include a set of declarations from the stdlib.hhf (standard library, HLA Header File) Among other things, this file contains the declaration of the stdout.put code that this program uses The stdout.put statement is the print statement for the HLA language You use it to write data to the standard output device (generally the console)... However, all the statements appearing in programs to this point have been either data declarations or calls to HLA Standard Library routines There hasn’t been any real assembly language Before we can progress any further and learn some real assembly language, a detour is necessary; unless you understand the basic structure of the Intel 80x86 CPU family, the machine instructions will make little sense The Intel... the 80x86 overlays the 32-bit registers with the 16-bit registers, and it overlays the 16-bit registers with the 8-bit registers Figure 1-5 shows this relationship The most important thing to note about the general-purpose registers is that they are not independent Modifying one register may modify as many as three other registers For example, modification of the EAX register may very well modify the. .. Wo rl d of A ss e mbl y L angu age www.it-ebooks.info 3 AAL2E_03.book Page 4 Thursday, February 18, 2010 12:49 PM Indeed, nl (the newline) is really nothing more than a string constant, so (technically) the comma between the nl and the preceding string isn’t necessary You’ll often see the above written as stdout.put( "Hello, World of Assembly Language" nl ); Notice the lack of a comma between the string . www.it-ebooks.info PRAISE FOR THE FIRST EDITION OF THE ART OF ASSEMBLY LANGUAGE “My flat-out favorite book of 2003 was Randall Hyde’s The Art of Assembly Language.” —S OFTWARE. PM www.it-ebooks.info THE ART OF ASSEMBLY LANGUAGE, 2ND EDITION. Copyright © 2010 by Randall Hyde. All rights reserved. No part of this work may be reproduced

Ngày đăng: 23/03/2014, 05:23

Từ khóa liên quan

Mục lục

  • Contents in Detail

  • Acknowledgements

  • Chapter 1: Hello, World of Assembly Language

    • 1.1: The Anatomy of an HLA Program

    • 1.2: Running Your First HLA Program

    • 1.3: Some Basic HLA Data Declarations

    • 1.4: Boolean Values

    • 1.5: Character Values

    • 1.6: An Introduction to the Intel 80x86 CPU Family

    • 1.7: The Memory Subsystem

    • 1.8: Some Basic Machine Instructions

    • 1.9: Some Basic HLA Control Structures

    • 1.10: Introduction to the HLA Standard Library

    • 1.11: Additional Details About try..endtry

    • 1.12: High-Level Assembly Language vs. Low-Level Assembly Language

    • 1.13: For More Information

    • Chapter 2: Data Representation

      • 2.1: Numbering Systems

      • 2.2: The Hexadecimal Numbering System

      • 2.3: Data Organization

      • 2.4: Arithmetic Operations on Binary and Hexadecimal Numbers

      • 2.5: A Note About Numbers vs. Representation

Tài liệu cùng người dùng

Tài liệu liên quan