304 lines
13 KiB
Plaintext
304 lines
13 KiB
Plaintext
|
A86 assembler package V3.22 January 25, 1990
|
|||
|
|
|||
|
The entire package is Copyright 1986--1990 Eric Isaacson.
|
|||
|
All rights reserved.
|
|||
|
|
|||
|
PLEASE read Chapter 1 for legal terms and conditions, how to
|
|||
|
register for the package, and the overview of the assembler.
|
|||
|
|
|||
|
This manual is huge! A note about printing it occurs at
|
|||
|
the bottom of the next page.
|
|||
|
|
|||
|
If you have never heard of "shareware", and you purchased
|
|||
|
this disk from XYZ Software House, that advertises great
|
|||
|
software for $5 per disk, you may now be asking the following
|
|||
|
|
|||
|
QUESTION: "What's going on here? Have I already bought an
|
|||
|
assembler, or what?"
|
|||
|
|
|||
|
ANSWER: Well, no, not exactly. You've bought a disk that has
|
|||
|
great software on it; you haven't bought the software yet.
|
|||
|
A86, like the vast majority of software offered by the $5-
|
|||
|
per-disk distribution houses, is free-distribution software
|
|||
|
(also known as "shareware", or "user-supported software").
|
|||
|
That means I retain the rights to A86, but I choose to let
|
|||
|
people pass it around. I have no business relationship
|
|||
|
with any distribution houses in the U.S.; I don't get a
|
|||
|
penny of the $5 (or whatever) you paid them for the disk
|
|||
|
containing A86. So I need and expect to be paid by you,
|
|||
|
because I make my living out of making and supporting
|
|||
|
shareware products.
|
|||
|
|
|||
|
A few distribution houses do a pretty poor job of revealing
|
|||
|
the shareware nature of the software they sell. If you
|
|||
|
thought you had purchased the software free and clear, you
|
|||
|
might feel justified in being angry with them for having
|
|||
|
misled you. And you might look around for houses that do a
|
|||
|
better job of informing the public. But I hope you'll take
|
|||
|
the time to consider everybody's role in the shareware
|
|||
|
marketing scene; if you do, I think you'll conclude that
|
|||
|
although you may have been misled, you haven't really been
|
|||
|
cheated out of anything.
|
|||
|
|
|||
|
Shareware is great for authors like me, who have spent all
|
|||
|
their years in their computer holes, learning to be great
|
|||
|
programmers, and no time in business school learning
|
|||
|
marketing and distribution techniques. We simply cast our
|
|||
|
programs to the winds. They are distributed at practically
|
|||
|
no cost to us. That's why we can charge less than
|
|||
|
the cost of "commercial" software.
|
|||
|
0-2
|
|||
|
Shareware is also great for customers like you. You can
|
|||
|
try out the software before paying for it. You'll know
|
|||
|
that a successful shareware product is good, because only
|
|||
|
satisfied customers pay for it. The existence of shareware
|
|||
|
infuses healthy competition in the entire software market,
|
|||
|
for both price and quality. In the case of A86, I'm
|
|||
|
utterly convinced that you'll never find a better value for
|
|||
|
an assembler, anywhere.
|
|||
|
|
|||
|
Finally, let's consider the distribution houses. They
|
|||
|
provide a legitimate service, for which they charge a
|
|||
|
reasonable price. The best houses act as librarians,
|
|||
|
evaluating and cataloguing software. Most pay thousands of
|
|||
|
dollars for advertising. Their cut is far less than the
|
|||
|
distributor's cut for "commercial" software (they prosper
|
|||
|
because their volume is bigger). Most customers for the
|
|||
|
distribution houses are repeat customers, who are aware of,
|
|||
|
and happy with, what they are getting. If it weren't for
|
|||
|
your XYZ House, you might never have heard of A86, or might
|
|||
|
never have figured out where to obtain it.
|
|||
|
|
|||
|
So I hope you'll be happy with shareware, and actively
|
|||
|
desire to support it. You'll feel good about promoting a
|
|||
|
healthy situation for everybody. And you'll encourage the
|
|||
|
best programmers in the world to keep writing for you,
|
|||
|
instead of for the big corporations.
|
|||
|
|
|||
|
|
|||
|
Now that I've said that, let's move on to the package. The
|
|||
|
A86 package consists of the four programs A86.COM, XREF.COM,
|
|||
|
EXMAC.COM, and FAKE.EXE; a collection of source, batch, and
|
|||
|
library files used by the demonstration contained in Chapter
|
|||
|
2, and a sequence of DOC files that, when printed out in
|
|||
|
order, make the manual. Each chapter is a DOC file whose
|
|||
|
name is A??.DOC, where ?? runs from 00 though 17. Exception:
|
|||
|
chapter 6 is split into A06A.DOC and A06B.DOC. The second
|
|||
|
file is wider, and should be printed at 12 cpi if you can
|
|||
|
manage it. The other files can print at 10cpi with margins--
|
|||
|
You should set your printer to a 1-inch left margin, as the
|
|||
|
DOC files do not attempt to provide a left margin for you.
|
|||
|
(You can modify the PAGE.8 program to output the appropriate
|
|||
|
codes!)
|
|||
|
|
|||
|
0-3
|
|||
|
TABLE OF CONTENTS
|
|||
|
|
|||
|
|
|||
|
CHAPTER 1 INTRODUCTION AND LEGAL TERMS
|
|||
|
|
|||
|
Introduction 1-1
|
|||
|
Legal Terms and Conditions 1-1
|
|||
|
Registration Benefits 1-3
|
|||
|
Overview of A86 1-4
|
|||
|
About the Author 1-6
|
|||
|
How to Contact Me 1-6
|
|||
|
|
|||
|
|
|||
|
CHAPTER 2 A86 DEMONSTRATION
|
|||
|
|
|||
|
Demonstration of A86 and Associated Tools 2-1
|
|||
|
Assembling a Very Short Program: PAGE.COM 2-1
|
|||
|
Demonstration of Error-Reporting 2-1
|
|||
|
Assembling a Longer Program with Library Files: REV.COM 2-1
|
|||
|
Using XREF on a medium-sized program: TCOLS.COM 2-2
|
|||
|
Using EXMAC 2-2
|
|||
|
|
|||
|
|
|||
|
CHAPTER 3 OPERATION AND REQUIREMENTS
|
|||
|
|
|||
|
Creating Programs to Assemble 3-1
|
|||
|
Program Invocation 3-1
|
|||
|
Assembler Switches 3-2
|
|||
|
The A86 Environment Variable 3-4
|
|||
|
Using Standard Input as a Command Tail 3-5
|
|||
|
Strategies for Source File Maintenance 3-6
|
|||
|
System Requirements for A86 3-6
|
|||
|
|
|||
|
|
|||
|
CHAPTER 4 ELEMENTS OF THE A86 LANGUAGE
|
|||
|
|
|||
|
The A86 Language and the A86 Program 4-1
|
|||
|
General Categories of A86 Elements 4-1
|
|||
|
Operand Typing and Code Generation 4-3
|
|||
|
Registers 4-3
|
|||
|
Variables 4-3
|
|||
|
Labels 4-4
|
|||
|
Constants 4-4
|
|||
|
Generating Opcodes from General Purpose Mnemonics 4-4
|
|||
|
|
|||
|
|
|||
|
CHAPTER 5 SOME EXCLUSIVE FEATURES OF A86
|
|||
|
|
|||
|
The IF Statement 5-1
|
|||
|
Multiple operands to PUSH, POP, INC, DEC 5-1
|
|||
|
Conditional Return Instructions 5-2
|
|||
|
A86 extensions to the MOV and XCHG instructions 5-2
|
|||
|
Local Symbols 5-3
|
|||
|
Operands to AAM and AAD Instructions 5-4
|
|||
|
Single-Operand Forms of the TEST Instruction 5-4
|
|||
|
Optimized LEA Instruction 5-4
|
|||
|
0-4
|
|||
|
CHAPTER 6 THE 86 INSTRUCTION SET
|
|||
|
|
|||
|
Effective Addresses 6-1
|
|||
|
Segmentation and Effective Addresses 6-2
|
|||
|
Effective Use of Effective Addresses 6-3
|
|||
|
Encoding of Effective Addresses 6-4
|
|||
|
Table of Effective Address byte values 6-5
|
|||
|
How to Read the Instruction Set Chart 6-6
|
|||
|
The Instruction Set Chart 6-8
|
|||
|
|
|||
|
|
|||
|
CHAPTER 7 THE FLOATING-POINT PROCESSOR
|
|||
|
|
|||
|
The 8087 and 287 Coprocessors 7-1
|
|||
|
Extra Coprocessor Support 7-2
|
|||
|
Emulating the 8087 by Software 7-2
|
|||
|
The Floating Point Stack 7-3
|
|||
|
Floating Point Initializations 7-3
|
|||
|
Built-In Constant Names 7-4
|
|||
|
Special Immediate FLD Form 7-4
|
|||
|
Floating Point Operand Types 7-5
|
|||
|
Operand Choices in A86 7-6
|
|||
|
The 87 Instruction Set 7-6
|
|||
|
|
|||
|
|
|||
|
CHAPTER 8 NUMBERS AND EXPRESSIONS
|
|||
|
|
|||
|
Numbers and Bases 8-1
|
|||
|
The RADIX Directive 8-2
|
|||
|
Floating-point Initializations 8-3
|
|||
|
Overview of Expressions 8-3
|
|||
|
Types of Expression Operands 8-4
|
|||
|
Numbers and Label Addresses 8-4
|
|||
|
Variables 8-4
|
|||
|
Index Expressions 8-4
|
|||
|
Arithmetic Operators 8-4
|
|||
|
HIGH/LOW 8-4
|
|||
|
BY 8-5
|
|||
|
Addition (combination) 8-5
|
|||
|
Subtraction 8-6
|
|||
|
Multiplication and Division 8-6
|
|||
|
Shifting Operators 8-6
|
|||
|
Logical Operators 8-7
|
|||
|
Boolean Negation Operator 8-7
|
|||
|
Relational Operators 8-8
|
|||
|
String Comparison Operators 8-8
|
|||
|
Attribute Operators/Specifiers 8-9
|
|||
|
B,W,D,Q,T Memory Variable Specifiers 8-9
|
|||
|
SHORT and LONG operators 8-9
|
|||
|
OFFSET operator 8-10
|
|||
|
NEAR Operator 8-11
|
|||
|
Square Brackets Operator 8-11
|
|||
|
Colon Operator 8-11
|
|||
|
ST Operator 8-12
|
|||
|
TYPE Operator 8-12
|
|||
|
THIS and $ Specifiers 8-12
|
|||
|
Operator Precedence 8-13
|
|||
|
0-5
|
|||
|
CHAPTER 9 DIRECTIVES IN A86
|
|||
|
|
|||
|
Segments in A86 9-1
|
|||
|
CODE ENDS and DATA ENDS Statements 9-2
|
|||
|
The ORG Directive 9-2
|
|||
|
The EVEN Directive 9-3
|
|||
|
Data Allocation Using DB, DW, DD, DQ, and DT 9-3
|
|||
|
The STRUC Directive 9-6
|
|||
|
Forward References 9-6
|
|||
|
Forward References in Expressions 9-7
|
|||
|
The EQU Directive 9-8
|
|||
|
Equates to Built-In Symbols 9-9
|
|||
|
The NIL Prefix 9-9
|
|||
|
Interrupt Equates 9-9
|
|||
|
Duplicate Definitions 9-9
|
|||
|
The = Directive 9-10
|
|||
|
The PROC Directive 9-10
|
|||
|
The ENDP Directive 9-11
|
|||
|
The LABEL Directive 9-11
|
|||
|
|
|||
|
|
|||
|
CHAPTER 10 RELOCATION AND LINKAGE
|
|||
|
|
|||
|
.OBJ Production Made Easy 10-1
|
|||
|
Overview of Relocation and Linkage 10-3
|
|||
|
The NAME Directive 10-5
|
|||
|
The PUBLIC Directive 10-5
|
|||
|
The EXTRN Directive 10-6
|
|||
|
MAIN: The Starting Location for a Program 10-7
|
|||
|
The END Directive 10-7
|
|||
|
The SEGMENT Directive 10-8
|
|||
|
DATA SEGMENT, STRUC and CODE SEGMENT Directives 10-11
|
|||
|
The ENDS Directive 10-11
|
|||
|
Default Outer SEGMENT 10-12
|
|||
|
The GROUP Directive 10-12
|
|||
|
The SEG Operator 10-13
|
|||
|
0-6
|
|||
|
CHAPTER 11 MACROS AND CONDITIONAL ASSEMBLY
|
|||
|
|
|||
|
Macro Facility 11-1
|
|||
|
Simple Macro Syntax 11-1
|
|||
|
Formatting in macro definitions and calls 11-2
|
|||
|
Macro operand substitution 11-2
|
|||
|
Quoted-string operands 11-3
|
|||
|
Looping by operands in macros 11-4
|
|||
|
The #L last operator and indefinite repeats 11-5
|
|||
|
Character-loops 11-5
|
|||
|
The "B"-before and "A"-after operators 11-6
|
|||
|
Multiple-increments within loops 11-6
|
|||
|
Negative R-loops 11-7
|
|||
|
Nesting of loops in macros 11-8
|
|||
|
Implied closing of loops 11-8
|
|||
|
Passing Operands by Value 11-8
|
|||
|
Passing Operand Size 11-8
|
|||
|
Generating the Number of an Operand 11-9
|
|||
|
Parenthesized Operand Numbers 11-9
|
|||
|
Exiting from the Middle of a Macro 11-10
|
|||
|
Local labels in macros 11-10
|
|||
|
Debugging macro expansions 11-11
|
|||
|
Conditional Assembly 11-11
|
|||
|
Conditional Assembly and Macros 11-13
|
|||
|
Simulating MASM's Conditional Assembly Constructs 11-14
|
|||
|
Conditional Assembly and the XREF Program 11-14
|
|||
|
Declaring Variables in the Assembler Invocation 11-14
|
|||
|
Null Invocation Variable Names 11-15
|
|||
|
Changing Values of Invocation Variables 11-15
|
|||
|
|
|||
|
|
|||
|
CHAPTER 12 COMPATIBILITY WITH OTHER ASSEMBLERS
|
|||
|
|
|||
|
Conversion of MASM programs to A86 12-1
|
|||
|
Compatibility-symbols recognized by A86 12-4
|
|||
|
Conversion of A86 Programs to Intel/IBM/MASM 12-5
|
|||
|
|
|||
|
|
|||
|
CHAPTER 13 ASSOCIATED TOOLS
|
|||
|
|
|||
|
XREF Cross-reference and Symbol Listing Facility 13-1
|
|||
|
EXMAC Macro Expansion Tool 13-2
|
|||
|
A86LIB Source File Library Tool 13-3
|
|||
|
Using A86.LIB in A86 Assemblies 13-4
|
|||
|
Environment Variable A86LIB 13-5
|
|||
|
Forcing a Library Search 13-5
|
|||
|
Listings with A86 13-5
|
|||
|
Mimicking Tool: FAKE.EXE 13-7
|
|||
|
|
|||
|
CHAPTER 14 DESCRIPTIONS OF A86 ERROR MESSAGES
|
|||
|
|
|||
|
CHAPTER 15 RELEASE HISTORY OF A86
|
|||
|
|
|||
|
CHAPTER 16 RESERVED SYMBOLS IN THE A86 LANGUAGE
|
|||
|
|
|||
|
INDEX
|
|||
|
|