logo资料库

The Art of Assembly Language(2nd) 无水印pdf.pdf

第1页 / 共764页
第2页 / 共764页
第3页 / 共764页
第4页 / 共764页
第5页 / 共764页
第6页 / 共764页
第7页 / 共764页
第8页 / 共764页
资料共764页,剩余部分请下载后查看
Cover
Brief Contents
Contents in Detail
Acknowledgements
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
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
2.6: Logical Operations on Bits
2.7: Logical Operations on Binary Numbers and Bit Strings
2.8: Signed and Unsigned Numbers
2.9: Sign Extension, Zero Extension, Contraction, and Saturation
2.10: Shifts and Rotates
2.11: Bit Fields and Packed Data
2.12: An Introduction to Floating-Point Arithmetic
2.13: Binary-Coded Decminal Representation
2.14: Characters
2.15: The Unicode Character Set
2.16: For More Information
3: Memory Access and Organization
3.1: The 80x86 Addressing Modes
3.2: Runtime Memory Organization
3.3: How HLA Allocates Memory for Variables
3.4: HLA Support for Data Alignment
3.5: Address Expressions
3.6: Type Coercion
3.7: Register Type Coercion
3.8: The stack Segment and the push and pop Instructions
3.9: The Stack Is a LIFO Data Structure
3.10: Accessing Data You've Pushed onto the Stack Without Popping It
3.11: Dynamic Memory Allocation and the Heap Segment
3.12: The inc and dec Instructions
3.13: Obtaining the Address of a Memory Object
3.14: For More Information
4: Constants, Variables, and Data Types
4.1: Some Additional Instructions: intmul, bound, into
4.2: HLA Constant and Value Declarations
4.3: The HLA Type Section
4.4: enum and HLA Enumerated Data Types
4.5: Pointer Data Types
4.6: Composite Data Types
4.7: Character Strings
4.8: HLA Strings
4.9: Accessing the Characters Within a String
4.10: The HLA String Module and Other String-Related Routines
4.11: In-Memory Conversions
4.12: Character Sets
4.13: Character Set Implementation in HLA
4.14: HLA Character Set Constants and Character Set Expressions
4.15: Character Set Support in the HLA Standard Library
4.16: Using Character Sets in Your HLA Programs
4.17: Arrays
4.18: Declaring Arrays in Your HLA Programs
4.19: HLA Array Constants
4.20: Accessing Elements of a Single-Dimensional Array
4.21: Sorting an Array of Values
4.22: Multidimensional Arrays
4.23: Allocating Storage for Multidimensional Arrays
4.24: Accessing Multidimensional Array Elements in Assembly Language
4.25: Records
4.26: Record Constants
4.27: Arrays of Records
4.28: Arrays/Records as Record Fields
4.29: Aligning Fields Within a Record
4.30: Pointers to Records
4.31: Unions
4.32: Anonymous Unions
4.33: Variant Types
4.34: Namespaces
4.35: Dynamic Arrays in Assembly Language
4.36: For More Information
5: Procedures and Units
5.1: Procedures
5.2: Saving the State of the Machine
5.3: Prematurely Returning from a Procedure
5.4: Local Variables
5.5: Other Local and Global Symbol Types
5.6: Parameters
5.7: Functions and Function Results
5.8: Recursion
5.9: Forward Procedures
5.10: HLA v2.0 Procedure Declarations
5.11: Low-Level Procedures and the call Instruction
5.12: Procedures and the Stack
5.13: Activation Records
5.14: The Standard Entry Sequence
5.15: The Standard Exit Sequence
5.16: Low-Level Implementation of Automatic (Local) Variables
5.17: Low-Level Parameter implementation
5.18: Procedure Pointers
5.19: Procedural Parameters
5.20: Untyped Reference Parameters
5.21: Managing Large Programs
5.22: The #include Directive
5.23: Ignoring Duplicate #include Operations
5.24: Units and the external Directive
5.25: Namespace Pollution
5.26: For More Information
6: Arithmetic
6.1: 80x86 Integer Arithmetic Instructions
6.2: Arithmetic Expressions
6.3: Logical (Boolean) Expressions
6.4: Machine and Arithmetic Idioms
6.5: Floating-Point Arithmetic
6.6: Converting Floating-Point Expressions to Assembly Language
6.7: HLA Standard Library Support for Floating-Point Arithmetic
6.8: For More Information
7: Low-Level Control Structures
7.1: Low-Level Control Structures
7.2: Statement Labels
7.3: Unconditional Transfer of Control (jmp)
7.4: The Conditional Jump Instructions
7.5: "Medium-Level" Control Structures: jt and jf
7.6: Implementing Common Control Structures in Assembly Language
7.7: Introduction to Decisions
7.8: State Machines and Indirect Jumps
7.9: Spaghetti Code
7.10: Loops
7.11: Performance Improvements
7.12: Hybrid Control Structures in HLA
7.13: For More Information
8: Advanced Arithmetic
8.1: Multiprecision Operations
8.2: Operating on Different-Size Operands
8.3: Decimal Arithmetic
8.4: Tables
8.5: For More Information
9: Macros and the HLA Compile-Time Language
9.1: Introduction to the Compile-Time Language (CTL)
9.2: The #print and #error Statements
9.3: Compile-Time Constants and Variables
9.4: Compile-Time Expressions and Operators
9.5: Compile-Time Functions
9.6: Conditional Compilation (Compile-Time Decisions)
9.7: Repetitive Compilation (Compile-Time Loops)
9.8: Macros (Compile-Time Procedures)
9.9: Writing Compile-Time "Programs"
9.10: Using Macros in Different Source Files
9.11: For More Information
10: Bit Manipulation
10.1: What Is Bit Data, Anyway?
10.2: Instructions That Manipulate Bits
10.3: The Carry Flag as a Bit Accumulator
10.4: Packing and Unpacking Bit Strings
10.5: Coalescing Bit Sets and Distributing Bit Strings
10.6: Packed Arrays of Bit Strings
10.7: Searching for a Bit
10.8: Counting Bits
10.9: Reversing a Bit String
10.10: Merging Bit Strings
10.11: Extracting Bit Strings
10.12: Searching for a Bit Pattern
10.13: The HLA Standard Library Bits Module
10.14: For More Information
11: The String Instructions
11.1: The 80x86 String Instructions
11.2: Performance of the 80x86 String Instructions
11.3: For More Information
12: Classes and Objects
12.1: General Principles
12.2: Classes in HLA
12.3: Objects
12.4: Inheritance
12.5: Overriding
12.6: Virtual Methods vs. Static Procedures
12.7: Writing Class Methods and Procedures
12.8: Object Implementation
12.9: Constructors and Object Initialization
12.10: Destructors
12.11: HLA's _initialize_ and _finalize_ Strings
12.12: Abstract Methods
12.13: Runtime Type Information
12.14: Calling Base Class Methods
12.15: For More Information
ASCII Character Set
Index
AAL2E_03.book Page i Thursday, February 18, 2010 12:49 PM 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.” —SOFTWARE DEVELOPER TIMES “You would be hard-pressed to find a better book on assembly out there.” —SECURITY-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.” —BOOK 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.” —MAINE 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.” —TECHIMO “This big book is a very complete treatment [of assembly language].” —MSTATION.ORG
AAL2E_03.book Page ii Thursday, February 18, 2010 12:49 PM
AAL2E_03.book Page iii Thursday, February 18, 2010 12:49 PM THE ART OF ASSEMBLY LANGUAGE, 2ND EDITION
AAL2E_03.book Page iv Thursday, February 18, 2010 12:49 PM
AAL2E_03.book Page v Thursday, February 18, 2010 12:49 PM THE ART OF ASSEMBLY L ANGUAGE 2ND EDITION by Randall Hyde San Francisco
aal2e_TITLE_COPY.fm Page vi Wednesday, February 24, 2010 12:52 PM 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.
分享到:
收藏