Home > Store

Assembly Language for x86 Processors, 7th Edition

Register your product to gain access to bonus material or receive a coupon.

Assembly Language for x86 Processors, 7th Edition

Book

  • Your Price: $215.32
  • List Price: $253.32
  • Usually ships in 24 hours.

About

Features

Teach Effective Design Techniques

  • Teaches students effective design techniques that apply to multiple programming courses through top-down program design demonstration and explanation.
  • Gives students clear-cut methods for organizing nontrivial programs as assembly language is by nature unstructured.
  • Assists students in forming visual images of program design and logic with flowcharts.

Put Theory into Practice

  • NEW! Protected mode programming is entirely the focus of the printed chapters (1 through 13). This edition uses the x86 and x86-64 processor types, explaining the differences between instruction operands and basic architecture differences.
    • Students create applications that take full advantage of 32-bit and 64-bit processors, using protected mode and flat memory addressing. This also allows students to create Microsoft® Windows applications.
    • 16-bit programming is still covered, using chapters from the previous edition, supplied electronically from the Pearson supplements website.
  • UPDATED: Extensive link libraries and sample programs from the book are provided free of charge from the author's personal website. The libraries support 64-bit, 32-bit, and 16-bit programming that students use for basic input/output, simulations, timing, and other useful tasks. The Irvine32 and Irvine64 libraries run in protected mode. The 16-bit version (Irvine16.lib) runs in real-address mode and is used only by chapters 14 through 17. Full source code for the libraries is supplied on the companion website.
  • UPDATED: There is far less dependency on the author's subroutine libraries in this edition. Students are encouraged to call system functions themselves and use the Visual Studio debugger to step through the programs. The Irvine32 and Irvine64 libraries are available to help students handle input/output, but their use is not required.
  • UPDATED: This edition features increased use of supplementary explanations of short program examples, particularly in the first 5 chapters.
  • Review exercises aid students in their comprehension skills. Answers to questions are included for instructors to use in test material.
  • UPDATED: New programming exercises have been added, others removed, and a few existing exercises were modified. Programming exercises with solutions give students first-hand experience in writing software and allow them to immediately check their results.
  • UPDATED: Review questions and exercises have been moved from the middle of the chapter to the end of chapters, and divided into two sections: (1) Short answer questions, and (2) Algorithm workbench exercises. The latter exercises require the student to write a short amount of code to accomplish a goal.
  • NEW: Each chapter now has a Key Terms section, listing new terms and concepts, as well as new MASM directives and Intel instructions.
  • Included Software and Examples: All the example programs were tested with Microsoft Macro Assembler Version 11.0, running in Microsoft Visual Studio 2012. In addition, batch files are supplied that permit students to assemble and run applications from the Windows command prompt. The 32-bit C++ applications in Chapter 14 were tested with Microsoft Visual C++ .NET. Web Site Information Updates and corrections to this book may be found at the Companion Web site, including additional programming projects for instructors to assign at the ends of chapters.

Tailor the Text to Fit your Course

  • Optional chapter topics are offered in the final chapters. This chapter flexibility allows instructors to cover these chapters in varying order and depth.
  • NEW: Early chapters now include short sections that feature 64-bit CPU architecture and programming, and we have created a 64-bit version of the book's subroutine library named Irvine64.
  • UPDATED: Students can program in either 32-bit or 64-bit mode.
  • UPDATED: Legacy chapters on 16-bit programming are provided electronically through the Pearson supplements website. 

Support Instructors and Students

  • Author Web site http://asmirvine.com/
  • Contains chapter objectives, debugging tools, supplemental files, a Getting Started with MASM and Visual Studio 2012 tutorial, and more.
  • With lists of errata, Frequently Asked Questions, new programs, and articles about special topics.
  • Enables students to reinforce their understanding of the material presented in the course. Receives approximately 80,000 hits per month—the most extensive Web site by any published assembly-language programming author.
  • Assembly Language Workbook on Web site provides expanded drill and practice on basic numeric and data manipulation skills, a feature provided by no other author.
  • Companion Web site http://www.pearsonhighered.com/irvine/
    • NEW: New VideoNotes covering essential content topics have been created by the author and added to the Pearson website. VideoNotes are step-by-step video tutorials specifically designed to enhance the programming concepts presented in Irvine, Assembly Language for X86 Processors, 7e. Students can view the entire problem-solving process outside of the classroom–when they need help the most. VideoNotes are available with the purchase of a new copy of select titles. Go to www.pearsonhighered.com/videonotes for a brief VideoNotes demo.
    • NEW: New Testbanks have been prepared by the author for this edition. Testbanks aid instructors in preparing exams.
    • UPDATED: For this edition, the author has prepared revised PowerPoint® lecture slides in the supplemental material. The slides enable instructors to have prepared lectures and allow students to print out and study the slides as lecture notes.
    •  Instructor Solutions Manual

Description

  • Copyright 2015
  • Dimensions: 7" x 9-1/8"
  • Pages: 720
  • Edition: 7th
  • Book
  • ISBN-10: 0-13-376940-2
  • ISBN-13: 978-0-13-376940-1

Assembly Language for x86 Processors, 7e is intended for use in undergraduate courses in assembly language programming and introductory courses in computer systems and computer architecture. This title is also suitable for embedded systems programmers and engineers, communication specialists, game programmers, and graphics programmers. Proficiency in one other programming language, preferably Java, C, or C++, is recommended.

Written specifically for 32- and 64-bit Intel/Windows platform, this complete and fullyupdated study of assembly language teaches students to write and debug programs at the machine level. This text simplifies and demystifies concepts that students need to grasp before they can go on to more advanced computer architecture and operating systems courses. Students put theory into practice through writing software at the machine level, creating a memorable experience that gives them the confidence to work in any OS/machine-oriented environment.

Additional learning and teaching tools are available on the author’s web site at http://asmirvine.com/ where both instructors and students can access chapter objectives, debugging tools, supplemental files, a Getting Started with MASM and Visual Studio 2012 tutorial, and more.

Teaching and Learning Experience

This program presents a better teaching and learning experience—for you and your students. It will help:

  • Teach Effective Design Techniques: Top-down program design demonstration and explanation allows studentsto apply techniques to multiple programming courses.
  • Put Theory into Practice: Students will write software at the machine level, preparing them to work in any OS/machine-oriented environment.
  • Tailor the Text to Fit your Course: Instructors can cover optional chapter topics in varying order and depth.
  • Support Instructors and Students: Visit the author's web site http://asmirvine.com/ for chapter objectives, debugging tools, supplemental files, a Getting Started with MASM and Visual Studio 2012 tutorial, and more.

Sample Content

Table of Contents

Preface xxiii

1 Basic Concepts 1

1.1 Welcome to Assembly Language 1

1.1.1 Questions You Might Ask 3

1.1.2 Assembly Language Applications 6

1.1.3 Section Review 6

1.2 Virtual Machine Concept 7

1.2.1 Section Review 9

1.3 Data Representation 9

1.3.1 Binary Integers 10

1.3.2 Binary Addition 12

1.3.3 Integer Storage Sizes 13

1.3.4 Hexadecimal Integers 13

1.3.5 Hexadecimal Addition 15

1.3.6 Signed Binary Integers 16

1.3.7 Binary Subtraction 18

1.3.8 Character Storage 19

1.3.9 Section Review 21

1.4 Boolean Expressions 22

1.4.1 Truth Tables for Boolean Functions 24

1.4.2 Section Review 26

1.5 Chapter Summary 26

1.6 Key Terms 27

1.7 Review Questions and Exercises 28

1.7.1 Short Answer 28

1.7.2 Algorithm Workbench 30

2 x86 Processor Architecture 32

2.1 General Concepts 33

2.1.1 Basic Microcomputer Design 33

2.1.2 Instruction Execution Cycle 34

2.1.3 Reading from Memory 36

2.1.4 Loading and Executing a Program 36

2.1.5 Section Review 37

2.2 32-Bit x86 Processors 37

2.2.1 Modes of Operation 37

2.2.2 Basic Execution Environment 38

2.2.3 x86 Memory Management 41

2.2.4 Section Review 42

2.3 64-Bit x86-64 Processors 42

2.3.1 64-Bit Operation Modes 43

2.3.2 Basic 64-Bit Execution Environment 43

2.4 Components of a Typical x86 Computer 44

2.4.1 Motherboard 44

2.4.2 Memory 46

2.4.3 Section Review 46

2.5 InputOutput System 47

2.5.1 Levels of I/O Access 47

2.5.2 Section Review 49

2.6 Chapter Summary 50

2.7 Key Terms 51

2.8 Review Questions 52

3 Assembly Language Fundamentals 53

3.1 Basic Language Elements 54

3.1.1 First Assembly Language Program 54

3.1.2 Integer Literals 55

3.1.3 Constant Integer Expressions 56

3.1.4 Real Number Literals 57

3.1.5 Character Literals 57

3.1.6 String Literals 58

3.1.7 Reserved Words 58

3.1.8 Identifiers 58

3.1.9 Directives 59

3.1.10 Instructions 60

3.1.11 Section Review 63

3.2 Example: Adding and Subtracting Integers 63

3.2.1 The AddTwo Program 63

3.2.2 Running and Debugging the AddTwo Program 65

3.2.3 Program Template 70

3.2.4 Section Review 70

3.3 Assembling, Linking, and Running Programs 71

3.3.1 The Assemble-Link-Execute Cycle 71

3.3.2 Listing File 71

3.3.3 Section Review 73

3.4 Defining Data 74

3.4.1 Intrinsic Data Types 74

3.4.2 Data Definition Statement 74

3.4.3 Adding a Variable to the AddTwo Program 75

3.4.4 Defining BYTE and SBYTE Data 76

3.4.5 Defining WORD and SWORD Data 78

3.4.6 Defining DWORD and SDWORD Data 79

3.4.7 Defining QWORD Data 79

3.4.8 Defining Packed BCD (TBYTE) Data 80

3.4.9 Defining Floating-Point Types 81

3.4.10 A Program That Adds Variables 81

3.4.11 Little-Endian Order 82

3.4.12 Declaring Uninitialized Data 83

3.4.13 Section Review 83

3.5 Symbolic Constants 84

3.5.1 Equal-Sign Directive 84

3.5.2 Calculating the Sizes of Arrays and Strings 85

3.5.3 EQU Directive 86

3.5.4 TEXTEQU Directive 87

3.5.5 Section Review 88

3.6 64-Bit Programming 88

3.7 Chapter Summary 90

3.8 Key Terms 91

3.8.1 Terms 91

3.8.2 Instructions, Operators, and Directives 92

3.9 Review Questions and Exercises 92

3.9.1 Short Answer 92

3.9.2 Algorithm Workbench 93

3.10 Programming Exercises 94

4 Data Transfers, Addressing, and Arithmetic 95

4.1 Data Transfer Instructions 96

4.1.1 Introduction 96

4.1.2 Operand Types 96

4.1.3 Direct Memory Operands 96

4.1.4 MOV Instruction 98

4.1.5 Zero/Sign Extension of Integers 99

4.1.6 LAHF and SAHF Instructions 101

4.1.7 XCHG Instruction 102

4.1.8 Direct-Offset Operands 102

4.1.9 Example Program (Moves) 103

4.1.10 Section Review 104

4.2 Addition and Subtraction 105

4.2.1 INC and DEC Instructions 105

4.2.2 ADD Instruction 105

4.2.3 SUB Instruction 106

4.2.4 NEG Instruction 106

4.2.5 Implementing Arithmetic Expressions 106

4.2.6 Flags Affected by Addition and Subtraction 107

4.2.7 Example Program (AddSubTest) 111

4.2.8 Section Review 112

4.3 Data-Related Operators and Directives 112

4.3.1 OFFSET Operator 112

4.3.2 ALIGN Directive 113

4.3.3 PTR Operator 114

4.3.4 TYPE Operator 115

4.3.5 LENGTHOF Operator 116

4.3.6 SIZEOF Operator 116

4.3.7 LABEL Directive 116

4.3.8 Section Review 117

4.4 Indirect Addressing 117

4.4.1 Indirect Operands 117

4.4.2 Arrays 118

4.4.3 Indexed Operands 119

4.4.4 Pointers 121

4.4.5 Section Review 122

4.5 JMP and LOOP Instructions 123

4.5.1 JMP Instruction 123

4.5.2 LOOP Instruction 124

4.5.3 Displaying an Array in the Visual Studio Debugger 125

4.5.4 Summing an Integer Array 126

4.5.5 Copying a String 127

4.5.6 Section Review 128

4.6 64-Bit Programming 128

4.6.1 MOV Instruction 128

4.6.2 64-Bit Version of SumArray 130

4.6.3 Addition and Subtraction 130

4.6.4 Section Review 131

4.7 Chapter Summary 132

4.8 Key Terms 133

4.8.1 Terms 133

4.8.2 Instructions, Operators, and Directives 133

4.9 Review Questions and Exercises 134

4.9.1 Short Answer 134

4.9.2 Algorithm Workbench 136

4.10 Programming Exercises 137

5 Procedures 139

5.1 Stack Operations 140

5.1.1 Runtime Stack (32-bit mode) 140

5.1.2 PUSH and POP Instructions 142

5.1.3 Section Review 145

5.2 Defining and Using Procedures 145

5.2.1 PROC Directive 145

5.2.2 CALL and RET Instructions 147

5.2.3 Nested Procedure Calls 148

5.2.4 Passing Register Arguments to Procedures 150

5.2.5 Example: Summing an Integer Array 150

5.2.6 Saving and Restoring Registers 152

5.2.7 Section Review 153

5.3 Linking to an External Library 153

5.3.1 Background Information 154

5.3.2 Section Review 155

5.4 The Irvine32 Library 155

5.4.1 Motivation for Creating the Library 155

5.4.2 Overview 157

5.4.3 Individual Procedure Descriptions 158

5.4.4 Library Test Programs 170

5.4.5 Section Review 178

5.5 64-Bit Assembly Programming 178

5.5.1 The Irvine64 Library 178

5.5.2 Calling 64-Bit Subroutines 179

5.5.3 The x64 Calling Convention 179

5.5.4 Sample Program that Calls a Procedure 180

5.6 Chapter Summary 182

5.7 Key Terms 183

5.7.1 Terms 183

5.7.2 Instructions, Operators, and Directives 183

5.8 Review Questions and Exercises 183

5.8.1 Short Answer 183

5.8.2 Algorithm Workbench 186

5.9 Programming Exercises 187

6 Conditional Processing 189

6.1 Conditional Branching 190

6.2 Boolean and Comparison Instructions 190

6.2.1 The CPU Status Flags 191

6.2.2 AND Instruction 191

6.2.3 OR Instruction 192

6.2.4 Bit-Mapped Sets 194

6.2.5 XOR Instruction 195

6.2.6 NOT Instruction 196

6.2.7 TEST Instruction 196

6.2.8 CMP Instruction 197

6.2.9 Setting and Clearing Individual CPU Flags 198

6.2.10 Boolean Instructions in 64-Bit Mode 199

6.2.11 Section Review 199

6.3 Conditional Jumps 199

6.3.1 Conditional Structures 199

6.3.2 J cond Instruction 200

6.3.3 Types of Conditional Jump Instructions 201

6.3.4 Conditional Jump Applications 204

6.3.5 Section Review 208

6.4 Conditional Loop Instructions 209

6.4.1 LOOPZ and LOOPE Instructions 209

6.4.2 LOOPNZ and LOOPNE Instructions 209

6.4.3 Section Review 210

6.5 Conditional Structures 210

6.5.1 Block-Structured IF Statements 210

6.5.2 Compound Expressions 213

6.5.3 WHILE Loops 214

6.5.4 Table-Driven Selection 216

6.5.5 Section Review 219

6.6 Application: Finite-State Machines 219

6.6.1 Validating an Input String 219

6.6.2 Validating a Signed Integer 220

6.6.3 Section Review 224

6.7 Conditional Control Flow Directives 225

6.7.1 Creating IF Statements 226

6.7.2 Signed and Unsigned Comparisons 227

6.7.3 Compound Expressions 228

6.7.4 Creating Loops with .REPEAT and .WHILE 231

6.8 Chapter Summary 232

6.9 Key Terms 233

6.9.1 Terms 233

6.9.2 Instructions, Operators, and Directives 234

6.10 Review Questions and Exercises 234

6.10.1 Short Answer 234

6.10.2 Algorithm Workbench 236

6.11 Programming Exercises 237

6.11.1 Suggestions for Testing Your Code 237

6.11.2 Exercise Descriptions 238

7 Integer Arithmetic 242

7.1 Shift and Rotate Instructions 243

7.1.1 Logical Shifts and Arithmetic Shifts 243

7.1.2 SHL Instruction 244

7.1.3 SHR Instruction 245

7.1.4 SAL and SAR Instructions 246

7.1.5 ROL Instruction 247

7.1.6 ROR Instruction 247

7.1.7 RCL and RCR Instructions 248

7.1.8 Signed Overflow 249

7.1.9 SHLD/SHRD Instructions 249

7.1.10 Section Review 251

7.2 Shift and Rotate Applications 251

7.2.1 Shifting Multiple Doublewords 252

7.2.2 Binary Multiplication 253

7.2.3 Displaying Binary Bits 254

7.2.4 Extracting File Date Fields 254

7.2.5 Section Review 255

7.3 Multiplication and Division Instructions 255

7.3.1 MUL Instruction 255

7.3.2 IMUL Instruction 257

7.3.3 Measuring Program Execution Times 260

7.3.4 DIV Instruction 262

7.3.5 Signed Integer Division 264

7.3.6 Implementing Arithmetic Expressions 267

7.3.7 Section Review 269

7.4 Extended Addition and Subtraction 269

7.4.1 ADC Instruction 269

7.4.2 Extended Addition Example 270

7.4.3 SBB Instruction 272

7.4.4 Section Review 272

7.5 ASCII and Unpacked Decimal Arithmetic 273

7.5.1 AAA Instruction 274

7.5.2 AAS Instruction 276

7.5.3 AAM Instruction 276

7.5.4 AAD Instruction 276

7.5.5 Section Review 277

7.6 Packed Decimal Arithmetic 277

7.6.1 DAA Instruction 277

7.6.2 DAS Instruction 279

7.6.3 Section Review 279

7.7 Chapter Summary 279

7.8 Key Terms 280

7.8.1 Terms 280

7.8.2 Instructions, Operators, and Directives 280

7.9 Review Questions and Exercises 281

7.9.1 Short Answer 281

7.9.2 Algorithm Workbench 282

7.10 Programming Exercises 284

8 Advanced Procedures 286

8.1 Introduction 287

8.2 Stack Frames 287

8.2.1 Stack Parameters 288

8.2.2 Disadvantages of Register Parameters 288

8.2.3 Accessing Stack Parameters 290

8.2.4 32-Bit Calling Conventions 293

8.2.5 Local Variables 295

8.2.6 Reference Parameters 297

8.2.7 LEA Instruction 298

8.2.8 ENTER and LEAVE Instructions 298

8.2.9 LOCAL Directive 300

8.2.10 The Microsoft x64 Calling Convention 301

8.2.11 Section Review 302

8.3 Recursion 302

8.3.1 Recursively Calculating a Sum 303

8.3.2 Calculating a Factorial 304

8.3.3 Section Review 311

8.4 INVOKE, ADDR, PROC, and PROTO 311

8.4.1 INVOKE Directive 311

8.4.2 ADDR Operator 312

8.4.3 PROC Directive 313

8.4.4 PROTO Directive 316

8.4.5 Parameter Classifications 319

8.4.6 Example: Exchanging Two Integers 320

8.4.7 Debugging Tips 321

8.4.8 WriteStackFrame Procedure 322

8.4.9 Section Review 323

8.5 Creating Multimodule Programs 323

8.5.1 Hiding and Exporting Procedure Names 323

8.5.2 Calling External Procedures 324

8.5.3 Using Variables and Symbols across Module Boundaries 325

8.5.4 Example: ArraySum Program 326

8.5.5 Creating the Modules Using Extern 326

8.5.6 Creating the Modules Using INVOKE and PROTO 330

8.5.7 Section Review 333

8.6 Advanced Use of Parameters (Optional Topic) 333

8.6.1 Stack Affected by the USES Operator 333

8.6.2 Passing 8-Bit and 16-Bit Arguments on the Stack 335

8.6.3 Passing 64-Bit Arguments 336

8.6.4 Non-Doubleword Local Variables 337

8.7 Java Bytecodes (Optional Topic) 339

8.7.1 Java Virtual Machine 339

8.7.2 Instruction Set 340

8.7.3 Java Disassembly Examples 341

8.7.4 Example: Conditional Branch 344

8.8 Chapter Summary 346

8.9 Key Terms 347

8.9.1 Terms 347

8.9.2 Instructions, Operators, and Directives 348

8.10 Review Questions and Exercises 348

8.10.1 Short Answer 348

8.10.2 Algorithm Workbench 348

8.11 Programming Exercises 349

9 Strings and Arrays 352

9.1 Introduction 352

9.2 String Primitive Instructions 353

9.2.1 MOVSB, MOVSW, and MOVSD 354

9.2.2 CMPSB, CMPSW, and CMPSD 355

9.2.3 SCASB, SCASW, and SCASD 356

9.2.4 STOSB, STOSW, and STOSD 356

9.2.5 LODSB, LODSW, and LODSD 356

9.2.6 Section Review 357

9.3 Selected String Procedures 357

9.3.1 Str_compare Procedure 358

9.3.2 Str_length Procedure 359

9.3.3 Str_copy Procedure 359

9.3.4 Str_trim Procedure 360

9.3.5 Str_ucase Procedure 363

9.3.6 String Library Demo Program 364

9.3.7 String Procedures in the Irvine64 Library 365

9.3.8 Section Review 368

9.4 Two-Dimensional Arrays 368

9.4.1 Ordering of Rows and Columns 368

9.4.2 Base-Index Operands 369

9.4.3 Base-Index-Displacement Operands 371

9.4.4 Base-Index Operands in 64-Bit Mode 372

9.4.5 Section Review 373

9.5 Searching and Sorting Integer Arrays 373

9.5.1 Bubble Sort 373

9.5.2 Binary Search 375

9.5.3 Section Review 382

9.6 Java Bytecodes: String Processing (Optional Topic) 382

9.7 Chapter Summary 383

9.8 Key Terms and Instructions 384

9.9 Review Questions and Exercises 384

9.9.1 Short Answer 384

9.9.2 Algorithm Workbench 385

9.10 Programming Exercises 386

10 Structures and Macros 390

10.1 Structures 390

10.1.1 Defining Structures 391

10.1.2 Declaring Structure Variables 393

10.1.3 Referencing Structure Variables 394

10.1.4 Example: Displaying the System Time 397

10.1.5 Structures Containing Structures 399

10.1.6 Example: Drunkard's Walk 399

10.1.7 Declaring and Using Unions 403

10.1.8 Section Review 405

10.2 Macros 405

10.2.1 Overview 405

10.2.2 Defining Macros 406

10.2.3 Invoking Macros 407

10.2.4 Additional Macro Features 408

10.2.5 Using the Book's Macro Library (32-bit mode only) 412

10.2.6 Example Program: Wrappers 419

10.2.7 Section Review 420

10.3 Conditional-Assembly Directives 420

10.3.1 Checking for Missing Arguments 421

10.3.2 Default Argument Initializers 422

10.3.3 Boolean Expressions 423

10.3.4 IF, ELSE, and ENDIF Directives 423

10.3.5 The IFIDN and IFIDNI Directives 424

10.3.6 Example: Summing a Matrix Row 425

10.3.7 Special Operators 428

10.3.8 Macro Functions 431

10.3.9 Section Review 433

10.4 Defining Repeat Blocks 433

10.4.1 WHILE Directive 433

10.4.2 REPEAT Directive 434

10.4.3 FOR Directive 434

10.4.4 FORC Directive 435

10.4.5 Example: Linked List 436

10.4.6 Section Review 437

10.5 Chapter Summary 438

10.6 Key Terms 439

10.6.1 Terms 439

10.6.2 Operators and Directives 439

10.7 Review Questions and Exercises 440

10.7.1 Short Answer 440

10.7.2 Algorithm Workbench 440

10.8 Programming Exercises 442

11 MS-Windows Programming 445

11.1 Win32 Console Programming 445

11.1.1 Background Information 446

11.1.2 Win32 Console Functions 450

11.1.3 Displaying a Message Box 452

11.1.4 Console Input 455

11.1.5 Console Output 461

11.1.6 Reading and Writing Files 463

11.1.7 File I/O in the Irvine32 Library 468

11.1.8 Testing the File I/O Procedures 470

11.1.9 Console Window Manipulation 473

11.1.10 Controlling the Cursor 476

11.1.11 Controlling the Text Color 477

11.1.12 Time and Date Functions 479

11.1.13 Using the 64-Bit Windows API 482

11.1.14 Section Review 484

11.2 Writing a Graphical Windows Application 484

11.2.1 Necessary Structures 484

11.2.2 The MessageBox Function 486

11.2.3 The WinMain Procedure 486

11.2.4 The WinProc Procedure 487

11.2.5 The ErrorHandler Procedure 488

11.2.6 Program Listing 488

11.2.7 Section Review 492

11.3 Dynamic Memory Allocation 492

11.3.1 HeapTest Programs 496

11.3.2 Section Review 499

11.4 x86 Memory Management 499

11.4.1 Linear Addresses 500

11.4.2 Page Translation 503

11.4.3 Section Review 505

11.5 Chapter Summary 505

11.6 Key Terms 507

11.7 Review Questions and Exercises 507

11.7.1 Short Answer 507

11.7.2 Algorithm Workbench 508

11.8 Programming Exercises 509

12 Floating-Point Processing and Instruction Encoding 511

12.1 Floating-Point Binary Representation 511

12.1.1 IEEE Binary Floating-Point Representation 512

12.1.2 The Exponent 514

12.1.3 Normalized Binary Floating-Point Numbers 514

12.1.4 Creating the IEEE Representation 514

12.1.5 Converting Decimal Fractions to Binary Reals 516

12.1.6 Section Review 518

12.2 Floating-Point Unit 518

12.2.1 FPU Register Stack 519

12.2.2 Rounding 521

12.2.3 Floating-Point Exceptions 523

12.2.4 Floating-Point Instruction Set 523

12.2.5 Arithmetic Instructions 526

12.2.6 Comparing Floating-Point Values 530

12.2.7 Reading and Writing Floating-Point Values 533

12.2.8 Exception Synchronization 534

12.2.9 Code Examples 535

12.2.10 Mixed-Mode Arithmetic 537

12.2.11 Masking and Unmasking Exceptions 538

12.2.12 Section Review 539

12.3 x86 Instruction Encoding 539

12.3.1 Instruction Format 540

12.3.2 Single-Byte Instructions 541

12.3.3 Move Immediate to Register 541

12.3.4 Register-Mode Instructions 542

12.3.5 Processor Operand-Size Prefix 543

12.3.6 Memory-Mode Instructions 544

12.3.7 Section Review 547

12.4 Chapter Summary 547

12.5 Key Terms 549

12.6 Review Questions and Exercises 549

12.6.1 Short Answer 549

12.6.2 Algorithm Workbench 550

12.7 Programming Exercises 551

13 High-Level Language Interface 555

13.1 Introduction 555

13.1.1 General Conventions 556

13.1.2 .MODEL Directive 557

13.1.3 Examining Compiler-Generated Code 559

13.1.4 Section Review 564

13.2 Inline Assembly Code 564

13.2.1 __asm Directive in Visual C++ 564

13.2.2 File Encryption Example 566

13.2.3 Section Review 569

13.3 Linking 32-Bit Assembly Language Code to C/C++ 570

13.3.1 IndexOf Example 570

13.3.2 Calling C and C++ Functions 574

13.3.3 Multiplication Table Example 576

13.3.4 Calling C Library Functions 579

13.3.5 Directory Listing Program 582

13.3.6 Section Review 583

13.4 Chapter Summary 583

13.5 Key Terms 584

13.6 Review Questions 584

13.7 Programming Exercises 585

Chapters 14-17 are available on the Companion Web site

14 16-Bit MS-DOS Programming 14.1

14.1 MS-DOS and the IBM-PC 14.1

14.1.1 Memory Organization 14.2

14.1.2 Redirecting Input-Output 14.3

14.1.3 Software Interrupts 14.4

14.1.4 INT Instruction 14.5

14.1.5 Coding for 16-Bit Programs 14.6

14.1.6 Section Review 14.7

14.2 MS-DOS Function Calls (INT 21h) 14.7

14.2.1 Selected Output Functions 14.9

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020