1. Trang chủ
  2. » Công Nghệ Thông Tin

The art of assembly language

764 1,4K 0

Đ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

Thông tin cơ bản

Định dạng
Số trang 764
Dung lượng 22,22 MB

Nội dung

Đây là bộ sách tiếng anh cho dân công nghệ thông tin chuyên về bảo mật,lập trình.Thích hợp cho những ai đam mê về công nghệ thông tin,tìm hiểu về bảo mật và lập trình.

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 [...]... 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,”... 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... 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,... 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,... and should understand the prerequisites that are needed to start learning new assembly language features in the chapters that follow www.it-ebooks.info AAL2E_03.book Page 2 Thursday, February 18, 2010 12:49 PM 1.1 The Anatomy of an HLA Program A typical HLA program takes the form shown in Figure 1-1 program pgmID ; These identifiers specify the name of the program They must all be the same identifier... 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)... 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... 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... meaningful programs with only a few machine instructions The purpose of this section is to provide a small handful of machine instructions so you can start writing simple HLA assembly language programs right away Without question, the mov instruction is the most oft-used assembly language statement In a typical program, anywhere from 25 percent to 40 percent of the instructions are mov instructions As its name . 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. 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

Ngày đăng: 19/03/2014, 13:43

TỪ KHÓA LIÊN QUAN