編輯推薦
1. 《Intel彙編語言程式設計》組織結構靈活,教師可根據需要按不同的順序、不同的深度進行授課。
2. 以32位保護模式編程為默認模型,使讀者更容易理解和接受。
3. 為32位和16位程式設計給出了擴展的程式庫,包括用於簡化輸入/輸出、數字處理、磁碟與檔案處理,以及字元串處理等的40多個函式。
4. 作者為每章提供了測試題庫,方便教師準備考試。
5. 以自上而下的方式探究和解析程式的設計思想和過程。
6. 作者提供了內容豐富的教學課件。
7. 每小節後面都給出了複習題,有助於學生掌握所學知識。
8. 為教師提供了複習題和編程練習題答案。
目錄
Preface xxiii
1 sasic Concepts 1
1'1 W6Icome to Assembly Lanauaae 1
y Language 1
1. 1 .l Good Questions to Ask 2
1. 1 .2 Assembly Language Applications 5
J Language Applications 5
1.l.3 Section Review 6
1.2 Virtual Machine Concept 7
l .2.1 HistorV of PC Assemblers 9
y of PC Assemblers 9
l.2.2 Section Review 9
1.3 Data Representation 9
1 .3. 1 BinarV Numbers 10
J 1
l.3.2 BinarV Addition 11
J Addition 11
1 .3.3 Integer Storage Sizes 12
1 .3.4 hexadecimal integers 13
l.3.5 Signed integers 14
.lied integers 14
l .3.6 Character Storage 16
l.3.7 Section Review 18
1'4 soolean Operations 20
1 .4.1 Truth Tables for Boolean Functions 22
l.4.2 Section Review 23
1'5 Chapter Summary 23
2 lA-32 Processor Architecture 25
2'1 General Concepts 25
2.1. 1 Basic microcomputer Design 26
2.1.2 Instruction Execution Cycle 27
j
2.l.3 Reading from Memory 30
2.1 .4 How Programs Run 31
slams Run 31
2.1.5 Section Review 32
2.2 lA-32 Processor Architecture 33
2.2.1 Modes of Operation 33
2.2.2 Basic Execution Environment 34
v
.
yi
CONTENTS
2'2.3 Floating-Point Unit 36
o Point Unit 36
2'2'4 Intel MicroDrocessor History 37
processor History 37
2'2'5 Section Review 38
2'3 lA-32 Memory Management 39
2'3.1 Real-Address Mode 39
2'3'2 Protected Mode 41
2'3'3 Section Review 43
2'4 Components of an lA-32 MicrocomDuter 43
ponents of an lA-32 Microcomputer 43
2'4'1 Motherboard 43
2'4'2 Video Output 44
put 44
2'4'3 Memory 45
7,J
2'4.4 Input-Output Ports and Device interfaces 45
2'4'5 Section Review 46
2'5 Input-Output System 46
2'5'l How it All Works 46
2'5'2 Section Review 48
2'6 Chapter Summary 49
3 Assembly Language Fundamentals 51
3'1 Basic Elements of Assembly Language 51
3' 1. 1 Integer Constants 52
u
3'1.2 Integer Expressions 52
& pressions 52
3' l.3 Real Number Constants 53
3'l'4 Character Constants 54
3' l'5 String Constants 54
5
3'1.6 Reserved Words 54
3'l '7 Identifiers 54
3' I .8 Directives 55
3' I .9 Instructions 55
3' l.10 The NOP (No Operation) Instruction 57
3' 1. I I Section Review 58
3'2 Example: AddingThree Integers 58
3'2'l Alternative Version of AddSub 60
3'2.2 Program TemDlate 61
cram femplate 61
3'2'3 Section Review 61
3'3 Assemblina, Linkina, and Runnina Proarams 62
al Linking, and Running Programs 62
3'3.1 The Assemble-Link-Execute Cycle 62
3'3'2 Section Review 64
3'4 Defining Data 64
3'4'1 Intrinsic Data TVves 64
apes 64
3'4.2 Data Definition Statement 64
3'4.3 Defining BYTE and SBYTE Data 66
u
CONTENTS Vii
3.4.4 Defining WORD and SWORD Data 67
o
3.4.5 Defining DWORD and SDWORD Data 68
o DWORD and SDWORD Data 68
3.4.6 Defining OWORD Data 69
o
3.4.7 DefininZ TBYTE Data 69
b IBYTE Data 69
3.4.8 Defining Real Number Data 69
o
3.4.9 Little Endian Order 69
3.4.10 Adding Variables to the AddSub Program 70
5 o
3.4. I I Declaring Uninitialized Data 71
o
3.4.12 Section Review 71
3'5 Symbolic Constants 72
ymbolic Constants 72
3.5.1 equal-Sign Directive 72
3.5.2 Calculating the Sizes of Arrays and Strings 73
& the Sizes of Arrays and Strings 73
3.5.3 EQU Directive 74
3.5.4 TEXTEQU Directive 74
3.5.5 Section Review 75
3.6 Real-Address Mode Proarammina (Optional) 75
srammlng (Optional) 75
3.6.1 Basic ChanZes 75
o
3'7 Chapter Summary 76
3.8 Proqrammina Exercises 77
cramming Exercises 77
4 Data Transfers, Addressing,
and Arithmetic 79
4.1 DataTFansfer Instructions 79
4.l. I Introduction 79
4.l.2 Operand Types 80
4.l.3 Direct MemorV Operands 80
J perands 80
4. I .4 MOV Instruction 81
4. l.5 Zero/Sign Extension of integers 82
4.l.6 LAHF and SAHF Instructions 84
4.l.7 XCHG InstrUction 84
4.l.8 Direct-Offset Operands 84
4.l.9 Example Program (Moves) 85
4. 1.10 Section Review 86
4.2 Addition and subtraction 87
4'2.1 INC and DEC Instructions 87
4.2.2 ADD Instruction 87
4.2.3 SUB InstrUction 88
4'2.4 NEG InstrUction 88
4.2.5 ImplementingArithmetic Expressions 89
4
4.2.6 Flags Affected by Addition and Subtraction 89
so Affected by Addition and Subtraction 89
4.2.7 Example Program (AddSub3) 92
4.2.8 Section Review 93
... .ONTENTS
Vlll CONTENTS
4.3 Data-Related Operators and Directives 94
4.3.1 OFFSET Operator 94
4.3.2 ALIGN Directive 95
4.3.3 PTR Operator 95
4.3.4 TYPE Operator 96
4.3.5 LENGTHOF Operator 97
4.3.6 SIZEOF Operator 97
4.3.7 LABEL Directive 97
4.3.8 Section Review 98
4.4 Indirect Addressing 99
4.4.1 Indirect Operands 99
4.4.2 Arrays 100
4.4.3 Indexed Operands 101
4.4.4 Pointers 102
4.4.5 Section Review 103
4.5 JMP and LOOP Instructions 104
4.5.1 JMP Instruction 104
4.5.2 LOOP Instruction 105
4.5.3 Summing an integerArray 106
4.5.4 Copying a String 106
4.5.5 Section Review 107
4.6 Chapter Summary 108
4.7 Programming Exercises 109
5 Procedures 111
5.1 Introduction 111
5.2 Linking to an External Library 111
5.2.1 Background information 1 12
5.2.2 Section Review 1 12
5.3 The Book's Link Library 113
5.3.1 Overview 113
5.3.2 Individual Procedure Descriptions 115
5.3.3 Library Test Programs 125
5.3.4 Section Review 129
5.4 Stack Operations 129
5.4.1 Runtime Stack 129
5.4.2 PUSH and POP Instructions 131
5.4.3 Section Review 134
5.5 DENNING and Using Procedures 134
5.5.1 PROC DirectiVe 134
5.5.2 CALL and RET Instructions 136
CONTENTS iX
5.5.3 Example: Summing an integer Array 139
5.5.4 Flowchafts 140
5'5'5 SavinZ and RestorinZ ReZisters 140
o and Restoring Registers 140
5.5.6 Section Review 142
5'6 Program Desian Usina Procedures 143
"ram Design Using Procedures 143
5.6.1 Integer Summation Program (Design) 143
5.6.2 Integer Summation Implementation 145
air summation Implementation 145
5'6.3 Section Review 147
5'7 Chapter Summary 147
5'8 Proarammina Exercises 148
cramming Exercises 148
6 Conditional Processing 150
6'1 Introduction 150
6.2 Boolean and Comparison Instructions 151
6.2.1 The CPU Flags 151
6.2.2 AND Instruction 152
6'2'3 OR InstrUction 153
6.2.4 XOR Instruction 154
6'2.5 NOT Instruction 155
6.2.6 TEST Instruction 155
6'2'7 CMP InstrUction 156
6'2.8 SettinZ and ClearinZ Individual CPU FlaZs 157
o and Clearing individual CPU Flags 157
6'2'9 Section Review 157
6'3 Conditional JumDs 158
ps 158
6'3. I Conditional Structures 158
6'3'2 Jcond instruction 158
6'3'3 TVpes of Conditional JumD Instructions 159
J pos of Conditional Jump instructions 159
6'3.4 Conditional Jump Applications 163
6.3.5 Bit TestinZ Instructions (Optional) 167
o Instructions (Optional) 167
6.3.6 Section Review 168
6'4 Conditional Loop Instructions 169
6.4.1 LOOPZ and LOOPE Instructions 169
6.4.2 LOOPNZ and LOOPNE Instructions 169
6'4.3 Section Review 170
6'5 Conditional Structures 170
6.5.1 Block-Structured iF Statements 170
6'5.2 Compound Expressions 173
6'5'3 WHILE Loops 174
6'5'4 Table-Driven Selection 177
6'5'5 Section Review 178
6'6 Application: Finite-State Machines 179
6'6'l Validating an input String 180
X CONTENTS
6.6.2 Validating a Signed integer 180
6.6.3 Section Review 183
6.7 Decision Directives 184
6.7.1 Signed and Unsigned Comparisons 185
6.7.2 Compound Expressions 186
6.7.3 .REPEAT and .WHILE DirectiVes 188
6'8 Chapter Summary 189
6.9 Programming Exercises 190
7 Integer Arithmetic 193
7.1 Introduction 193
7.2 Shift and Rotate Instructions 194
7.2.1 Logical Shifts and Arithmetic Shifts 194
7.2.2 SHL Instruction 195
7.2.3 SHR Instruction 196
7.2.4 SAL and SAR Instructions 196
7.2.5 ROL Instfllction 197
7.2.6 ROR Instruction 198
7.2.7 RCL and RCR Instructions 198
7.2.8 Signed Overflow 199
7.2.9 SHLD/SHRD Instructions 199
7.2.10 Section Review 200
7'3 Shift and Rotate Applications 201
7.3.1 Shifting Multiple Doublewords 201
7.3.2 BinarV multiplication 202
' y idultiplication 202
7.3.3 Displaying Binary Bits 202
7.3.4 Isolating MS-DOS File Date Fields 203
7.3.5 Section Review 203
7.4 Multiplication and Division Operations 204
7.4.1 MUL Instfuction 204
7.4.2 IMUL Instttiction 205
7.4.3 Benchmarking Multiplication Operations 207
7.4.4 DIV Instruction 208
7.4.5 Signed integer Division 209
7.4.6 Implementing Arithmetic Expressions ZI I
7.4.7 Section Review 212
7.5 Extended Addition and Subtraction 213
7.5. 1 ADC Instruction 213
7.5.2 Extended Addition Example 213
7.5.3 SBB Instruction 214
7.5.4 Section Review 215
CONTENTS Xi
XI
7'6 ascll and Unpacked Decimal Arithmetic 215
7.6.1 AAA Instruction 216
7.6.2 AAS Instruction 218
7.6.3 AAM Instruction 218
7.6.4 AAD Instruction 218
7'6'5 Section Review 219
7'7 Packed Decimal Arithmetic 219
7.7.1 DAA InstrUction 219
7.7.2 DAS Instruction 220
7.7.3 Section Review 220
7'8 Chapter Summary 221
7.9 Proqrammina Exercises 222
cramming Exercises 222
8 Advanced Procedures 224
8.1 Introduction 224
8'2 Stack Frames 225
8'2'l Stack Parameters 225
8.2.2 LocalVariables 233
8.2.3 ENTER and LEAVE Instructions 236
8.2.4 LOCAL Directive 237
8.2.5 WriteStackFrame Procedure 240
8'2.6 Section Review 241
8.3 Recursion 242
8.3.1 Recursivelv Calculating a Sum 243
j o a Sum 243
8'3.2 Calculating a factorial 243
8.3.3 Section Review 245
8'4 .MODEL Directive 246
8.4.1 Language Specifiers 247
suage specifiers 247
8'4.2 Section Review 248
8'5 INVOKE, ADDR, PROC, and Proto (Optional) 248
8'5.1 INVOKE Directive 248
8.5.2 ADDR Operator 249
8'5'3 PROC Directive 250
8.5.4 PROTO Directive 253
8'5'5 Parameter Classifications 255
8.5.6 Example: Exchanging Two integers 256
8.5.7 DebuggingTips 256
.ging YIPS 256
8'5.8 Section Review 257
8'6 Creatina Multimodule Proarams 258
s Multimodule Programs 258
8.6.1 Hiding and Exporting Procedure Names 258
s and Exporting Procedure Names 258
8'6.2 CallinZ External Procedures 258
o txtemal Procedures 258
.. CONTENTS
XI I
8.6.3 Using Variables and Symbols Across Module Boundaries 259
8.6.4 Example: ArraySum Program 260
8.6.5 Creating the Modules Using Extem 261
8.6.6 Creating the Modules Using INVOKE and PROTO 264
8.6.7 Section Review 266
8.7 Chapter Summary 267
8.8 Programming Exercises 268
9 Strings and Arrays 269
9.1 Introduction 269
9.2 String Primitive Instructions 270
9.2.1 MOVSB, MOVSW, and MOVSD 271
9.2.2 CMPSB, CMPSW, and CMPSD 272
9.2.3 SCASB, SCASW, and SCASD 274
9.2.4 STOSB, STOSW, and STOSD 274
9.2.5 LODSB, 1,ODSW, and 1.ODSD 275
9.2.6 Section Review 275
9.3 Selected String Procedures 276
9.3.1 Stf--compare Procedure 276
9.3.2 Stl'--length Procedure 277
9.3.3 Stf--copy Procedure 278
9.3.4 Sir trim Procedure 278
9.3.5 Sir "case Procedure 279
9.3.6 String Library Demo Program 280
9.3.7 Section Review 282
9.4 TWo-Dimensional Arrays 282
9.4.1 Ordering of Rows and Columns 282
9.4.2 Base-Index Operands 283
9.4.3 Base-index-Displacement Operands 285
9.4.4 Section Review 285
9.5 Searching and Sorting integer Arrays 285
9.5.1 Bubble Sort 286
9.5.2 Binary Search 287
9.5.3 Section Review 293
9'6 Chapter Summary 294
9.7 Programming Exercises 295
10 Structures and Macros 299
10'1 Structures 299
10. 1 .l Defining Structures 300
CONTENTS Xiii
10.l.2 Declaring Structure Variables 301
s structure Variables 301
10.1 .3 Referencing Structure Variables 302
10.1 .4 Example: Displaying the System Time 305
.
10.1 .5 Structures Containing Structures 307
s structures 307
10.1 .6 ExamDle. Drunkard's Walk 307
pie: Drunkard's Walk 307
10.1 .7 Declaring and Using Unions 310
10' I .8 Section Review 312
10'2 Macros 313
10'2.1 Overview 313
10.2.2 Defining Macros 313
o iAacros 313
10'2'3 Invoking Macros 314
s 'Aacros 314
10.2.4 Additional Macro Features 315
10.2.5 Using the Book's Macro Library 318
S Lhe Book's Macro Library 318
10'2.6 Example Program: Wrappers 324
J
10'2'7 Section Review 325
10'3 Conditional-Assembly Directives 326
10'3.1 Checking for Missing Arguments 326
s for Missing Arguments 326
10'3.2 Default Argument initialliers 328
10.3.3 Boolean ExDressions 328
pressions 328
10'3'4 IF, ELSE, and ENDIF Directives 328
10'3'5 The IFIDN and IFIDNI Directives 329
10.3.6 Example: Summing a Matrix Row 330
10'3'7 Special Operators 333
10'3'8 Macro Functions 336
10'3.9 Section Review 337
10'4 Definina ReDeat Blocks 338
s Repeat Blocks 338
10'4'l WHILE Directive 338
10.4.2 REPEAT Directive 338
10'4.3 FOR Directive 339
10.4.4 FORC Directive 340
10'4.5 Example: Linked List 340
pie: Linked List 340
10'4.6 Section Review 342
10'5 Chapter Summary 342
10'6 Proarammina Exercises 343
cramming Exercises 343
11 MS-Windows Proarammina 346
"ramming 346
11'1 Win32 Console Proqrammina 346
cramming 346
l 1. 1. 1 Background information 347
.round information 347
l l' l.2 Win32 Console Functions 350
11.1 .3 Displaying a Message Box 352
.
l 1' l'4 Console Input 354
put 354
l I 'l.5 Console Output 360
l 1. I .6 Reading and Writing Files 361
. CONTENTS
XIV CONTENTS
l 1. 1 .7 File I/O in the lrvine32 Library 365
l 1. I .8 Testing the File I/O Procedures 367
1 1. 1.9 Console Window Manipulation 370
11. 1 .10 Controlling the Cursor 373
l 1. 1. 1 1 Controlling the Text Color 373
1 1. 1. 12 Time and Date Functions 375
l 1. 1. 13 Section Review 379
11.2 Writing a Graphical Windows Application 379
l 1.2.1 Necessary Structures 380
l 1.2.2 The MessageBox Function 381
l 1.2.3 The WinMain Procedure 382
l 1.2.4 The Winproc Procedure 382
l 1.2.5 The ErrorHandler Procedure 383
l 1.2.6 Program Listing 383
l 1.2.7 Section Review 386
11.3 Dynamic Memory Allocation 387
1 l.3.1 HeapTest Programs 390
11.3.2 Section Review 393
11.4 lA-32 Memory Management 393
l l.4.1 Linear Addresses 394
l 1.4.2 Page Translation 397
11.4.3 Section Review 398
11'5 Chapter Summary 399
11.6 Programming Exercises 400
12 High-Level Language interface 402
12.1 Introduction 402
12. 1. 1 General Conventions 402
12.1.2 Section Review 403
12.2 Inline Assembly Code 404
12.2.1 asm DirectiVe in Microsoft Visual C++ 404
12.2.2 File Encryption Example 406
12.2.3 SectionReview 409
12.3 Linking to C/C++ in Protected Mode 409
12.3.1 Using Assembly Language to Optimize C++ Code 410
12.3.2 Calling C and C++ Functions 415
12.3.3 MultiplicationTable Example 416
12.3.4 Calling C Library Functions 419
12.3.5 Directory Listing Program 422
J Listing Program 422
12.3.6 Section Review 423
12.4 Linking to C/C++ in Real-Address Mode 423
12.4.1 Linking to Borland C++ 424
CONTENTS XV
12.4.2 ReadSector Example 425
12.4.3 Example: Large Random integers 428
'
12'4.4 Section Review 430
12'5 Chapter Summary 430
12'6 Programming Exercises 431
13 16-Bit MS-DOS Programming 432
13.1 MS-DOS and the IBM-PC 432
13. I .l Memory Organization 433
j &anlzation 433
13.1.2 Redirecting InDut-Output 434
o Input-Output 434
13'l.3 Software interrupts 435
13'l.4 INT Instruction 435
13. l.5 Coding for 16-Bit Programs 436
s tor 16-Bit Programs 436
13'l.6 Section Review 437
13'2 MS-DOS Function Calls (INT 21h) 438
13.2.1 Selected Output Functions 439
13.2.2 Hello WOrld Program Example 441
13'2.3 Selected input Functions 442
13.2.4 Datemme Functions 446
13'2.5 Section Review 449
13'3 Standard MS-DOS File I/O Services 449
13.3. 1 Create or Open File (716Ch) 451
13'3.2 Close File Handle (3Eh) 452
13.3.3 Move File Pointer (42h) 452
13'3.4 Get File Creation Date and Time 453
13'3.5 Selected Library Procedures 453
J
13.3.6 Example: Read and Copy a Text File 454
.'
13.3.7 ReadinZ the MS-DOS Command Tail 456
o
13.3.8 Example: Creating a Binary File 458
13.3.9 Section Review 461
13'4 Chapter Summary 461
13'5 Chapter Exercises 463
14 Disk Fundamentals 464
14'1 Disk Storaae Systems 464
sc Systems 464
14'l'l Tracks, Cylinders, and Sectors 465
14.l.2 Disk Partitions (Volumes) 466
14.1.3 Section Review 468
14.2 File Systems 468
ystems 468
14.2.1 FAT12 469
. r
XVI CONTENTS
14.2.2 FAT16 469
14.2.3 FAT32 469
14.2.4 NTFS 470
14.2.5 PrimarV DiskAreas 470
j.
14.2.6 Section Review 471
14.3 Disk Directory 472
14.3.1 MS-DOS Directory Structure 473
14.3.2 Long Filenames in MS-Windows 475
14.3.3 FileAllocation Table (FAT) 476
14.3.4 Section Review 477
14.4 Reading and Writing Disk Sectors (7305h) 477
14.4.1 Sector Display Program 478
14.4.2 Section Review 482
14.5 System-Level File Functions 482
14.5.1 Get Disk Free Space (7303h) 483
14.5.2 Create subdirectory (39h) 485
14.5.3 Remove Subdirectory (3Ah) 486
14.5.4 Set Current Directory (3Bh) 486
14.5.5 Get Current Directory (47h) 486
y (47h) 486
14.5.6 Get and Set File Attributes (7143h) 486
14.5.7 Section Review 487
14'6 Chapter Summary 487
14.7 Programming ExerciseS 488
15 BIOS-Level Programming 490
15.1 Introduction 490
15.1.1 BIOS Data Area 491
15.2 Keyboard Input with INT 16h 492
15.2. 1 How the Keyboard Works 492
J
15.2.2 INT 16h Functions 493
15.2.3 Section Review 497
15.3 VIDEO Programming with INT 10h 498
15.3.1 Basic Background 498
.found 498
15.3.2 Controlling the Color 499
15.3.3 INT 10hVideo Functions 501
15.3.4 LibrarV Procedure Examples sl 1
J Procedure Examples sl 1
15.3.5 Section Review 512
15.4 Drawing Graphics Using INT 10h 512
15.4.1 INT 10h Pixel-Related Functions 513
15.4.2 DrawLine Program 514
CONTENTS xvii
15.4.3 Cartesian Coordinates Program 515
o
15.4(4 Converting Cartesian Coordinates to Screen Coordinates 517
6
15.4.5 Section Review 518
15.5 Memory-Mapped GraDhics 519
y-Mapped Graphics 519
15.5.1 Mode 13h: 320 X 200, 256 Colors 519
15.5.2 MemorV-Mapped Graohics Program 520
J idapped Graphics Program 520
15.5.3 Section Review 523
15.6 Mouse Proarammina 523
srammlng 523
15.6.1 Mouse INT 33h Functions 523
15.6.2 Mouse Tracking Program 528
o Program 528
15.6.3 SectionReview 532
15'7 Chapter Summary 533
15'8 Chapter Exercises 534
16 Expert MS-DOS Programming 536
16.1 Introduction 536
16.2 Defining Segments 537
16.2.1 Simplified Segment DirectiVes 537
16.2.2 Explicit Segment Definitions 538
16.2.3 Segment Overrides 542
16.2.4 CombininZ Segments 542
o begments 542
16.2.5 Section Review 543
16.3 Runtime Program Structure 544
16.3.1 Program Segment Prefix 544
16.3.2 COM Programs 545
Slams 545
16.3.3 EXE Programs 546
16.3.4 Section Review 547
16.4 Interrupt Handlina 548
pt Handling 548
16.4. I Hardware interrupts 549
16.4.2 Interrupt Control instructions 550
16.4.3 Writing a Custom interrupt Handler 551
o
16.4.4 Terminate and StaV Resident ProZrams 553
, Resident Programs 553
16.4.5 Application: The No--Reset Program 554
16.4.6 Section Review 557
16.5 Hardware ContrOl Using l/O Ports 558
16.5.1 Input-Output Pofts 558
put~Output Ports 558
16.5.2 PC Sound Program 558
16'6 Chapter Summary 560
...
xvill CONTENTS
17 Floating-Point Processing and instruction
Encodina 562 9 and instruction
9 O62
17.1 Floatina-Point Binary Reoresentation 562
s-Point Binary Representation 562
17.1.1 IEEE BinarV Floating-Point Representation 563
y floating-Point Representation 563
17.1.2 The exponent 564
ponent 564
17.1.3 Normalized Binary FloatinZ-Point Numbers 565
J floating-Point Numbers 565
17.l.4 Creating the IEEE Representation 565
17.1.5 ConvertinZ Decimal Fractions to Binary Reals 567
o Decimal Fractions to Binary Reals 567
17.1.6 Section Review 568
17.2 Floating-Point Unit 569
17.2.1 FPU ReZister Stack 569
o.
17.2.2 Rounding 571
5 3 71
17.2.3 Floating-Point Exceptions 573
& Point Exceptions 573
17.2.4 Floating-Point instruction Set 573
& Point instruction Set 573
17.2.5 Arithmetic instructions 576
17.2.6 Comparing Floating-PointValues 579
17.2.7 Reading and Writing Floating-Point Values 582
a and Writing Floating-Point Values 582
17.2.8 Exception Synchronization 583
17.2.9 Code Examples 584
17.2.10 Mixed-ModeArithmetic 585
17.2.if Masking and Unmasking Exceptions 586
s and Unmasking Exceptions 586
17.2.12 Section Review 587
17.3 Intel Instruction Encoding 588
17.3.1 lA-32 InstrUction Format 588
17.3.2 Single-Byte instfllctions 589
&ie-Byte instfllctions 589
17.3.3 Move Immediate to Register 590
ulster 590
17.3.4 Register-Mode instructions 591
17.3.5 lA-32 Processor Operand-Size Prefix 591
17.3.6 Memory-Mode instfllctions 592
J .bode instructions 592
17.3.7 Section Review 595
17'4 Chapter Summary 596
17.5 Proarammina Exercises 597
cramming Exercises 597
Appendix A MASM Reference 600
Appendix B The lA-32 Instruction Set 619
Appendix C BIOS and MS-DOS Interrupts 650
Appendix D Answers to Review Questions 659
……