MASM Programmers Guide
by Microsoft
Microsoft® MASM
Assembly-Language Development System
Version 6.1
For MS-DOS® and Windows™ Operating Systems
Microsoft Corporation
Information in this document is subject to change without notice. Companies, names, and data -
-------------------------------------------------------------------------------------
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 1 Understanding Global Concepts............................... 1
The Processing Environment.................................... 1
8086-Based Processors..................................... 2
Operating Systems........................................ 4
Segmented Architecture..................................... 5
Segment Protection........................................ 6
Segmented Addressing...................................... 7
Segment Arithmetic........................................ 7
Language Components of MASM................................ 8
Reserved Words.......................................... 8
Identifiers............................................... 9
Predefined Symbols....................................... 10
Integer Constants and Constant Expressions...................... 11
Operators.............................................. 13
Data Types............................................. 14
Registers.............................................. 16
Statements............................................. 21
The Assembly Process....................................... 22
Generating and Running Executable Programs.................... 23
Using the OPTION Directive................................ 24
Conditional Directives..................................... 28
Chapter 2 Organizing Segments...................................... 31
Physical Memory Segments.................................... 32
Logical Segments........................................... 32
Using Simplified Segment Directives.............................. 33
Defining Basic Attributes with .MODEL......................... 34
Specifying a Processor and Coprocessor........................ 38
Creating a Stack......................................... 38
Creating Data Segments.................................... 39
Creating Code Segments.................................... 40
Starting and Ending Code with .STARTUP and .EXIT............... 41
Using Full Segment Definitions................................. 44
Defining Segments with the SEGMENT Directive.................. 44
Controlling the Segment Order............................... 47
Setting the ASSUME Directive for Segment Registers............... 49
Defining Segment Groups................................... 51
Chapter 3 Using Addresses and Pointers............................... 53
Programming Segmented Addresses.............................. 53
Initializing Default Segment Registers........................... 53
Near and Far Addresses.................................... 57
Operands................................................. 60
Register Operands........................................ 61
Immediate Operands...................................... 61
Direct Memory Operands................................... 62
Indirect Memory Operands.................................. 64
The Program Stack......................................... 71
Saving Operands on the Stack................................ 71
Saving Flags on the Stack................................... 73
Saving Registers on the Stack (80186
|
|
|

