00 Contents
00 Contents
Contents
Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
New and Extended Features in MASM 6.1 . . . . . . . . . . . . . . . . . . . . . . . . xiii
MASM Features New Since Version 5.1 . . . . . . . . . . . . . . . . . . . . . . . . xiv
MASM Features New Since Version 6.0 . . . . . . . . . . . . . . . . . . . . . . . . xv
ML and MASM Command Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi
Compatibility with Earlier Versions of MASM . . . . . . . . . . . . . . . . . . . . xvi
A Word About Instruction Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Books for Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii
Document Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
Getting Assistance and Reporting Problems . . . . . . . . . . . . . . . . . . . . . . . . xx
Chapter 8 Sharing Data and Procedures Among Modules and Libraries . . . . . 211
Selecting Data-Sharing Methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Sharing Symbols with Include Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Organizing Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Declaring Symbols Public and External . . . . . . . . . . . . . . . . . . . . . . . . 214
Positioning External Declarations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
Using Alternatives to Include Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
PUBLIC and EXTERN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
Other Alternatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
Developing Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
Associating Libraries with Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Using EXTERN with Library Routines . . . . . . . . . . . . . . . . . . . . . . . . 223
Appendixes
Appendix A Differences Between MASM 6.1 and 5.1. . . . . . . . . . . . . . . . . . . . 341
New Features of Version 6.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
The Assembler, Environment, and Utilities . . . . . . . . . . . . . . . . . . . . . . 342
Segment Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
Procedures, Loops, and Jumps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
Simplifying Multiple-Module Projects . . . . . . . . . . . . . . . . . . . . . . . . . 348
Expanded State Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
New Processor Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
Renamed Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
Macro Enhancements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
MASM 6.1 Programming Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
Compatibility Between MASM 5.1 and 6.1. . . . . . . . . . . . . . . . . . . . . . . . 352
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
Tables
1.1 8086 Family of Processors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 The MS-DOS and Windows Operating Systems Compared . . . . . . . . . . 4
1.3 Operator Precedence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.1 Attributes of Memory Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.1 Indirect Addressing with 16-Bit Registers . . . . . . . . . . . . . . . . . . . . . . 68
4.1 Division Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
5.1 Requirements for String Instructions . . . . . . . . . . . . . . . . . . . . . . . . . 112
6.1 Ranges of Floating-Point Variables . . . . . . . . . . . . . . . . . . . . . . . . . . 136
6.2 Coprocessor Operand Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
6.3 Control-Flag Settings After Comparison or Test . . . . . . . . . . . . . . . . . 151
7.1 Conditional Jumps Based on Comparisons of Two Values . . . . . . . . . 167
9.1 MASM Macro Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
11.1 MS-DOS Internal Stacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
12.1 Naming and Calling Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . 309
12.2 Register Conventions for Simple Return Values . . . . . . . . . . . . . . . . 317
A.1 Requirements for String Instructions. . . . . . . . . . . . . . . . . . . . . . . . . 353
C.1 Options for Generating or Modifying Listing Files . . . . . . . . . . . . . . . 398
C.2 Symbols and Abbreviations in Listings . . . . . . . . . . . . . . . . . . . . . . . 400
C.3 Symbols in Timing Column . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401