Example: confidence

Assembly Language for x86 Processors (Sixth edition)

Assembly Language for x86 Processors sixth edition KIP R. IRVINE Florida International UniversitySchool of Computing and Information Sciences Upper Saddle River Boston Columbus San Francisco New York Indianapolis London Toronto Sydney Singapore Tokyo Montreal Dubai Madrid Hong Kong Mexico City Munich Paris Amsterdam Cape Town Vice President and Editorial Director, ECS: Marcia J. HortonEditor-in-Chief: Michael HirschExecutive Editor: Tracy DunkelbergerAssistant Editor: Melinda HaggertyEditorial Assistant: Allison MichaelVice President, Production: Vince O BrienSenior Managing Editor: Scott DisannoProduction Liaison: Jane BonnellProduction Editor: Maheswari PonSaravanan, TexTech InternationalSenior Operations Supervisor: Alan FischerMarketing Manager: Erin DavisMarketing Assistant: Mack PattersonArt Director: Kenny BeckCover Designer: Laura C.

Assembly Language Fundamentals 58 3.1 Basic Elements of Assembly Language 58 3.1.1 Integer Constants 59 3.1.2 Integer Expressions 60 3.1.3 Real Number Constants 61 3.1.4 Character Constants 61 3.1.5 String Constants 61 3.1.6 Reserved Words 62 3.1.7 Identifiers 62 3.1.8 Directives 62 3.1.9 Instructions 63 3.1.10 The NOP (No Operation ...

Tags:

  Processor, Language, Instructions, Edition, Assembly, Sixth, Assembly language, Sixth edition, Assembly language for x86 processors

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Assembly Language for x86 Processors (Sixth edition)

1 Assembly Language for x86 Processors sixth edition KIP R. IRVINE Florida International UniversitySchool of Computing and Information Sciences Upper Saddle River Boston Columbus San Francisco New York Indianapolis London Toronto Sydney Singapore Tokyo Montreal Dubai Madrid Hong Kong Mexico City Munich Paris Amsterdam Cape Town Vice President and Editorial Director, ECS: Marcia J. HortonEditor-in-Chief: Michael HirschExecutive Editor: Tracy DunkelbergerAssistant Editor: Melinda HaggertyEditorial Assistant: Allison MichaelVice President, Production: Vince O BrienSenior Managing Editor: Scott DisannoProduction Liaison: Jane BonnellProduction Editor: Maheswari PonSaravanan, TexTech InternationalSenior Operations Supervisor: Alan FischerMarketing Manager: Erin DavisMarketing Assistant: Mack PattersonArt Director: Kenny BeckCover Designer: Laura C.

2 IerardiCover Image: Color enhanced x-ray of nautilus shell / Bert Myers / Science Photo LibraryArt Editor: Greg DullesMedia Editor: Daniel SandinMedia Project Manager: Danielle LeoneComposition/Full-Service Project Management: TexTech InternationalIA-32, Pentium, i486, Intel64, Celeron, and Intel 386 are trademarks of Intel Corporation. Athlon, Phenom, and Opteronare trademarks of Advanced Micro Devices. TASM and Turbo Debugger are trademarks of Borland 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, VisualC++, and CodeView are registered trademarks of Microsoft Corporation. Autocad is a trademark of Autodesk. Java is atrademark of Sun Microsystems.

3 PartitionMagic is a trademark of Symantec. All other trademarks or product names arethe property of their respective owners. Copyright 2011, 2007, 2003, 1999 by Pearson Education, Inc., Upper Saddle River, New Jersey 07458. All rightsreserved. Manufactured in the United States of America. This publication is protected by Copyright and permissionsshould be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission inany form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission(s) to usematerials from this work, please submit a written request to Pearson Higher Education, Permissions Department, 1 LakeStreet, Upper Saddle River, NJ published as Assembly Language for Intel-Based Computers.

4 The author and publisher of this book have used their best efforts in preparing this book. These efforts include thedevelopment, research, and testing of the theories and programs to determine their effectiveness. The author and pub-lisher make no warranty of any kind, expressed or implied, with regard to these programs or the documentationcontained in this book. The author and publisher shall not be liable in any event for incidental or consequential damages inconnection with, or arising out of, the furnishing, performance, or use of these programs. Library of Congress Cataloging-in-Publication Data Irvine, Kip Language for x86 Processors / Kip R. Irvine. -- 6th ed. of: Assembly Language for intel-based computers, 5th ed., 0-13-602212-X (alk. paper)1. IBM microcomputers--Programming.

5 2. Assembler Language (Computer program Language ) I. Irvine, Kip R. - Assembly Language for intel-based computers. II. Title. : 978-0-13-602212-1 ISBN-10: 0-13-602212-X 10987654321 To Jack and Candy IrvineThis page intentionally left blank v Contents Preface xix 1 Basic Concepts 1 to Assembly Language 1 Questions to Ask Language Applications Review 6 Machine Concept 7 Review 9 Representation 9 Integers Addition Storage Sizes Integers Integers Storage Review 19 Operations 22 Tables for Boolean Functions Review 26 Summary 27 Tasks Tasks 27 2 x86 processor Architecture 29 Concepts 29 Microcomputer Design Execution Cycle from Memory Programs Run Review 35 viContents Architecture Details 36 of Operation Execution Environment Unit of Intel Microprocessors Review 42 Memory Management 43

6 Mode Mode Review 47 of a Typical x86 Computer 48 Output Ports and Device Interfaces Review 52 System 52 of I/O Access Review 55 Summary Exercises 57 3 Assembly Language Fundamentals 58 Elements of Assembly Language 58 Constants Expressions Number Constants Constants Constants Words The NOP (No Operation) Instruction Section Review 66 : Adding and Subtracting Integers 66 Version of AddSub Template Review 70 , Linking, and Running Programs 71 Assemble-Link-Execute Cycle Review 77 Contentsvii Data 77 Data Types Definition Statement BYTE and SBYTE Data WORD and SWORD Data DWORD and SDWORD Data QWORD Data Packed Binary Coded Decimal (TBYTE) Data Real Number Data Endian Order Adding Variables to the AddSub Program Declaring Uninitialized Data Section Review 85 Constants 86 Directive the Sizes of Arrays and Strings Directive Directive Review 90 Mode Programming (Optional)

7 90 Changes 90 Summary Exercises 92 4 Data Transfers, Addressing,and Arithmetic 94 Transfer instructions 94 Types Memory Operands Instruction Extension of Integers and SAHF instructions Instruction Operands Program (Moves) Section Review 103 and Subtraction 104 and DEC instructions Instruction Instruction Instruction 105 viiiContents Arithmetic Expressions Affected by Addition and Subtraction Program (AddSub3) Review 111 Operators and Directives 112 Operator Directive Operator Operator Operator Operator Directive Review 117 Addressing 117 Operands Operands Review 123 and LOOP instructions 124 Instruction Instruction an Integer Array a String Review 127 Summary Exercises 129 5 Procedures 132 to an External Library 132 Information Review 134 Book s Link Library 134 Procedure Descriptions Test Programs Review 157 Operations 157 Stack and POP instructions Review 162 Contentsix and Using Procedures 163 Directive and RET instructions .

8 Summing an Integer Array and Restoring Registers Review 171 Design Using Procedures 172 Summation Program (Design) Summation Implementation Review 177 Summary Exercises 178 6 Conditional Processing 180 and Comparison instructions 181 CPU Flags Instruction Instruction Sets Instruction Instruction Instruction Instruction and Clearing Individual CPU Flags Section Review 189 Jumps 190 Structures cond Instruction of Conditional Jump instructions Jump Applications Review 199 Loop instructions 200 and LOOPE instructions and LOOPNE instructions Review 201 Structures 202 IF Statements Expressions Loops Selection Review 210 xContents.

9 Finite-State Machines 211 an Input String a Signed Integer Review 216 Control Flow Directives 217 IF Statements and Unsigned Comparisons Expressions Loops with .REPEAT and .WHILE 223 Summary Exercises 225 7 Integer Arithmetic 229 and Rotate instructions 230 Shifts and Arithmetic Shifts Instruction Instruction and SAR instructions Instruction Instruction and RCR instructions Overflow instructions Section Review 238 and Rotate Applications 239 Multiple Doublewords Multiplication Binary Bits MS-DOS File Date Fields Review 243 and Division instructions 243 Instruction Instruction Program Execution Times Instruction Integer Division Arithmetic Expressions Review 255 Addition and Subtraction 256 Instruction Addition Example 257 Contentsxi Instruction Review 259 and Unpacked Decimal Arithmetic 260 Instruction

10 Instruction Instruction Instruction Review 264 Decimal Arithmetic 264 Instruction Instruction Review 266 Summary Exercises 267 8 Advanced Procedures 270 Frames 271 Parameters Stack Parameters Variables and LEAVE instructions Directive Review 289 290 Calculating a Sum a Factorial Review 298 , ADDR, PROC, and PROTO 299 Directive Operator Directive Directive Classifications : Exchanging Two Integers Tips Procedure Review 310 Multimodule Programs 311 and Exporting Procedure Names External Procedures 312 xiiContents Variables and Symbols across Module Boundaries : ArraySum Program the Modules Using Extern the Modules Using INVOKE and PROTO Review 321 Bytecodes 321 Virtual Machine Set Disassembly Examples 323 Summary Exercises 329 9 Strings and Arrays 332 Primitive instructions 333 , MOVSW, and MOVSD , CMPSW, and CMPSD , SCASW, and SCASD , STOSW, and STOSD , LODSW, and LODSD Review 337 String Procedures 338 Procedure Procedure Procedure Procedure Procedure Library Demo Program Review 346 Arrays 346 of Rows and Columns Operands Operands Review 350 and Sorting Integer Arrays 350 Sort Search Review 359 Bytecodes.


Related search queries