MOTOROLA DIGITAL SIGNAL PROCESSING
DEVELOPMENT SOFTWARE
MOTOROLA DSP
ASSEMBLER REFERENCE MANUAL
Motorola, Incorporated
Semiconductor Products Sector
DSP Division
6501 William Cannon Drive West
Austin, TX, 78735-8598
Specification and information herein are subject to change without notice. Motorola reserves the right to make changes without further notice to any products described in this
document to improve reliability, function, or design. Motorola does not assume any liability
arising out of the application or use of any product or circuit described herein, neither does
it convey any license under its patent rights or the rights of others. Motorola is a registered
trademark of Motorola, Inc. Motorola, Inc. is an Equal Employment/Affirmative Action Employer.
This manual documents the assembler as of version 6.0 of the software.
© Copyright Motorola, Inc. 1996. All rights reserved.
ASM56000, SIM56000, ASM96000, SIM96000, ASM56100, SIM56100, ASM56300,
SIM56300, ASM56800 and SIM56800 are trademarks of Motorola.
MS-DOS and Windows are trademarks of Microsoft Corporation.
Sun-4 and SunOS are trademarks of Sun Microsystems, Inc.
Macintosh and MPW are trademarks of Apple Computer.
MOTOROLA DSP ASSEMBLER
1
WRITING ASSEMBLY LANGUAGE PROGRAMS
2
EXPRESSIONS
3
SOFTWARE PROJECT MANAGEMENT
4
MACROS AND CONDITIONAL ASSEMBLY
5
ASSEMBLER CHARACTERS AND DIRECTIVES
6
STRUCTURED CONTROL STATEMENTS
7
ASCII CHARACTER CODES
A
DIRECTIVE SUMMARY
B
ASSEMBLER MESSAGES
C
ASSEMBLER LISTING FILE FORMAT
D
MOTOROLA DSP OBJECT FILE FORMAT (COFF)
E
DEVICE-DEPENDENT INFORMATION
F
HOST-DEPENDENT INFORMATION
G
INDEX
I
1
MOTOROLA DSP ASSEMBLER
2
WRITING ASSEMBLY LANGUAGE PROGRAMS
3
EXPRESSIONS
4
SOFTWARE PROJECT MANAGEMENT
5
MACROS AND CONDITIONAL ASSEMBLY
6
ASSEMBLER CHARACTERS AND DIRECTIVES
7
STRUCTURED CONTROL STATEMENTS
A
ASCII CHARACTER CODES
B
DIRECTIVE SUMMARY
C
ASSEMBLER MESSAGES
D
ASSEMBLER LISTING FILE FORMAT
E
MOTOROLA DSP OBJECT FILE FORMAT (COFF)
F
DEVICE-DEPENDENT INFORMATION
G
HOST-DEPENDENT INFORMATION
I
INDEX
Preface
PREFACE
Notation
The notational conventions used in this manual are:
DIRECTIVE
All assembler mnemonics and directives are shown in bold upper case to highlight
them. However, the assembler will recognize both upper and lower case for mnemonics and directives.
{}
Contains a list of elements or directives, one of which must be selected. Each
choice will be separated by a vertical bar. For example, {R I L} indicates that either
R or L must be selected.
[]
Contains one or more optional elements. If more than one optional element is
shown, the required element separators are indicated. All elements outside of the
angle brackets (< >) must be specified as they appear. For example, the syntactical element [<number>,] requires the comma to be specified if the optional element
<number> is selected.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
i
Preface
<>
The element names are printed in lower case and contained in angle brackets.
Some common elements used to describe directives are:
<comment>
<label>
<expr> or
<expression>
<number>
<string>
<delimiter>
<option>
<sym> or
<symbol>
A statement comment
A statement label
An assembler expression
A numeric constant
A string of ASCII characters enclosed in quotes
A delimiter character
An assembler option
An assembler symbol
Supporting Publications
DSP56000 Family Manual. Motorola, Inc. 1992.
DSP96002 User’s Manual. Motorola, Inc. 1989.
DSP56100 Family Manual. Motorola, Inc. 1993.
DSP56300 Family Manual. Motorola, Inc. 1995.
DSP56800 Family Manual. Motorola, Inc. 1996.
Motorola DSP Simulator Reference Manual. Motorola, Inc. 1996.
Motorola DSP Linker/Librarian Reference Manual. Motorola, Inc. 1996.
ii
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
TABLE OF CONTENTS
PREFACE
TABLE OF CONTENTS
LIST OF FIGURES
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
Chapter 1
MOTOROLA DSP ASSEMBLER
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
ASSEMBLY LANGUAGE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
INSTALLING THE ASSEMBLER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
RUNNING THE ASSEMBLER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
ASSEMBLER OPTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
ASSEMBLER PROCESSING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9
DEFINITION OF TERMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9
ASSEMBLER SUPPORT FOR DIGITAL SIGNAL PROCESSING . . . . . . 1-10
2.1
2.2
2.3
2.4
2.4.1
2.4.2
2.4.3
2.4.4
2.4.5
2.4.6
2.4.7
2.5
Chapter 2
WRITING ASSEMBLY LANGUAGE PROGRAMS
INPUT FILE FORMAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SYMBOL NAMES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
STRINGS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SOURCE STATEMENT FORMAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Label Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Operation Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Operand Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Operation 2 Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Operand 2 Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Data Transfer Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Comment Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ASSEMBLER OUTPUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.1
Chapter 3
EXPRESSIONS
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
2-1
2-1
2-2
2-2
2-3
2-4
2-5
2-5
2-5
2-5
2-6
2-6
iii
Table of Contents
3.2
3.3
3.4
3.5
3.5.1
3.5.2
3.6
3.6.1
3.6.2
3.6.3
3.6.4
3.6.5
3.6.6
3.7
3.8
3.8.1
3.8.2
3.8.3
3.8.4
3.8.5
ABSOLUTE AND RELATIVE EXPRESSIONS . . . . . . . . . . . . . . . . . . . . . . 3-1
EXPRESSION MEMORY SPACE ATTRIBUTE . . . . . . . . . . . . . . . . . . . . . 3-1
INTERNAL EXPRESSION REPRESENTATION . . . . . . . . . . . . . . . . . . . . . 3-3
CONSTANTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
Numeric Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
String Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4
OPERATORS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4
Unary operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4
Arithmetic operators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5
Shift operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5
Relational operators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
Bitwise operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
Logical operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
OPERATOR PRECEDENCE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
Mathematical Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8
Conversion Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9
String Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9
Macro Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9
Assembler Mode Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10
4.1
4.2
4.3
4.3.1
4.3.2
4.3.3
4.4
4.5
4.5.1
4.5.2
4.5.3
4.5.4
4.6
4.6.1
Chapter 4
SOFTWARE PROJECT MANAGEMENT
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1
SECTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1
SECTIONS AND DATA HIDING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Sections and Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Sections and Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4
Nested and Fragmented Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4
SECTIONS AND RELOCATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5
ADDRESS ASSIGNMENT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
The ORG Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7
Overlays. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9
Address Assignment Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-10
Circular Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-11
EXAMPLE 1: MULTI-PROGRAMMER ENVIRONMENT . . . . . . . . . . . . . . 4-13
Absolute Mode Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-14
iv
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Table of Contents
4.6.2
4.7
4.7.1
4.7.2
4.8
4.8.1
4.8.2
Relative Mode Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-15
EXAMPLE 2: OVERLAYS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-16
Absolute Mode Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-17
Relative Mode Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-18
EXAMPLE 3: BOOTSTRAP OVERLAY . . . . . . . . . . . . . . . . . . . . . . . . . . 4-20
Absolute Mode Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-21
Relative Mode Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-21
5.1
5.2
5.3
5.4
5.5
5.5.1
5.5.2
5.5.3
5.5.4
5.5.5
5.6
5.7
Chapter 5
MACRO OPERATIONS AND CONDITIONAL ASSEMBLY
MACRO OPERATIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1
MACRO LIBRARIES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
MACRO DEFINITION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
MACRO CALLS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4
DUMMY ARGUMENT OPERATORS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5
Dummy argument concatenation operator - \ . . . . . . . . . . . . . . . . . . . . . 5-5
Return value operator - ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6
Return hex value operator - % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-7
Dummy argument string operator - ". . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-7
Macro local label override operator - ^ . . . . . . . . . . . . . . . . . . . . . . . . . . 5-8
DUP, DUPA, DUPC, DUPF DIRECTIVES . . . . . . . . . . . . . . . . . . . . . . . . . 5-9
CONDITIONAL ASSEMBLY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9
6.1
6.2
6.3
6.3.1
6.3.2
6.3.3
6.3.4
6.3.5
6.3.6
6.3.7
Chapter 6
ASSEMBLER SIGNIFICANT CHARACTERS AND DIRECTIVES
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1
ASSEMBLER SIGNIFICANT CHARACTERS . . . . . . . . . . . . . . . . . . . . . . . 6-1
ASSEMBLER DIRECTIVES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
Assembly Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
Symbol Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3
Data Definition/Storage Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3
Listing Control and Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3
Object File Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4
Macros and Conditional Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4
Structured Programming. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
v
Table of Contents
7.1
7.2
7.3
7.3.1
7.3.2
7.3.3
Chapter 7
STRUCTURED CONTROL STATEMENTS
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1
STRUCTURED CONTROL DIRECTIVES . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1
SYNTAX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2
.BREAK Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2
.CONTINUE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3
.FOR Statement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4
7.3.4
7.3.5
7.3.6
7.3.7
7.4
7.4.1
7.4.1.1
7.4.1.2
7.4.2
7.5
7.5.1
7.5.2
7.5.3
7.6
.IF Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5
.LOOP Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-6
.REPEAT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-7
.WHILE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-7
SIMPLE AND COMPOUND EXPRESSIONS . . . . . . . . . . . . . . . . . . . . . . . 7-8
Simple Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8
Condition Code Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8
Operand Comparison Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . 7-9
Compound Expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10
STATEMENT FORMATTING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10
Expression Formatting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10
.FOR/.LOOP Formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-11
Assembly Listing Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-11
EFFECTS ON THE PROGRAMMER’S ENVIRONMENT . . . . . . . . . . . . . 7-11
Appendix A
ASCII CHARACTER CODES
Appendix B
B.1
B.2
B.3
B.4
B.5
B.6
B.7
vi
DIRECTIVE SUMMARY
ASSEMBLY CONTROL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SYMBOL DEFINITION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
DATA DEFINITION/STORAGE ALLOCATION. . . . . . . . . . . . . . . . . . . . . .
LISTING CONTROL AND OPTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
OBJECT FILE CONTROL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MACROS AND CONDITIONAL ASSEMBLY . . . . . . . . . . . . . . . . . . . . . . .
STRUCTURED PROGRAMMING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
DSP ASSEMBLER REFERENCE MANUAL
B-1
B-2
B-2
B-2
B-3
B-3
B-3
MOTOROLA
Table of Contents
Appendix C
C.1
C.2
C.3
C.4
C.5
ASSEMBLER MESSAGES
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-1
COMMAND LINE ERRORS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-2
WARNINGS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-4
ERRORS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-13
FATAL ERRORS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-44
Appendix D
D.1
D.2
D.3
D.4
D.5
ASSEMBLER LISTING FILE FORMAT
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
LISTING FILE COMMENTARY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CROSS-REFERENCE FORMAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MEMORY UTILIZATION REPORT FORMAT . . . . . . . . . . . . . . . . . . . . . .
ASSEMBLER LISTING FORMAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D-1
D-1
D-3
D-3
D-5
Appendix E
MOTOROLA DSP OBJECT FILE FORMAT (COFF)
E.1
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-1
E.2
OBJECT FILE STRUCTURE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-1
E.3
OBJECT FILE COMPONENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-3
E.3.1
File Header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-3
E.3.2
Optional Header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-4
E.3.3
Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-6
E.3.3.1
Section Headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-7
E.3.3.2
Relocation Information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-9
E.3.3.3
Line Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-10
E.3.4
Symbol Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-11
E.3.4.1
Symbol Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-13
E.3.4.2
Symbol Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-13
E.3.4.3
Section Number. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-14
E.3.4.4
Symbol Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-14
E.3.4.5
Symbol Storage Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-16
E.3.4.6
Auxiliary Entries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-20
E.3.4.6.1
Filenames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-21
E.3.4.6.2
Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-21
E.3.4.6.3
Tag Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-23
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
vii
Table of Contents
E.3.4.6.4
End of Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E.3.4.6.5
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E.3.4.6.6
Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E.3.4.6.7
End of Blocks and Functions . . . . . . . . . . . . . . . . . . . . . . . . . .
E.3.4.6.8
Beginning of Blocks and Functions . . . . . . . . . . . . . . . . . . . . .
E.3.4.6.9
Structure, Union, and Enumeration Names . . . . . . . . . . . . . . .
E.3.4.7
Object File Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E.3.5
String Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E.4
DIFFERENCES IN DSP OBJECT FORMAT AND STANDARD COFF . .
E.4.1
Multiple Memory Spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E.4.2
Object File Transportability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E.4.3
Structure Size Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E.4.4
Relocation Information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E.4.5
Block Data Sections. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E.4.6
Other Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E.5
OBJECT FILE DATA EXPRESSION FORMAT . . . . . . . . . . . . . . . . . . . .
E.5.1
Data Expression Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E.5.2
Data Expression Interpretation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E.5.2.1
User Expression - { ... } . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E.5.2.2
Relocatable Expression - [ ... ] . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E.5.2.3
Memory Space Operator - @ . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E.5.2.4
Bit Size Operator - #. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E.5.2.5
Memory Attribute Operator - :. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E.5.2.6
Line Number Operator - ! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E.5.2.7
BFxxx Instruction Mask Function - @FBF() . . . . . . . . . . . . . . . . . .
E.5.2.8
Local Relocatable Reference Function - @LRF() . . . . . . . . . . . . .
E.5.2.9
Alternate Encoding Function - @ENC() . . . . . . . . . . . . . . . . . . . . .
E-23
E-24
E-25
E-25
E-26
E-26
E-27
E-27
E-27
E-28
E-29
E-30
E-30
E-31
E-31
E-31
E-32
E-32
E-33
E-33
E-33
E-33
E-34
E-34
E-35
E-35
E-35
Appendix F
F.1
F.2
F.2.1
F.2.1.1
F.2.1.2
F.2.1.3
F.2.1.4
viii
DEVICE-DEPENDENT INFORMATION
INTRODUCTION. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-1
DSP56000 INFORMATION. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-2
Instruction Set Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-2
Arithmetic Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .F-3
Logical Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .F-4
Bit Manipulation Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . .F-4
Loop Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .F-4
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Table of Contents
F.2.1.5
F.2.1.6
F.2.2
F.2.3
F.3
F.3.1
F.3.1.1
F.3.1.2
F.3.1.3
F.3.1.4
F.3.1.5
F.3.1.6
F.3.2
F.3.3
F.4
F.4.1
F.4.1.1
F.4.1.2
F.4.1.3
F.4.1.4
F.4.1.5
F.4.1.6
F.4.2
F.4.3
F.5
F.5.1
F.5.1.1
F.5.1.2
F.5.1.3
F.5.1.4
F.5.1.5
F.5.1.6
F.5.2
F.5.3
F.6
F.6.1
Move Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-4
Program Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . F-5
Register Names and Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-6
Condition Code Mnemonics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-7
DSP96000 INFORMATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-8
Instruction Set Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-8
Arithmetic Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-8
Logical Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-10
Bit Manipulation Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . F-10
Loop Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-10
Move Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-11
Program Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . F-12
Register Names and Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-13
Condition Code Mnemonics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-14
DSP56100 INFORMATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-15
Instruction Set Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-15
Arithmetic Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-15
Logical Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-16
Bit Manipulation Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . F-17
Loop Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-17
Move Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-17
Program Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . F-18
Register Names and Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-18
Condition Code Mnemonics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-19
DSP56300 INFORMATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-20
Instruction Set Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-20
Arithmetic Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-21
Logical Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-22
Bit Manipulation Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . F-22
Loop Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-23
Move Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-23
Program Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . F-24
Register Names and Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-25
Condition Code Mnemonics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-26
DSP56800 INFORMATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-27
Instruction Set Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-27
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
ix
Table of Contents
F.6.1.1
F.6.1.2
F.6.1.3
F.6.1.4
F.6.1.5
F.6.1.6
F.6.2
F.6.3
F.6.4
Arithmetic Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .F-28
Logical Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .F-29
Bit Manipulation Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . .F-29
Loop Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .F-29
Move Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .F-30
Program Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . .F-30
Macro Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-31
Register Names and Usage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-32
Condition Code Mnemonics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-32
Appendix G
G.1
G.2
G.2.1
G.2.2
G.2.3
G.2.4
G.3
G.3.1
G.3.2
G.3.3
G.3.4
G.4
G.4.1
G.4.2
G.4.3
G.4.4
G.5
G.5.1
G.5.2
G.5.3
G.5.4
HOST-DEPENDENT INFORMATION
INTRODUCTION. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
DOS/386 ENVIRONMENT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Hardware Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Source File Text. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Invoking the Assembler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SUNOS ENVIRONMENT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Hardware Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Source File Text. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Invoking the Assembler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
HP 700 ENVIRONMENT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Hardware Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Source File Text. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Invoking the Assembler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MACINTOSH ENVIRONMENT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Hardware Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Source File Text. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Invoking the Assembler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
G-1
G-1
G-1
G-2
G-2
G-2
G-3
G-3
G-3
G-4
G-4
G-4
G-4
G-5
G-5
G-5
G-6
G-6
G-6
G-6
G-7
Index
x
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
List of Figures
LIST OF FIGURES
D-1
D-2
D-3
D-4
D-5
E-1
E-2
E-3
E-4
E-5
E-6
E-7
E-8
E-9
E-10
E-11
E-12
E-13
E-14
E-15
E-16
E-17
E-18
E-19
E-20
E-21
E-22
Assembler Listing Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-5
Assembler Cross-reference Listing Format . . . . . . . . . . . . . . . . . . . . . . . D-14
Assembler Listing Line Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-15
Memory Utilization Report Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-16
Memory Utilization Report Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-18
COFF File Basic Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-2
File Header Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-3
File Header Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-4
Motorola DSP Optional Link Header Format . . . . . . . . . . . . . . . . . . . . . . . E-5
Motorola DSP Optional Runtime Header Format . . . . . . . . . . . . . . . . . . . . E-6
Section Header Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-7
Section Header Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-9
Relocation Entry Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-10
Line Number Entry Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-10
Line Number Grouping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-11
COFF Symbol Table Ordering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-12
Symbol Table Entry Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-13
Fundamental Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-15
Derived Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-16
Storage Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-17
Storage Class and Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-19
Filename Symbol Auxiliary Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-21
Section Symbol Auxiliary Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-21
Relocatable Section Auxiliary Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-22
Relocatable Buffer/Overlay Auxiliary Entry . . . . . . . . . . . . . . . . . . . . . . . E-22
Tag Name Symbol Auxiliary Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-23
End of Structure Auxiliary Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-24
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
xi
List of Figures
E-23
E-24
E-25
E-26
E-27
E-28
E-29
E-30
xii
Function Symbol Auxiliary Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Array Symbol Auxiliary Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
End of Block or Function Auxiliary Entry . . . . . . . . . . . . . . . . . . . . . . . . .
Beginning of Block or Function Auxiliary Entry . . . . . . . . . . . . . . . . . . . .
Structure, Union, or Enumeration Name Auxiliary Entry . . . . . . . . . . . . .
CORE_ADDR Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Memory Mapping Enumerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Motorola DSP COFF Byte Ordering . . . . . . . . . . . . . . . . . . . . . . . . . . . .
DSP ASSEMBLER REFERENCE MANUAL
E-24
E-25
E-25
E-26
E-27
E-28
E-29
E-30
MOTOROLA
Chapter 1
MOTOROLA DSP ASSEMBLER
1.1
INTRODUCTION
The Motorola DSP Assemblers are programs that process assembly language source
statements written for Motorola’s family of digital signal processors. The Assembler translates these source statements into object programs compatible with other Motorola DSP
software and hardware products.
1.2
ASSEMBLY LANGUAGE
The assembly language provides mnemonic operation codes for all machine instructions
in the digital signal processor instruction set. In addition, the assembly language contains
mnemonic directives which specify auxiliary actions to be performed by the Assembler.
These directives are not always translated into machine language. The assembly language enables the programmer to define and use macro instructions which replace a single statement with a predefined sequence of statements found in the macro definition.
Conditional assembly also is supported.
1.3
INSTALLING THE ASSEMBLER
The Assembler is distributed on various media and in different formats depending on the
host environment. See Appendix G, Host-dependent Information, for details on installing
and operating the Assembler on your particular machine.
1.4
RUNNING THE ASSEMBLER
The general format of the command line to invoke the Assembler is:
DSPASM [options] <filenames>
where:
DSPASM
The name of the Motorola DSP Assembler program appropriate for the target processor (see Appendix F, Device-dependent Information). For exam-
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
1-1
Motorola DSP Assembler
Running The Assembler
ple, for the Motorola DSP56000 processor the name of the Assembler
executable is ASM56000.
[options]
Any of the following command line options. These can be in any order, but
must precede the list of source filenames. Some options can be given more
than once; the individual descriptions indicate which options may be specified multiple times. Option letters can be in either upper or lower case.
Command options that are used regularly may be placed in the environment
variable DSPASMOPT. If the variable is found in the environment the Assembler adds the associated text to the existing command line prior to processing any options. See your host documentation for instructions on how
to define environment variables.
Option arguments may immediately follow the option letter or may be separated from the option letter by blanks or tabs. However, an ambiguity arises
if an option takes an optional argument. Consider the following command
line:
ASM56000 -B MAIN IO
In this example it is not clear whether the file MAIN is a source file or is
meant to be an argument to the -B option. If the ambiguity is not resolved
the Assembler will assume that MAIN is a source file and attempt to open it
for reading. This may not be what the programmer intended.
There are several ways to avoid this ambiguity. If MAIN is supposed to be
an argument to the -B option it can be placed immediately after the option
letter:
ASM56000 -BMAIN IO
If there are other options on the command line besides those that take optional arguments the other options can be placed between the ambiguous
option and the list of source file names:
ASM56000 -B MAIN -V IO
An alternative is to use two successive hyphens to indicate the end of the
option list:
ASM56000 -B -- MAIN IO
In this latter case the Assembler interprets MAIN as a source file name and
uses the default naming conventions for the -B option.
1-2
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Motorola DSP Assembler
Assembler Options
1.5
ASSEMBLER OPTIONS
-A
Indicates that the Assembler should run in absolute mode, generating an
absolute object file when the -B command line option is given. By default the
Assembler produces a relocatable object file that is subsequently processed by the Motorola DSP linker. See Chapter 4, Software Project Management, for more information on Assembler modes.
-B[<objfil>]
This option specifies that an object file is to be created for Assembler output.
<objfil> can be any legal operating system filename, including an optional
pathname. A hyphen also may be used as an argument to indicate that the
object file should be sent to the standard output.
The type of object file produced depends on the Assembler operation mode.
If the -A option is supplied on the command line, the Assembler operates in
absolute mode and generates an absolute object (.CLD) file. If there is no
-A option on the command line, the Assembler operates in relative mode
and creates a relocatable object (.CLN) file.
If a pathname is not specified, the file will be created in the current directory.
If no filename is specified, the Assembler will use the basename (filename
without extension) of the first filename encountered in the source input file
list and append the appropriate file type (.CLN or .CLD) to the basename. If
the -B option is not specified, then the Assembler will not generate an object
file. The -B option should be specified only once. If the file named in the
-B option already exists, it will be overwritten.
Example: ASM56000 -Bfilter main.asm fft.asm fio.asm
In this example, the files MAIN.ASM, FFT.ASM, and FIO.ASM are
assembled together to produce the relocatable object file
FILTER.CLN.
-D<symbol> <string>
This is equivalent to a source statement of the form:
DEFINE <symbol> <string>
<string> must be preceded by a blank and should be enclosed in single
quotes if it contains any embedded blanks. Note that if single quotes are
used they must be passed to the Assembler intact, e.g. some host command interpreters will strip single quotes from around arguments. The
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
1-3
Motorola DSP Assembler
Assembler Options
-D<symbol> <string> sequence can be repeated as often as desired. See
the DEFINE directive (Chapter 6) for more information.
Example: ASM96000 -D POINTS 16 prog.asm
All occurrences of the symbol POINTS in the program PROG.ASM
will be replaced by the string ‘16’.
-EA <errfil>
-EW <errfil>
These options allow the standard error output file to be reassigned on hosts
that do not support error output redirection from the command line. <errfil>
must be present as an argument, but can be any legal operating system filename, including an optional pathname.
The -EA option causes the standard error stream to be written to <errfil>; if
<errfil> exists, the output stream is appended to the end of the file. The -EW
option also writes the standard error stream to <errfil>; if <errfil> exists it is
rewound (truncated to zero), and the output stream is written from the beginning of the file. Note that there must be white space separating either
option from the filename argument.
Example: ASM96000 -EWerrors prog.asm
Redirect the standard error output to the file ERRORS. If the file already exists, it will be overwritten.
-F<argfil>
Indicates that the Assembler should read command line input from <argfil>.
<argfil> can be any legal operating system filename, including an optional
pathname. <argfil> is a text file containing further options, arguments, and
filenames to be passed to the Assembler. The arguments in the file need be
separated only by some form of white space (blank, tab, newline). A semicolon (;) on a line following white space makes the rest of the line a comment.
The -F option was introduced to circumvent the problem of limited line
lengths in some host system command interpreters. It may be used as often
as desired, including within the argument file itself. Command options may
also be supplied using the DSPASMOPT environment variable. See the discussion of DSPASMOPT under [options] at the beginning of this section.
Example: ASM96000 -Fopts.cmd
Invoke the Assembler and take command line options and source
filenames from the command file OPTS.CMD.
1-4
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Motorola DSP Assembler
Assembler Options
-G
Send source file line number information to the object file. This option is valid only in conjunction with the -B command line option. The generated line
number information can be used by debuggers to provide source-level debugging.
Example: ASM56000 -B -G myprog.asm
Assemble the file MYPROG.ASM and send source file line number
information to the resulting object file MYPROG.CLN.
-I<pathname>
When the Assembler encounters INCLUDE files, the current directory (or
the directory specified in the INCLUDE directive) is first searched for the file.
If it is not found and the -I option is specified, the Assembler prefixes the filename (and optional pathname) specified in the INCLUDE directive with
<pathname> and searches the newly formed directory pathname for the file.
The pathname must be a legal operating system pathname. The -I option
may be repeated as many times as desired. The directories will be
searched in the order specified on the command line.
Example: ASM56000 -I\project\ testprog
This example uses IBM PC pathname conventions, and would cause
the Assembler to prefix any INCLUDE files not found in the current
directory with the \project\ pathname.
-L<lstfil>
This option specifies that a listing file is to be created for Assembler output.
<lstfil> can be any legal operating system filename, including an optional
pathname. A hyphen also may be used as an argument to indicate that the
listing file should be sent to the standard output, although the listing file is
routed to standard output by default.
If a pathname is not specified, the file will be created in the current directory.
If no filename is specified, the Assembler will use the basename (filename
without extension) of the first filename encountered in the source input file
list and append .LST to the basename. If the -L option is not specified, then
the Assembler will route listing output to the standard output (usually the
console or terminal screen) by default. The -L option should be specified
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
1-5
Motorola DSP Assembler
Assembler Options
only once. If the file named in the -L option already exists, it will be
overwritten.
Example: ASM96000 -L filter.asm gauss.asm
In this example, the files FILTER.ASM and GAUSS.ASM are assembled together to produce a listing file. Because no filename was given with the -L option, the output file will be named using the
basename of the first source file, in this case FILTER. The listing file
will be called FILTER.LST.
-M<pathname>
This is equivalent to a source statement of the form:
MACLIB
<pathname>
The pathname must be a legal operating system pathname. The -M option
may be repeated as many times as desired. The directories will be searched
in the order specified on the command line. See the MACLIB directive
(Chapter 6) for more information.
Example: ASM56000 -M fftlib/ trans.asm
This example uses UNIX pathname conventions, and would cause
the Assembler to look in the fftlib subdirectory of the current directory
for a file with the name of the currently invoked macro found in the
source file.
-O<opt>[,<opt>,...,<opt>]
This is equivalent to a source statement of the form:
OPT
<opt>[,<opt>,...,<opt>]
<opt> can be any of the options that are available with the OPT directive
(see Chapter 6). If multiple options are specified, they must be separated by
commas. The -O<opt> sequence can be repeated for as many options as
desired.
Example: ASM96000 -OS,CRE myprog.asm
This will activate the symbol table and cross reference listing options.
-P<proc>
Run the Assembler with the specified processor revision level enhancements. This is for backward compatibility so that the Assembler will flag new
constructions as illegal. <proc> can be any of the processor identifiers given
1-6
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Motorola DSP Assembler
Assembler Options
below. Note that if this option is not used the Assembler runs with all latest
revision level enhancements on by default.
Processor
Identifier
DSP56001 Rev. C
DSP56002
DSP56004
DSP56166
DSP96001 Rev. B
DSP96002
56001c
56002
56004
56166
96001b
96002
Example: ASM56000 -P56001c myprog.asm
Assemble MYPROG.ASM with the DSP56000 Revision C enhancements.
-Q
On some hosts the Assembler displays a banner on the console when invoked. This option inhibits the banner display. It has no effect on hosts
where the signon banner is not displayed by default.
Example: ASM56000 -Q myprog.asm
Assemble the file MYPROG.ASM but do not display the signon banner on the console.
-R<rev>
Run the Assembler without the specified processor revision level enhancements. This is for backward compatibility so that the Assembler will flag new
constructions as illegal. <rev> can be any of the revision specifiers given below, but must be appropriate for the target processor.
This option is superseded by the -P option.
Processor
Revision
DSP56001 Rev. C
DSP56002
DSP56004
DSP56166
DSP96000 Rev. B
DSP96001
C
2
4
6
B
1
Example: ASM56000 -RC myprog.asm
Assemble MYPROG.ASM without the DSP56000 Revision C enhancements.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
1-7
Motorola DSP Assembler
Assembler Options
-V
This option causes the Assembler to report assembly progress (beginning
of passes, opening and closing of input files) to the standard error output
stream. This is useful to insure that assembly is proceeding normally.
Example: ASM56000 -V myprog.asm
Assemble the file MYPROG.ASM and send progress lines to the
standard error output.
-Z
This option causes the Assembler to strip symbol information from the absolute load file. Normally symbol information is retained in the object file for
symbolic reference purposes. Note that this option is valid only when the
Assembler is in absolute mode via the -A command line option and when an
object file is created (-B option).
Example: ASM56000 -A -B -Z myprog.asm
Assemble the file MYPROG.ASM in absolute mode and strip symbol
information from the load file created as output.
<filenames>
A list of operating system compatible filenames (including optional pathnames). If no extension is supplied for a given file, the Assembler first will
attempt to open the file using the filename as supplied. If that is not successful the Assembler appends .ASM to the filename and attempts to open the
file again. If no pathname is specified for a given file, the Assembler will look
for that file in the current directory. The list of files will be processed sequentially in the order given and all files will be used to generate the object file
and listing.
The Assembler will redirect the output listing to the standard output if the output listing is
not suppressed with the IL option, or if it is not redirected via the -L command line option
described above. The standard output generally goes to the console or terminal screen
by default, but can be diverted to a file or to a printer by using the I/O redirection facilities
of the host operating system, if available. Error messages will always appear on the standard output, regardless of any option settings. Note that some options (-B, -L) allow a
hyphen as an optional argument which indicates that the corresponding output should be
sent to the standard output stream. Unpredictable results may occur if, for example, the
object file is explicitly routed to standard output while the listing file is allowed to default to
the same output stream.
For more details on Assembler operation in a particular machine environment see Appendix G, Host-dependent Information.
1-8
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Motorola DSP Assembler
Assembler Processing
1.6
ASSEMBLER PROCESSING
The Motorola DSP Assembler is a two-pass Assembler. During the first pass the source
program is read to build the symbol and macro tables. During the second pass the object
file is generated (assembled) with reference to the tables created during pass one. It is
also during the second pass that the source program listing is produced.
Each source statement is processed completely before the next source statement is read.
As each line is read in, any translations specified by the DEFINE directive are applied.
Each statement is then processed, and the Assembler examines the label, operation
code, operand, and data transfer fields. The macro definition table is scanned for a match
with the operation code. If there is no match, the operation code and directive tables are
scanned for a match with a known opcode.
Any errors detected by the Assembler are displayed before the actual line containing the
error is printed. Errors and warnings are accumulated, and a total number of errors and
warnings is printed at the end of the source listing. If no source listing is produced, error
messages are still displayed to indicate that the assembly process did not proceed normally. The number of errors is returned as an exit status when the Assembler returns control to the host operating system.
1.7
DEFINITION OF TERMS
Since the Motorola DSP architectures are different from normal microprocessors, the programmer may not be familiar with some of the terms used in this document. The following
discussion serves to clarify some of the concepts discussed later in this manual.
The Motorola DSP architecture can have as many as five separate memory spaces referred to as the X, Y, L, P (Program), and E (EMI - Extended Memory Interface) memory
spaces. L memory space is a concatenation of X and Y data memory and is considered
by the Assembler as a superset of the X and Y memory spaces. E memory is specific to
the DSP56004 processor, and provides for different data representations for various
memory hardware configurations. The Assembler will generate object code for each
memory space, but object code can only be generated for one memory space at a time.
The memory space and address location into which the object code generated by the Assembler will be loaded are referred to as the load memory space and load address, respectively. Because the DSP architecture allows data transfers between memory spaces,
sometimes object code is loaded into an address of one memory space but will later be
transferred to a different memory space and address before the program is run. One example of this might be a program located in an external EPROM that will be transferred
into external program RAM before it is run. The transfer of code/data from one memory
space/address to a different memory space/address is called an overlay.
When the object code for a part of the program is generated that later will be used as an
overlay, the load memory space and load address do not correspond to the memory
space and address where the program will be run. The memory space and address location where the code/data will be located when the program is run are referred to as the
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
1-9
Motorola DSP Assembler
Assembler Support For Digital Signal Processing
runtime memory space and runtime address, respectively. If the Assembler only used
the load address to assign values to labels, then the program would not contain the correct label references when it was transferred to the runtime memory space and the runtime address.
During the assembly process, the Assembler uses location counters to record the addresses associated with the object code. In order to facilitate the generation of object code
for overlays, the Assembler maintains two different location counters, the load location
counter, which determines the address into which the object code will be loaded and the
runtime location counter, which determines the address assigned to labels. In addition,
the Assembler keeps track of the load memory space, which is the memory space into
which the object code will be loaded, and the runtime memory space, which is the memory space to which an overlay will be transferred and the memory space attribute that will
be assigned to labels. See Chapter 4, Software Project Management, for a practical discussion of the use of memory spaces and location counters.
The Motorola digital signal processors are capable of performing operations on modulo
and reverse-carry buffers, two data structures useful in digital signal processing applications. The DSP Assembler provides directives for establishing buffer base addresses, allocating buffer space, and initializing buffer contents. For a buffer to be located properly
in memory the lower bits of the starting address which encompass one less than the buffer
size must be zero. For example, the lowest address greater than zero at which a buffer of
size 32 may be located is 32 (20 hexadecimal). More generally, the buffer base address
must be a multiple of 2k, where 2k is greater than or equal to the size of the buffer. Buffers
can be allocated manually or by using the Assembler buffer directives (see Chapter 6).
The Assembler operates in either absolute or relative mode, depending on the presence
of the command line -A option. In relative mode the Assembler creates relocatable object
files. These files can be combined and relocated using the Motorola DSP linker. In absolute mode the Assembler generates absolute object files. Absolute files cannot be relocated but can be loaded directly for execution. By default the Assembler runs in relative
mode.
1.8
ASSEMBLER SUPPORT FOR DIGITAL SIGNAL PROCESSING
As mentioned previously, the Assembler offers facilities commonly found in other macro
Assemblers, such as nested macro capabilities, include files, and conditional assembly.
The Assembler must also provide extensions in support of the unconventional architecture of the Motorola digital signal processors, as well as aids for programming DSP-specific applications. Some of these features are discussed briefly below; see the
appropriate chapters later in this manual for more information.
The Assembler supports the use of arbitrary algebraic expressions as arguments to various directives and as immediate operands in certain instructions. Terms of these expressions may consist of the Assembler’s own built-in functions, which perform data
conversion, comparison, and computational operations. In the digital signal processing
domain transcendental functions for computing sine, cosine, and natural logarithm are
1-10
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Motorola DSP Assembler
Assembler Support For Digital Signal Processing
useful for initializing data values in memory, such as sine/cosine tables for FFT algorithms. Also, there are functions for easily converting values expressed in decimal floating
point to their binary or fractional equivalents. This conversion is done automatically for immediate instruction operands and arguments to the DC directive (see Chapter 6). See
Chapter 3 for more information on Assembler expressions, operators, and built-in functions.
The register set of the Motorola digital signal processors allows for efficient use of modulo
and reverse-carry buffers for FFT applications. The Assembler supports this architecture
by providing several special-purpose directives for allocating circular buffers. The
BADDR, BUFFER, DSM, and DSR directives automatically advance the program counter
to the next appropriate base address given the buffer size, and perform various boundary
and magnitude checks to insure that the buffer is valid. The BSM and BSR provide for
automatic alignment and block initialization of DSP buffers. Since a buffer allocated in this
fashion can cause alignment gaps in memory, the MU option (see the OPT directive,
Chapter 6) may be used to generate a full memory utilization report. See Chapter 6 for
more information on Assembler directives and options.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
1-11
Chapter 2
WRITING ASSEMBLY LANGUAGE PROGRAMS
2.1
INPUT FILE FORMAT
Programs written in assembly language consist of a sequence of source statements. Any
source statement can be extended to one or more lines by including the line continuation
character (\) as the last character on the line to be continued. A source statement (first line
and any continuation lines) can be a maximum of 512 characters long. Upper and lower
case letters are considered equivalent for Assembler mnemonics and directives, but are
considered distinct for labels, symbols, directive arguments, and literal strings.
If the source file contains horizontal tabs (ASCII $09), the Assembler will expand these to
the next fixed tab stop located at eight character intervals (column 1, 9, 17...), unless reset
using the TAB directive (see Chapter 6). This is only significant if tab characters are embedded within literal strings.
For more information on source input file format, see Appendix G, Host-dependent Information.
2.2
SYMBOL NAMES
Symbol names can be from one to 512 characters long. The first character of a symbol
must be alphabetic (upper or lower case); any remaining characters can be either alphanumeric (A-Z, a-z, 0-9) or the underscore character (_). Upper and lower case letters in
symbols are considered distinct unless the IC option is in effect (see the OPT directive,
Chapter 6).
Valid:
loop_1
ENTRY
a_B_c
Invalid:
1_loop
loop.e
Certain identifiers are reserved by the Assembler and cannot be used. These identifiers
are the upper or lower case name of any Motorola DSP processor register. See Appendix
F for a list of the register names of the appropriate target processor.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
2-1
Writing Assembly Language Programs
Strings
2.3
STRINGS
One or more ASCII characters enclosed by single quotes (') constitute a literal ASCII
string. In order to specify an apostrophe within a literal string, two consecutive apostrophes must appear where the single apostrophe is intended. Strings are used as operands
for some Assembler directives and also can be used to a limited extent in expressions.
A string may also be enclosed in double quotes (") in which case any DEFINE directive
symbols contained in the string would be expanded. The double quote should be used
with care inside macros since it is used as a dummy argument string operator (see Chapter 5). In that case the macro concatenation operator can be used to escape the doublequoted string if desired.
Two strings separated by the string concatenation operator (++) will be recognized by the
Assembler as equivalent to the concatenation of the two strings. For example, these two
strings are equivalent:
'ABC'++'DEF' = 'ABCDEF'
The Assembler has a substring extraction capability using the square brackets ([ ]). Here
is an example:
['DSP56000',3,5] = '56000'
Substrings may be used wherever strings are valid and can be nested. There are also
functions for determining the length of a string and the position of one string within another. See Chapter 3 for more information on string functions.
2.4
SOURCE STATEMENT FORMAT
Each source statement may include up to six fields (eight for the DSP96000) separated
by one or more spaces or tabs: a label field, an operation field, an operand field, an additional opcode and operand field for the DSP96000, up to two data transfer fields, and a
comment field. Only fields preceding the comment field are considered significant to the
2-2
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Writing Assembly Language Programs
Source Statement Format
Assembler; the comment field is ignored. For example, the following source statement
shows all eight possible fields for the DSP96000:
ENT
FMPY D8,D6,D2 FADD.S D3,D0 X:(R0),D4.S D2.S,Y:(R5)+ ;TEXT
Comment
Y field
X field
Operand 2
Opcode 2
Operand
Opcode
Label
In general, the contents of each field other than the comment field cannot contain embedded whitespace characters, since these characters are used as field delimiters. Two exceptions are blanks and tabs in quoted strings and the syntax of structured control
statements (see Chapter 7).
2.4.1
Label Field
The label field occurs as the first field of a source statement, and can take one of the following forms:
1. A space or tab as the first character on a line ordinarily indicates that the label
field is empty, and that the line has no label.
2. An alphabetic character as the first character indicates that the line contains a
symbol called a label.
3. An underscore (_) as the first character indicates that the label is a local label.
Labels may be indented if the label symbol is immediately followed by a colon (:). If the
first non-blank field on a line complies with either forms 2 or 3 above and the field ends
with a colon, the Assembler regards this as the label field, even if it does not start with the
first character on the line. However, all characters preceding the label on the source line
must be whitespace characters (spaces or tab characters). There should be no intervening blanks or tabs between the end of the label symbol and the appended colon character.
Local labels are any normal symbol name preceded (with no intervening blanks) by an
underscore (_). Except for the special case of macros (described below), local labels
have a limited scope bounded by any two non-local labels. The local label can be referred
to or defined only in source statements that are between two source lines containing nonlocal labels. Local labels are useful in defining program locations where a unique label
name is required but is not considered useful in documenting the source file (for example,
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
2-3
Writing Assembly Language Programs
Source Statement Format
the terminating address of a DO loop). Note that the maximum length of a local label includes the leading underscore (_) character.
Use of local labels in macros represents a special case. All local labels within a macro are
considered distinct for the currently active level of macro expansion (unless the macro local label override operator is used; see Chapter 5). These local labels are valid for the entire macro expansion and are not considered bounded by non-local labels. Therefore, all
local labels within a macro must be unique. This mechanism allows the programmer to
freely use local labels within a macro definition without regard to the number of times that
the macro is expanded. Non-local labels within a macro expansion are considered to be
normal labels and therefore cannot occur more than once unless used with the SET directive (see Chapter 6).
A label may occur only once in the label field of an individual source file unless it is used
as a local label, a label local to a section, or is used with the SET directive. If a non-local
label does occur more than once in a label field, each reference to that label after the first
will be flagged as an error.
A line consisting of a label only is a valid line and has the effect of assigning the value of
the location counter to the label. With the exception of some directives, a label is assigned
the value of the location counter of the first word of the instruction or data being assembled.
2.4.2
Operation Field
The operation field appears after the label field, and must be preceded by at least one
space or tab. Entries in the operation field may be one of three types:
Opcode
-
Mnemonics that correspond directly to DSP machine instructions.
Directive
-
Special operation codes known to the Assembler which control
the assembly process.
Macro call
-
Invocation of a previously defined macro which is to be inserted
in place of the macro call.
The Assembler first searches for operation codes in an internal macro definition table. If
no match is found, the table of machine operation codes and Assembler directives is
searched. If neither of the tables holds the specified operation code, an error message is
generated (this sequence can be altered with the MACLIB directive). Macro names can
therefore replace standard machine operation codes and Assembler directives, although
a warning will be issued if such a replacement occurs. The warning can be avoided by use
of the RDIRECT directive. See Chapter 6 for more information on the MACLIB and RDIRECT directives.
2-4
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Writing Assembly Language Programs
Source Statement Format
2.4.3
Operand Field
The interpretation of the operand field is dependent on the contents of the operation field.
The operand field, if present, must follow the operation field, and must be preceded by at
least one space or tab. The operand field may contain a symbol, an expression, or a combination of symbols and expressions separated by commas. There should be no intervening whitespace characters separating operand elements.
The operand field of machine instructions is used to specify the addressing mode of the
instruction, as well as the operand of the instruction. The format of the operand field for a
particular instruction is given in Appendix A of the User Manual for the DSP in question
(.e.g. DSP56000/DSP56001 User’s Manual). The operand fields of Assembler directives
are described in Chapter 6. The operand fields of macros (Chapter 5) depend on the definition of the macro.
2.4.4
Operation 2 Field
DSP96000 only. The second operation field occurs after the first operand field, and only
in conjunction with an FMPY instruction. The field must be preceded by at least one space
or tab. The second operation field may consist only of the instructions FADD, FSUB, and
FADDSUB.
2.4.5
Operand 2 Field
DSP96000 only. The interpretation of the second operand field is dependent on the contents of the second operation field. The second operand field, if present, must follow the
second operation field, and must be preceded by at least one space or tab. The operand
field may contain only those register combinations appropriate to the second operation
field.
The operand field of machine instructions is used to specify the addressing mode of the
instruction, as well as the operand of the instruction. The format of the operand field for
each DSP96000 instruction is described in Appendix A of the DSP96002 User’s Manual.
2.4.6
Data Transfer Fields
Most opcodes can specify one or more data transfers to occur during the execution of the
instruction. These data transfers are indicated by two addressing mode operands separated by a comma, with no embedded blanks. If two data transfers are specified, they
must be separated by one or more blanks or tabs. See the appropriate DSP User’s Manual for a complete discussion of addressing modes that are applicable to data transfer
specifications.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
2-5
Writing Assembly Language Programs
Assembler Output
2.4.7
Comment Field
Comments are not considered significant to the Assembler, but can be included in the
source file for documentation purposes. A comment field is composed of any characters
(not part of a literal string) that are preceded by a semicolon (;). A comment starting in the
first column of the source file will be aligned with the label field in the listing file. Otherwise,
the comment will be shifted right and aligned with the comment field in the listing file, unless the NOPP option is used (see the OPT directive, Chapter 6). Comments preceded
by two consecutive semicolons (;;) will not be reproduced on the Assembler listing and
will not be saved as part of a macro definition.
2.5
ASSEMBLER OUTPUT
The Assembler output consists of an optional listing of the source program and an optional
object file. Appendix D contains the description of the source listing format and Appendix
E contains the description of the object file format.
The assembly source program listing contains the original source statements, formatted
for easier reading, as well as additional information which is generated by the Assembler.
Most lines in the listing correspond directly to a source statement. Lines which do not correspond directly to source statements include page headings, error messages, and expansions of macro calls or directives such as DC (Define Constant; see Chapter 6).
The assembly listing optionally may contain a symbol table or a cross-reference table of
all non-local symbols appearing in the program. These are always printed after the end of
source input or the END directive (whichever occurs first) if either the symbol table or
cross-reference table options are in effect (see the OPT directive, Chapter 6). The symbol
table contains the name of each symbol, along with its defined value. The cross-reference
table additionally contains the Assembler-maintained source line number of every reference to every non-local symbol (local symbols may be included in the cross-reference listing by using the LOC option; see the OPT directive, Chapter 6). The format of the crossreference table is shown in Appendix D.
If the MU option is enabled (see the OPT directive, Chapter 6), the Assembler generates
a report of load and runtime memory utilization. The report shows beginning and ending
addresses of allocated memory areas, along with their lengths and associated symbol
names, if applicable. A separate report is generated for each memory space where data
has been reserved for use by the program. The format of the report is given in Appendix D.
The Assembler object file is a binary COFF (Common Object File Format) file, with extensions and adaptations to support symbolic debugging and to make DSP object files transportable among host platforms. COFF is a formal definition for the structure of machine
code files. It is derived from AT&T UNIX System V and represents a quasi-de facto standard for object file formats. Refer to Appendix E for more information on Motorola DSP
COFF structure and layout.
2-6
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Chapter 3
EXPRESSIONS
3.1
INTRODUCTION
An expression represents a value which is used as an operand in an Assembler instruction or directive. An expression is a combination of symbols, constants, operators, and
parentheses. Expressions may contain user-defined labels and their associated integer
or floating point values, and/or any combination of integers, floating point numbers, or
ASCII literal strings. In general, white space (a blank or tab) is not allowed between the
terms and operators of an Assembler expression. Expressions otherwise follow the conventional rules of algebra and boolean arithmetic.
3.2
ABSOLUTE AND RELATIVE EXPRESSIONS
An expression may be either relative or absolute. An absolute expression is one which
consists only of absolute terms, or is the result of two relative terms with opposing signs.
A relative expression consists of a relative term by itself or only in combination with absolute terms.
When the Assembler is operating in relative mode all address expressions must adhere
to the above definitions for absolute or relative expressions. This is because only these
types of expressions will retain a meaningful value after program relocation. For example,
when relative terms are paired with opposing signs, the result is the difference between
the two relative terms, which is an absolute value. However, if two positive relative terms
are added together the result is unpredictable based on the computed values of the terms
at relocation time.
3.3
EXPRESSION MEMORY SPACE ATTRIBUTE
A symbol is associated with either an integer or a floating point value which is used in
place of the symbol during the expression evaluation. Each symbol also carries a memory
space attribute of either X, Y, L, Program, EMI, or None. Constants and floating point expressions always have a memory space attribute of None. The result of an expression will
always have a memory space attribute associated with it. The unary logical negate operator, relational operators, and some functions return values that have a memory space attribute of N. The result of an expression that has only one operand (and possibly the unary
negate or unary minus operator) always has the memory attribute of that operand. Ex-
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
3-1
Expressions
Expression Memory Space Attribute
pressions that involve two or more operands and operators other than those mentioned
above derive the memory space attribute of the result by examining the operands on the
left and right side of an operator as shown in the following chart:
Left Operand Memory Space Attribute
Right Operand
Memory Space
Attribute
X
Y
L
P
EN
X
X
*
X
*
*X
Y
*
Y
Y
*
*Y
L
X
Y
L
*
*L
P
*
*
*
P
*P
E
*
*
*
*
EE
N
X
Y
L
P
EN
* = Represents an illegal operation that will result in an error.
Notice that L memory space is regarded as a union of both X and Y space. In expressions
that have one element that has a memory space attribute of L and another element with
a memory space attribute of either X or Y, the result will have the more restrictive memory
space attribute (X or Y).
The memory space attribute is regarded by the Assembler as a type, in the same sense
that high level languages use type for variables. Symbols that are assigned memory
space attributes of X, Y, L, P, or E are assumed to be addresses and therefore can only
have values between zero and the maximum address of the target processor. Only symbols that have a memory space attribute of N can have values greater than the maximum
address of the target machine.
Memory space attributes become important when an expression is used as an address.
Errors will occur when the memory space attribute of the expression result does not match
the explicit or implicit memory space specified in the source code. Memory spaces are
explicit when the address has any of the following forms:
X:<address expression>
Y:<address expression>
L:<address expression>
P:<address expression>
E:<address expression>
The memory space is implicitly P when an address is used as the operand of a DO,
branch, or jump-type instruction.
3-2
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Expressions
Internal Expression Representation
Expressions used for immediate addressing can have any memory space attribute.
3.4
INTERNAL EXPRESSION REPRESENTATION
Expression value representation internal to the Assembler is dependent on the word size
of the target processor. The Assembler supports a word and a double word integer format
internally. The actual storage size of an expression value is dependent upon the magnitude of the result, but the Assembler is capable of representing signed integers up to 64
bits in length. These longer integer representations are useful when performing data initialization in L memory space.
Internal floating point representation is almost entirely dependent upon the host environment, but in general floating point values are stored in double precision format. This
means that there are ordinarily 64 bits of storage allotted for a floating point number by
the Assembler, with 11 bits of exponent, 53 bits of mantissa, and an implied binary point.
3.5
CONSTANTS
Constants represent quantities of data that do not vary in value during the execution of a
program.
3.5.1
Numeric Constants
Numeric constants can be in one of three bases:
Binary
Example:
Binary constants consist of a percent sign (%) followed by a string
of binary digits (0,1).
%11010
Hexadecimal
Example:
Hexadecimal constants consist of a dollar sign ($) followed by a
string of hexadecimal digits (0-9, A-F, a-f).
$12FF, $12ff
Decimal
Decimal constants can be either floating point or integer. Integer
decimal constants consist of a string of decimal (0-9) digits optionally preceded by a grave accent (`). Floating point constants
are indicated either by a preceding, following, or included decimal
point or by the presence of an upper or lower case ‘E’ followed by
the exponent.
Example:
12345
6E10
MOTOROLA
(integer)
(floating point)
DSP ASSEMBLER REFERENCE MANUAL
3-3
Expressions
Operators
.6
2.7e2
(floating point)
(floating point)
A constant may be written without a leading radix indicator if the input radix is changed
using the RADIX directive. For example, a hexadecimal constant may be written without
the leading dollar sign ($) if the input radix is set to16 (assuming an initial radix of 10). The
default radix is10. See Chapter 6 on the RADIX directive for more information.
3.5.2
String Constants
String constants that are used in expressions are converted to a concatenated sequence
of ASCII bytes (right aligned), as shown below. Strings used in expressions are limited to
the long word size of the target processor; subsequent characters in the string are ignored. Null strings (strings that have no characters) have a value of 0.
String constants greater than the maximum number of characters can be used in expressions, but the Assembler will truncate the value and will use only those characters that will
fit in a DSP long word. In this case, a warning will be printed. This restriction also applies
to string constants using the string concatenation operator. Handling of string constants
by the DC and DCB directives is an exception to this rule; see Chapter 6 for a description.
Examples:
'ABCD'
'''79'
'A'
''
'abcdef'
'abc'++'de'
3.6
($41424344)
($00273739)
($00000041)
($00000000) - null string
($61626364)
($61626364)
OPERATORS
Some of the Assembler operators can be used with both floating point and integer values.
If one of the operands of the operator has a floating point value and the other has an integer value, the integer will be converted to a floating point value before the operator is
applied and the result will be floating point. If both operands of the operator are integers,
the result will be an integer value. Similarly, if both the operands are floating point, the
result will be a floating point value.
3.6.1
Unary operators
plus
minus
one’s complement
logical negate
3-4
(+)
(-)
(~)
(!)
- Integer only
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Expressions
Operators
The unary plus operator returns the value of its operand.
The unary minus operator returns the negative of its operand.
The one’s complement operator returns the one’s complement of its operand. It cannot
be used with a floating point operand.
The unary logical negation operator returns an integer 1 (memory space attribute None)
if the value of its operand is 0 and will return a 0 otherwise. For example, if the symbol
BUF had a value of 0, then !BUF would have a value of 1. If BUF had a value of 1000,
!BUF would have a value of 0.
3.6.2
Arithmetic operators
addition
subtraction
multiplication
division
mod
(+)
(-)
(*)
(/)
(%)
The addition operator yields the sum of its operands.
The subtraction operator yields the difference of its operands.
The multiplication operator yields the product of its operands.
The divide operator yields the quotient of the division of the first operand by the second.
For integer operands the divide operation will produce a truncated integer result.
The mod operator applied to integers will yield the remainder from the division of the first
operand by the second. If the mod operator is used with floating point operands, the mod
operator will apply the following rules:
Y%Z=Y
=X
if Z = 0
if Z <> 0
where X has the same sign as Y, is less than Z, and satisfies the relationship:
Y=i*Z+X
where i is an integer.
3.6.3
Shift operators
shift left
shift right
MOTOROLA
(<<)
(>>)
- Integer only
- Integer only
DSP ASSEMBLER REFERENCE MANUAL
3-5
Expressions
Operators
The shift left operator causes the left operand to be shifted to the left (and zero-filled) by
the number of bits specified by the right operand.
The shift right operator causes the left operand to be shifted to the right by the number of
bits specified by the right operand. The sign bit will be extended.
Shift operators cannot be applied to floating point operands.
3.6.4
Relational operators
less than
less than or equal
greater than
greater than or equal
equal
not equal
(<)
(<=)
(>)
(>=)
(==)
(!=)
Relational operators all work the same way. If the indicated condition is true, the result of
the expression is an integer 1. If it is false, the result of the expression is an integer 0. In
either case, the memory space attribute of the result is None.
For example, if D has a value of 3 and E has a value of 5, then the result of the expression
D<E is 1, and the result of the expression D>E is 0. Each operand of the conditional operators can be either floating point or integer. Test for equality involving floating point values should be used with caution, since rounding error could cause unexpected results.
Relational operators are primarily intended for use with the conditional assembly IF directive, but can be used in any expression.
3.6.5
Bitwise operators
AND
OR
exclusive OR
(&)
(|)
(^)
- Integer only
- Integer only
- Integer only
The bitwise AND operator yields the bitwise AND function of its operands.
The bitwise OR operator yields the bitwise OR function of its operands.
The bitwise exclusive OR operator yields the bitwise exclusive OR function of its operands.
Bitwise operators cannot be applied to floating point operands.
3-6
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Expressions
Operator Precedence
3.6.6
Logical operators
Logical AND
Logical OR
(&&)
(||)
The logical AND operator returns an integer 1 if both of its operands are nonzero; otherwise, it returns an integer 0.
The logical OR operator returns an integer 1 if either of its operands is nonzero; otherwise
it returns an integer 0.
The types of the operands may be either integer or floating point; the memory space attribute of the result is None. Logical operators are primarily intended for use with the conditional assembly IF directive, but can be used in any expression.
3.7
OPERATOR PRECEDENCE
Expressions are evaluated with the following operator precedence:
1.
2.
3.
4.
5.
6.
7.
8.
9.
parenthetical expression (innermost first)
unary plus, unary minus, one’s complement, logical negation
multiplication, division, mod
addition, subtraction
shift
relational operators: less, less or equal, greater, greater or equal
relational operators: equal, not equal
bitwise AND, OR, EOR
logical AND, OR
Operators of the same precedence are evaluated left to right. Valid operands include numeric constants, literal ASCII strings, and symbols. The one’s complement, shift, and bitwise operators cannot be applied to floating point operands. That is, if the evaluation of
an expression (after operator precedence has been applied) results in a floating point
number on either side of any of these operators, an error will be generated.
3.8
FUNCTIONS
The Assembler has several built-in functions to support data conversion, string comparison, and transcendental math computations. Functions may be used as terms in any arbitrary expression. Functions may have zero or more arguments, but must always be
followed by open and closed parentheses. Function arguments which are expressions
must be absolute expressions except where noted. Arguments containing external references are not allowed. There must be no intervening spaces between the function name
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
3-7
Expressions
Functions
and the opening parenthesis, and there must be no spaces between comma-separated
arguments.
Assembler functions can be grouped into five types:
1.
2.
3.
4.
5.
3.8.1
Mathematical functions
Conversion functions
String functions
Macro functions
Assembler mode functions
Mathematical Functions
The mathematical functions comprise transcendental, random value, and min/max functions, among others:
ABS
ACS
ASN
AT2
ATN
CEL
COH
COS
FLR
L10
LOG
MAX
MIN
POW
RND
SGN
SIN
SNH
SQT
TAN
TNH
XPN
3-8
- Absolute value
- Arc cosine
- Arc sine
- Arc tangent
- Arc tangent
- Ceiling function
- Hyperbolic cosine
- Cosine
- Floor function
- Log base 10
- Natural logarithm
- Maximum value
- Minimum value
- Raise to a power
- Random value
- Return sign
- Sine
- Hyperbolic sine
- Square root
- Tangent
- Hyperbolic tangent
- Exponential function
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Expressions
Functions
3.8.2
Conversion Functions
The conversion functions provide conversion between integer, floating point, and fixed
point fractional values:
CVF
CVI
CVS
FLD
FRC
LFR
LNG
LUN
RVB
UNF
3.8.3
- Convert integer to floating point
- Convert floating point to integer
- Convert memory space
- Shift and mask operation
- Convert floating point to fractional
- Convert floating point to long fractional
- Concatenate to double word
- Convert long fractional to floating point
- Reverse bits in field
- Convert fractional to floating point
String Functions
String functions compare strings, return the length of a string, and return the position of a
substring within a string:
LEN
POS
SCP
3.8.4
- Length of string
- Position of substring in string
- Compare strings
Macro Functions
Macro functions return information about macros:
ARG
CNT
MAC
MXP
MOTOROLA
- Macro argument function
- Macro argument count
- Macro definition function
- Macro expansion function
DSP ASSEMBLER REFERENCE MANUAL
3-9
Expressions
Functions
3.8.5
Assembler Mode Functions
Miscellaneous functions having to do with Assembler operation:
CCC
CHK
CTR
DEF
EXP
INT
LCV
LST
MSP
REL
- Cumulative cycle count
- Current instruction/data checksum
- Location counter type
- Symbol definition function
- Expression check
- Integer check
- Location counter value
- LIST directive flag value
- Memory space
- Relative mode function
Individual descriptions of each of the Assembler functions follow. They include usage
guidelines, functional descriptions, and examples.
@ABS(<expression>)
Returns the absolute value of <expression> as a floating point value. The memory
space attribute of the result will be None.
Example:
MOVE
#@ABS(VAL),D4.S
; load absolute value
@ACS(<expression>)
Returns the arc cosine of <expression> as a floating point value in the range zero
to pi. The result of <expression> must be between -1 and 1. The memory space
attribute of the result will be None.
Example:
ACOS
=
@ACS(-1.0)
; ACOS = 3.141593
@ARG(<symbol> | <expression>)
Returns integer 1 if the macro argument represented by <symbol> or <expression>
is present, 0 otherwise. If the argument is a symbol it must be single-quoted and
refer to a dummy argument name. If the argument is an expression it refers to the
ordinal position of the argument in the macro dummy argument list. A warning will
be issued if this function is used when no macro expansion is active. The memory
space attribute of the result will be None.
Example:
IF
3-10
@ARG(TWIDDLE)
; twiddle factor provided?
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Expressions
Functions
@ASN(<expression>)
Returns the arc sine of <expression> as a floating point value in the range -pi/2 to
pi/2. The result of <expression> must be between -1 and 1. The memory space
attribute of the result will be None.
Example:
ARCSINE SET
@ASN(-1.0)
; ARCSINE = -1.570796
@AT2(<expr1,expr2>)
Returns the arc tangent of <expr1>/<expr2> as a floating point value in the range
-pi to pi. Expr1 and expr2 must be separated by a comma. The memory space
attribute of the result will be None.
Example:
ATAN
EQU
@AT2(-1.0,1.0)
; ATAN = -0.7853982
@ATN(<expression>)
Returns the arc tangent of <expression> as a floating point value in the range -pi/
2 to pi/2. The memory space attribute of the result will be None.
Example:
MOVE
#@ATN(1.0),D0.S
; load arc tangent
@CCC()
Returns the cumulative cycle count as an integer. Useful in conjunction with the
CC, NOCC, and CONTCC Assembler options (see the OPT directive). The memory space attribute of the result will be None.
Example:
IF
@CCC() > 200
; cycle count > 200?
@CEL(<expression>)
Returns a floating point value which represents the smallest integer greater than or
equal to <expression>. The memory space attribute of the result will be None.
Example:
CEIL
MOTOROLA
SET
@CEL(-1.05)
; CEIL = -1.0
DSP ASSEMBLER REFERENCE MANUAL
3-11
Expressions
Functions
@CHK()
Returns the current instruction/data checksum value as an integer. Useful in conjunction with the CK, NOCK, and CONTCK Assembler options (see the OPT directive). Note that assignment of the checksum value with directives other than SET
could cause phasing errors due to different generated instruction values between
passes. The memory space attribute of the result will be None.
Example:
CHKSUM SET
@CHK()
; reserve checksum value
@CNT()
Returns the count of the current macro expansion arguments as an integer. A
warning will be issued if this function is used when no macro expansion is active.
The memory space attribute of the result will be None.
Example:
ARGCNT
SET
@CNT()
; squirrel away arg count
@COH(<expression>)
Returns the hyperbolic cosine of <expression> as a floating point value. The memory space attribute of the result will be None.
Example:
HYCOS
EQU
@COH(VAL)
; compute hyperbolic cosine
@COS(<expression>)
Returns the cosine of <expression> as a floating point value. The memory space
attribute of the result will be None.
Example:
DC
-@COS(@CVF(COUNT)*FREQ) ; compute cosine value
@CTR({L | R})
If L is specified as the argument, returns the counter number of the load location
counter. If R is specified, returns the counter number of the runtime location
counter. The counter number is returned as an integer value with memory space
of None.
Example:
CNUM
3-12
=
@CTR(R)
; runtime counter number
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Expressions
Functions
@CVF(<expression>)
Converts the result of <expression> to a floating point value. The memory space
attribute of the result will be None.
Example:
FLOAT
SET
@CVF(5)
; FLOAT = 5.0
@CVI(<expression>)
Converts the result of <expression> to an integer value. This function should be
used with caution since the conversions can be inexact (e.g., floating point values
are truncated). The memory space attribute of the result will be None.
Example:
INT
SET
@CVI(-1.05)
; INT = -1
@CVS({X | Y | L | P | E | N},<expression>)
Converts the memory space attribute of <expression> to that specified by the first
argument; returns <expression>. See section 3.3 for more information on memory
space attributes. The <expression> may be relative or absolute.
Example:
LOADDR
EQU
@CVS(X,TARGET)
; set LOADDR to X:TARGET
@DEF(<symbol>)
Returns an integer 1 (memory space attribute N) if <symbol> has been defined, 0
otherwise. <symbol> may be any label not associated with a MACRO or SECTION
directive. If <symbol> is quoted it is looked up as a DEFINE symbol; if it is not quoted it is looked up as an ordinary label.
Example:
IF
@DEF(ANGLE)
; assemble if ANGLE defined
@EXP(<expression>)
Returns an integer 1 (memory space attribute N) if the evaluation of <expression>
would not result in errors. Returns 0 if the evaluation of <expression> would cause
an error. No error will be output by the Assembler if <expression> contains an error. No test is made by the Assembler for warnings. The <expression> may be
relative or absolute.
Example:
IF
MOTOROLA
!@EXP(@FRC(VAL))
; skip on error
DSP ASSEMBLER REFERENCE MANUAL
3-13
Expressions
Functions
@FLD(<base>,<value>,<width>[,<start>])
Shift and mask <value> into <base> for <width> bits beginning at bit <start>. If
<start> is omitted, zero (least significant bit) is assumed. All arguments must be
positive integers and none may be greater than the target word size. Returns the
shifted and masked value with a memory space attribute of None.
Example:
SWITCH
EQU
@FLD(TOG,1,1,7)
; turn eighth bit on
@FLR(<expression>)
Returns a floating point value which represents the largest integer less than or
equal to <expression>. The memory space attribute of the result will be None.
Example:
FLOOR
SET
@FLR(2.5)
; FLOOR = 2.0
@FRC(<expression>)
For binary fractional DSPs (DSP56000) this functions performs scaling and convergent rounding to obtain the fractional representation of the floating point <expression> as an integer. For floating point DSPs (DSP96000) this function simply
returns the binary representation of <expression> as an integer. The memory
space attribute of the result will be None.
Example:
FRAC
EQU
@FRC(FLT)+1
; compute saturation
@INT(<expression>)
Returns an integer 1 (memory space attribute N) if <expression> has an integer result, 0 otherwise. The <expression> may be relative or absolute.
Example:
IF
@INT(TERM)
; insure integer value
@L10(<expression>)
Returns the base 10 logarithm of <expression> as a floating point value. <expression> must be greater than zero. The memory space attribute of the result will be
None.
Example:
LOG
3-14
EQU
@L10(100.0)
; LOG = 2
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Expressions
Functions
@LCV({L | R}[,{L | H | <expression>}])
If L is specified as the first argument, returns the memory space attribute and value
of the load location counter. If R is specified, returns the memory space attribute
and value of the runtime location counter. The optional second argument indicates
the Low, High, or numbered counter and must be separated from the first argument
by a comma. If no second argument is present the default counter (counter 0) is
assumed.
The @LCV function will not work correctly if used to specify the runtime counter
value of a relocatable overlay. This is because the resulting value is an overlay expression, and overlay expressions may not be used to set the runtime counter for
a subsequent overlay. See the ORG directive (Chapter 6) for more information.
Also, @LCV(L,...) will not work inside a relocatable overlay. In order to obtain the
load counter value for an overlay block, origin to the load space and counter immediately before the overlay and use @LCV(L) to get the beginning load counter value for the overlay.
Example:
ADDR
=
@LCV(R)
; save runtime address
@LEN(<string>)
Returns the length of <string> as an integer. The memory space attribute of the
result will be None.
Example:
SLEN
SET
@LEN('string')
; SLEN = 6
@LFR(<expression>)
For binary fractional DSPs (DSP56000) this functions performs scaling and convergent rounding to obtain the fractional representation of the floating point <expression> as a long integer. For floating point DSPs (DSP96000) this function
simply returns the binary representation of <expression> as a long integer. The
memory space attribute of the result will be None.
Example:
LFRAC
MOTOROLA
EQU
@LFR(LFLT)
; store binary form
DSP ASSEMBLER REFERENCE MANUAL
3-15
Expressions
Functions
@LNG(<expr1>,<expr2>)
Concatenates the single word <expr1> and <expr2> into a double word value such
that <expr1> is the high word and <expr2> is the low word. The memory space
attribute of the result will be None.
Example:
LWORD
DC
@LNG(HI,LO)
; build long word
@LOG(<expression>)
Returns the natural logarithm of <expression> as a floating point value. <expression> must be greater than zero. The memory space attribute of the result will be
None.
Example:
LOG
EQU
@LOG(100.0)
; LOG = 4.605170
@LST()
Returns the value of the LIST directive flag as an integer, with a memory space attribute of None. Whenever a LIST directive is encountered in the Assembler
source, the flag is incremented; when a NOLIST directive is encountered, the flag
is decremented.
Example:
DUP
@CVI(@ABS(@LST()))
; list unconditionally
@LUN(<expression>)
Converts the double-word <expression> to a floating point value. For fractional
DSPs (DSP56000) <expression> should represent a binary fraction. For floating
point DSPs (DSP96000) <expression> should represent a binary floating point
number. The memory space attribute of the result will be None.
Example:
DBLFRC
EQU
@LUN($3FE0000000000000)
;DBLFRC = 0.5
@MAC(<symbol>)
Returns an integer 1 (memory space attribute N) if <symbol> has been defined as
a macro name, 0 otherwise.
Example:
IF
3-16
@MAC(DOMUL)
; expand macro
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Expressions
Functions
@MAX(<expr1>[,...,<exprN>])
Returns the greatest of <expr1>,...,<exprN> as a floating point value. The memory
space attribute of the result will be None.
Example:
MAX
DC
@MAX(1.0,5.5,-3.25)
; MAX = 5.5
@MIN(<expr1>[,...,<exprN>])
Returns the least of <expr1>,...,<exprN> as a floating point value. The memory
space attribute of the result will be None.
Example:
MIN
DC
@MIN(1.0,5.5,-3.25)
; MIN = -3.25
@MSP(<expression>)
Returns the memory space attribute of <expression> as an integer value:
None
X space
Y space
L space
P space
E space
=0
=1
=2
=3
=4
=5
The <expression> may be relative or absolute.
Example:
MEM
SET
@MSP(ORIGIN)
; save memory space
@MXP()
Returns an integer 1 (memory space attribute N) if the Assembler is expanding a
macro, 0 otherwise.
Example:
IF
@MXP()
; macro expansion active?
@POS(<str1>,<str2>[,<start>])
Returns the position of string <str2> in <str1> as an integer, starting at position
<start>. If <start> is not given the search begins at the beginning of <str1>. If the
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
3-17
Expressions
Functions
<start> argument is specified it must be a positive integer and cannot exceed the
length of the source string. The memory space attribute of the result will be None.
Example:
ID
EQU
@POS('DSP96000','96')
; ID = 3
@POW(<expr1>,<expr2>)
Returns <expr1> raised to the power <expr2> as a floating point value. <expr1>
and <expr2> must be separated by a comma. The memory space attribute of the
result will be None.
Example:
BUF
EQU
@CVI(@POW(2.0,3.0))
; BUF = 8
@REL()
Returns an integer 1 (memory space attribute N) if the Assembler is operating in
relative mode, 0 otherwise.
Example:
IF
@REL()
; in relative mode?
@RND()
Returns a random value in the range 0.0 to 1.0. The memory space attribute of the
result will be None.
Example:
SEED
DC
@RND()
; save initial seed value
@RVB(<expr1>[,<expr2>])
Reverse the bits in <expr1> delimited by the number of bits in <expr2>. If <expr2>
is omitted the field is bounded by the target word size. Both expressions must be
single word integer values.
Example:
REV
3-18
EQU
@RVB(VAL)
; reverse all bits in value
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Expressions
Functions
@SCP(<str1>,<str2>)
Returns an integer 1 (memory space attribute N) if the two strings compare, 0 otherwise. The two strings must be separated by a comma.
Example:
IF
@SCP(STR,'MAIN')
; does STR equal MAIN?
@SGN(<expression>)
Returns the sign of <expression> as an integer: -1 if the argument is negative, 0 if
zero, 1 if positive. The memory space attribute of the result will be None. The <expression> may be relative or absolute.
Example:
IF
@SGN(INPUT)
; is sign positive?
@SIN(<expression>)
Returns the sine of <expression> as a floating point value. The memory space attribute of the result will be None.
Example:
DC
@SIN(@CVF(COUNT)*FREQ)
; compute sine value
@SNH(<expression>)
Returns the hyperbolic sine of <expression> as a floating point value. The memory
space attribute of the result will be None.
Example:
HSINE
EQU
@SNH(VAL)
; hyperbolic sine
@SQT(<expression>)
Returns the square root of <expression> as a floating point value. <expression>
must be positive. The memory space attribute of the result will be None.
Example:
SQRT
MOTOROLA
EQU
@SQT(3.5)
; SQRT = 1.870829
DSP ASSEMBLER REFERENCE MANUAL
3-19
Expressions
Functions
@TAN(<expression>)
Returns the tangent of <expression> as a floating point value. The memory space
attribute of the result will be None.
Example:
MOVE
#@TAN(1.0),D1.S
; load tangent
@TNH(<expression>)
Returns the hyperbolic tangent of <expression> as a floating point value. The
memory space attribute of the result will be None.
Example:
HTAN
=
@TNH(VAL)
; hyperbolic tangent
@UNF(<expression>)
Converts <expression> to a floating point value. For fractional DSPs (DSP56000)
<expression> should represent a binary fraction. For floating point DSPs
(DSP96000) <expression> should represent a binary floating point number. The
memory space attribute of the result will be None.
Example:
FRC
EQU
@UNF($400000)
; FRC = 0.5
@XPN(<expression>)
Returns the exponential function (base e raised to the power of <expression>) as
a floating point value. The memory space attribute of the result will be None.
Example:
EXP
3-20
EQU
@XPN(1.0)
; EXP = 2.718282
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Chapter 4
SOFTWARE PROJECT MANAGEMENT
4.1
INTRODUCTION
The Motorola DSP Assemblers provide several directives designed to assist in the development of large software projects. Complex software projects often are divided into smaller program units. These subprograms may be written by a team of programmers in
parallel, or they may be programs written for a previous development effort that are going
to be reused. The Assembler provides directives to encapsulate program units and permit
the free use of symbol names within subprograms without regard to symbol names used
in other programs. These encapsulated program units are called sections. Sections are
also the basis for relocating blocks of code and data, so that concerns about memory
placement are postponed until after the assembly process.
4.2
SECTIONS
A section is bounded by a SECTION directive and an ENDSEC directive. For example:
SECTION <section name> [GLOBAL | STATIC | LOCAL]
.
.
Section source statements
.
.
ENDSEC
All symbols that are defined within a section have the <section name> associated with
them. This serves to protect them from like-named symbols elsewhere in the program. By
default, a symbol defined inside any given section is private to that section unless the
GLOBAL or LOCAL qualifiers accompany the SECTION directive. More information on
the GLOBAL and LOCAL qualifiers can be found in Sections And Data Hiding, below.
Any code or data inside a section is considered an indivisible block with respect to relocation. Code or data associated with a section is independently relocatable within the
memory space to which it is bound, unless the STATIC qualifier follows the SECTION directive on the instruction line. More information on the STATIC qualifier is available in
Sections And Relocation, below.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
4-1
Software Project Management
Sections And Data Hiding
4.3
SECTIONS AND DATA HIDING
Symbols within a section are generally distinct from other symbols used elsewhere in the
source program, even if the symbol name is the same. This is true as long as the section
name associated with each symbol is unique, the symbol is not declared public (XDEF or
GLOBAL), and the GLOBAL or LOCAL qualifiers are not used in the section declaration
(see below). Symbols that are defined outside of a section are considered global symbols
and have no explicit section name associated with them. Global symbols may be referenced freely from inside or outside of any section, as long as the global symbol name does
not conflict with another symbol by the same name in a given section. Consider the following example:
SYM1
SYM2
SYM1
EQU
EQU
1
2
SECTION
EXAMPLE
EQU
3
MOVE
MOVE
#SYM1,R0
#SYM2,R1
ENDSEC
MOVE
#SYM1,R2
SYM1 and SYM2 are global symbols, initially defined outside of any section. Then in section EXAMPLE another instance of SYM1 is defined with a different value. Because
SYM1 was redefined inside the section, the value moved to R0 will be 3. Since SYM2 is
a global symbol the value moved to R1 will be 2. The last move to R2 is outside of any
section and thus the global instance of SYM1 is used; the value moved to R2 is 1.
4.3.1
Sections and Symbols
Symbols may be shared among sections through use of the XDEF and XREF directives.
The XDEF directive instructs the Assembler that certain symbol definitions that occur
within the current section are to be accessible by other sections:
XDEF
<symbol>,<symbol>,...,<symbol>
The XREF directive instructs the Assembler that all references to <symbol> within the current section are references to a symbol that was declared public within another section
with the XDEF directive:
XREF
4-2
<symbol>,<symbol>,...,<symbol>
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Software Project Management
Sections And Data Hiding
XDEFed symbols by default are recognized only in other sections which XREF them.
They can be made fully global (recognizable by sections which do not XREF them) by use
of the XR option (see the OPT directive, Chapter 6). Alternatively the GLOBAL directive
(see Chapter 6) may be used within a section to make the named symbols visible outside
of the section. Both the XDEF and XREF directives must be used before the symbols to
which they refer are defined or used in the section. Here is another example:
SYM1
SYM1
SYM2
EQU
SECTION
XDEF
EQU
EQU
ENDSEC
SECTION
XREF
MOVE
MOVE
ENDSEC
MOVE
1
SECT1
SYM2
2
3
SECT2
SYM2
#SYM1,R0
#SYM2,R1
#SYM2,R2
SYM1 is first defined outside of any section. Then in section SECT1 SYM2 is declared
public with an XDEF directive. SYM1 is also defined locally to section SECT1. In section
SECT2 SYM2 is declared external via the XREF directive, followed by a move of SYM1
to R0. Since SYM1 was defined locally to section SECT1, the Assembler uses the global
value and moves a 1 to R0. Because SYM2 was declared external in section SECT1 the
value moved to R1 is 3. If SYM2 had not been XREFed in section SECT2 the value
moved to R1 would have been unknown at this point. In the last instruction it is not known
what value will be moved to R2 since SYM2 was not defined outside of any section or was
not declared GLOBAL within a section.
If the GLOBAL qualifier follows the <section name> in the SECTION directive, then all
symbols defined in the section until the next ENDSEC directive are considered global.
The effect is as if every symbol in the section were declared with the GLOBAL directive.
This is useful when a section needs to be independently relocatable, but data hiding is not
required.
If the LOCAL qualifier follows the <section name> in the SECTION directive, then all symbols defined in the section until the next ENDSEC directive are visible to the immediately
enclosing section. The effect is as if every symbol in the section were defined within the
parent section. This is useful when a section needs to be independently relocatable, but
data hiding within an enclosing section is not required.
Symbols that are defined with the SET directive can be made visible with XDEF only in
absolute mode, and the section name associated with the symbol will be the section name
of the section where the symbol was first defined. This will be true even if the symbol value
is changed in another section.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
4-3
Software Project Management
Sections And Data Hiding
4.3.2
Sections and Macros
The division of a program into sections controls not only labels and symbols, but also macros and DEFINE directive symbols. Macros defined within a section are private to that
section and are distinct from macros defined in other sections even if they have the same
macro name. Macros defined outside of sections are considered global and may be used
within any section. Similarly, DEFINE directive symbols defined within a section are private to that section and DEFINE directive symbols defined outside of any section are globally applied. There are no directives that correspond to XDEF for macros or DEFINE
symbols, therefore macros and DEFINE symbols defined in a section can never be accessed globally. If global accessibility is desired, the macros and DEFINE symbols should
be defined outside of any section. Here is an example:
DEFINE
SECTION
DEFINE
MOVE
ENDSEC
MOVE
DEFVAL
SECT1
DEFVAL
#DEFVAL,R0
'1'
'2'
#DEFVAL,R1
The second definition of DEFVAL is visible only inside SECT1, so the value moved to R0
will be 2. However, the second move instruction is outside the scope of SECT1 and will
therefore use the initial definition of DEFVAL. This means that the value 1 will be moved
to R1.
4.3.3
Nested and Fragmented Sections
Sections can be nested to any level. When the Assembler encounters a nested section,
the current section is stacked and the new section is used. When the ENDSEC directive
of the nested section is encountered, the Assembler restores the old section and uses it.
The ENDSEC directive always applies to the most recent SECTION directive. Nesting
sections provides a measure of scoping for symbol names, in that symbols defined within
a given section are visible to other sections nested within it. For example, if section B is
nested inside section A, then a symbol defined in section A can be used in section B without XDEFing in section A or XREFing in section B. This scoping behavior can be turned
off and on with the NONS and NS options respectively (see the OPT directive, Chapter 6).
Sections may also be split into separate parts. That is, <section name> can be used multiple times with SECTION and ENDSEC directive pairs. If this occurs, then these separate
(but identically named) sections can access each others symbols freely without the use of
the XREF and XDEF directives. If the XDEF and XREF directives are used within one
section, they apply to all sections with the same section name. The reuse of the section
name is allowed to permit the program source to be arranged in an arbitrary manner (for
example, all statements that reserve X space storage locations grouped together), but retain the privacy of the symbols for each section.
4-4
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Software Project Management
Sections And Relocation
4.4
SECTIONS AND RELOCATION
When the Assembler operates in relative mode (the default), sections act as the basic
grouping for relocation of code and data blocks. For every section defined in the source
a set of location counters is allocated for each DSP memory space. These counters are
used to maintain offsets of data and instructions relative to the beginning of the section.
At link time sections can be relocated to an absolute address, loaded in a particular order,
or linked contiguously as specified by the programmer. Sections which are split into parts
or among files are logically recombined so that each section can be relocated as a unit.
Sections may be relocatable or absolute. In the Assembler absolute mode (command line
-A option) all sections are considered absolute. In relative mode, all sections are initially
relocatable. However, a section or a part of a section may be made absolute either implicitly by using the ORG directive, or explicitly through use of the MODE directive.
If the Assembler encounters an ORG directive with an absolute runtime address specification it switches to absolute mode and begins generating absolute addresses within the
enclosing section. Note that the mode change is effective only if the Assembler was started in relative mode; if the -A command line option is used the Assembler always generates absolute addresses. The Assembler continues to generate absolute code until an
ENDSEC directive is encountered, or the mode is explicitly changed via the MODE directive.
The MODE directive allows for arbitrary switching between absolute and relocatable code
generation:
MODE
<ABS[OLUTE] | REL[ATIVE]>
The MODE directive may be issued at any time in the assembly source to alter the set of
location counters used for section addressing. Code generated while in absolute mode
will be placed in memory at the location determined during assembly. Relocatable code
and data within a section are combined at link time, even if absolute blocks are inter-
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
4-5
Software Project Management
Address Assignment
spersed among relocatable blocks. The MODE directive has no effect when the command line -A option is active. The following is an example:
SECTION
EXAMPLE
; relocatable section
; code/data generated here is relocatable
MODE
ABSOLUTE
; code/data generated here is absolute; it will be
; placed in memory at the location specified during
; assembly
MODE
REL
; back to relocatable; code/data generated here
; will be combined with the previous relocatable block,
; as long as memory space and mappings are compatible
ORG
P:$200
; code/data generated here will be absolute
; until ENDSEC directive is found
ENDSEC
More information on the ORG and MODE directives can be found in Address Assignment
and under the individual directive descriptions in Chapter 6.
If the STATIC qualifier follows the <section name> in the SECTION directive, then all code
and data defined in the section until the next ENDSEC directive are relocated in terms of
the immediately enclosing section. The effect with respect to relocation is as if all code
and data in the section were defined within the parent section. This is useful when a section needs data hiding, but independent relocation is not required.
4.5
ADDRESS ASSIGNMENT
The Motorola DSP Assembler can support absolute address assignment at assembly
time or generation of relocatable program addresses which are resolved during the linking
phase. The ORG directive is used to specify memory space changes, mappings to physical memory, and absolute address assignment.
Various memory layouts require special handling for data generation or location counter
updating. In the case of L memory, two words of code or data are produced for each in-
4-6
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Software Project Management
Address Assignment
crement of the location counter. There are many kinds of E memory depending on the
characteristics of the RAM devices used. In most cases E memory implies splitting the
generated word into 8-bit triplets or 8 and 16-bit pairs on output, and adjusting the location
counter appropriately.
The Assembler allows for two sets of program counters per memory space, a set of load
counters and a set of runtime counters. The distinction between load and runtime
counters is maintained so that the Assembler can support overlays, or runtime transfers
of code/data from one memory space to another. In these cases code or data might be
loaded in one memory space at a given address, but then copied to a different memory
space and address for execution. The Assembler can produce output for either absolute
or relocatable overlays.
Motorola DSPs are capable of performing special-purpose addressing on data structures
suited to digital signal processing applications. Two such data structures are the modulo
buffer and the reverse-carry buffer, collectively referred to as circular buffers. Due to the
way they are accessed and manipulated, these buffers generally are constrained to a particular size or starting address. The Assembler provides directives for aligning buffer base
addresses, allocating buffer space, and initializing buffer contents.
4.5.1
The ORG Directive
The ORG directive specifies which memory space will be the runtime memory space and
which counter (the H, L, default, or numbered runtime counter associated with that memory space and section) will be the runtime location counter. At the same time, the ORG
directive indicates which memory space will be the load memory space and which counter
(the H, L, default, or numbered load counter associated with that memory space and section) will be used as the load location counter. In addition, the ORG directive can be used
to specify a physical mapping to DSP memory and to assign initial values to the runtime
and load location counters.
The names of the counters (High, Low, and default) are symbolic only, and the Assembler
performs no checks to insure that the value assigned to the High counter is greater than
the Low. Moreover, there is no inherent relationship among numbered counters, except
that counters 0, 1, and 2 correspond to the default, Low, and High counters, respectively.
Counters are useful for providing mnemonic links between runtime and load memory
spaces or among individual memory blocks. Separate counters can be used to obtain
blocks within a common section which are accessed from one memory space but mapped
to separate physical memories. Also counters are necessary for handling relocatable
overlays at link time, as the DSP linker does not support the notion of separate load and
runtime counters. See the examples below for more information on location counter usage.
The ORG directive is organized as follows:
ORG <rms>[<rlc>][<rmp>]:[<exp1>][,<lms>[<llc>][<lmp>]:[<exp2>]]
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
4-7
Software Project Management
Address Assignment
or alternatively:
ORG <rms>[<rmp>][(<rce>)]:[<exp1>][,<lms>[<lmp>][(<lce>)]:[<exp2>]]
<rms>
Which memory space (X, Y, L, P, or E) will be used as the runtime memory
space. If the memory space is L, any allocated datum with a value greater
than the target word size will be extended to two words; otherwise, it is truncated. If the memory space is E, then depending on the memory space qualifier, any generated words will be split into bytes, one byte per word, or a 16/
8-bit combination.
<rlc>
Which runtime counter H, L, or default (if neither H or L is specified), that is
associated with the <rms> will be used as the runtime location counter.
<rmp>
Indicates the runtime physical mapping to DSP memory: I - internal, E - external, R - ROM, A - port A, B - port B. If not present, no explicit mapping is
done.
<rce>
Non-negative absolute integer expression representing the counter number
to be used as the runtime location counter. Must be enclosed in parentheses. Should not exceed the value 65535.
<exp1>
Initial value to assign to the runtime counter used as the <rlc>. If <exp1> is
a relative expression the Assembler uses the relative location counter. If
<exp1> is an absolute expression the Assembler uses the absolute location counter. If <exp1> is not specified, then the last value and mode that
the counter had will be used.
<lms>
Which memory space (X, Y, L, P, or E) will be used as the load memory
space. If the memory space is L, any allocated datum with a value greater
than the target word size will be extended to two words; otherwise, it is truncated. If the memory space is E, then depending on the memory space qualifier, any generated words will be split into bytes, one byte per word, or a 16/
8-bit combination.
4-8
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Software Project Management
Address Assignment
<llc>
Which load counter, H, L, or default (if neither H or L is specified), that is associated with the <lms> will be used as the load location counter.
<lmp>
Indicates the load physical mapping to DSP memory: I - internal, E - external, R - ROM, A - port A, B - port B. If not present, no explicit mapping is
done.
<lce>
Non-negative absolute integer expression representing the counter number
to be used as the load location counter. Must be enclosed in parentheses.
Should not exceed the value 65535.
<exp2>
Initial value to assign to the load counter used as the <llc>. If <exp2> is a
relative expression the Assembler uses the relative location counter. If
<exp2> is an absolute expression the Assembler uses the absolute location counter. If <exp2> is not specified, then the last value and mode that
the counter had will be used.
The ORG directive is useful in multi-programmer projects because it provides a means for
the individual programmer to specify in which memory space and which segment of that
memory space the code being written will be located without specifying an absolute address. Absolute address assignment can be deferred until the various components of the
program are brought together. The utility of the ORG directive is not limited to multi-programmer projects. Even in single programmer projects, the ORG directive supports manipulation of overlays and the intermixing of label definition and code generation in
multiple memory spaces without having to reinitialize a location counter every time the
load memory space is changed.
4.5.2
Overlays
If the last half of the operand field in an ORG directive dealing with the load memory space
and counter is not specified, then the Assembler will assume that the load memory space
and load location counter are the same as the runtime memory space and runtime location counter. In this case, object code is being assembled to be loaded into the address
and memory space where it will be when the program is run, and is not an overlay.
If the load memory space and counter are given in the operand field, then the Assembler
always generates code for an overlay. Whether the overlay is absolute or relocatable depends upon the current operating mode of the Assembler and whether the load counter
value is an absolute or relative expression. If the Assembler is running in absolute mode,
or if the load counter expression is absolute, then the overlay is absolute. If the Assembler
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
4-9
Software Project Management
Address Assignment
is in relative mode and the load counter expression is relative, the overlay is relocatable.
Runtime relocatable overlay code is addressed relative to the location given in the runtime
location counter expression. This expression, if relative, may not refer to another overlay
block. See section 1.7 for more information on location counters and overlays.
The values and memory space attributes of both the load and runtime location counters
can be accessed with the @LCV function (see Section 3.8). This is particularly useful
when assigning the load location counter value to a label as a reference point for the overlay manager part of the program. The High, Low, default, or numbered counter assignment can be determined by using the @CTR function (Section 3.8).
4.5.3
Address Assignment Examples
Some examples of the ORG directive are as follows:
ORG P:$1000
Sets the runtime memory space to P. Selects the default runtime counter (counter
0) associated with P space to use as the runtime location counter and initializes it
to $1000. The load memory space is implied to be P, and the load location counter
is assumed to be the same as the runtime location counter.
ORG PHE:
Sets the runtime memory space to P. Selects the H load counter (counter 2) associated with P space to use as the runtime location counter. The H counter will
not be initialized, and its last value will be used. Code generated hereafter will be
mapped to external (E) memory. The load memory space is implied to be P, and
the load location counter is assumed to be the same as the runtime location
counter.
ORG PI:OVL1,Y:
Indicates code will be generated for an overlay. The runtime memory space is P,
and the default counter is used as the runtime location counter. It will be reset to
the value of OVL1. If the Assembler is in absolute mode via the -A command line
option then OVL1 must be an absolute expression. If OVL1 is an absolute expression the Assembler uses the absolute runtime location counter. If OVL1 is a relocatable value the Assembler uses the relative runtime location counter. In this case
OVL1 must not itself be an overlay symbol (e.g. defined within an overlay block).
The load memory space is Y. Since neither H, L, nor any counter expression was
specified as the load counter, the default load counter (counter 0) will be used as
the load location counter. The counter value and mode will be whatever it was the
last time it was referenced.
4-10
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Software Project Management
Address Assignment
ORG XL:,E8:
Sets the runtime memory space to X. Selects the L counter (counter 1) associated
with X space to use as the runtime location counter. The L counter will not be initialized, and its last value will be used. The load memory space is set to E, and the
qualifier 8 indicates a bytewise RAM configuration. Instructions and data will be
generated eight bits per output word with byte-oriented load addresses. The default load counter will be used and there is no explicit load origin.
ORG P(5):,Y:$8000
Indicates code will be generated for an absolute overlay. The runtime memory
space is P, and the counter used as the runtime location counter is counter 5. It
will not be initialized, and the last previous value of counter 5 will be used. The load
memory space is Y. Since neither H, L, nor any counter expression was specified
as the load counter, the default load counter (counter 0) will be used as the load
location counter. The default load counter will be initialized to $8000.
If the last example shown was used in the following code sequence (assume the runtime
counter associated with P space had a previous value of $0010),
RLMUL
ORG
MOVE
FMPY.S
MOVE
P(5):,Y:$8000
X:(R0),D4.S
D4,D7,D0
D0.S,X:(R1)
Y:(R4),D7.S
then the label RLMUL would have a value of $0010 and a memory space attribute of P
space; the code generated would load into Y memory starting at $8000; and the runtime
address associated with the code would start at $0010.
4.5.4
Circular Buffers
To take advantage of the special DSP addressing capabilities a circular buffer must be
aligned on an appropriate address boundary with respect to its size. For a buffer to be
located properly in memory the lower bits of the starting address which encompass one
less than the buffer size must be zero. For example, the lowest address greater than zero
at which a buffer of size 32 may be located is 32 (20 hexadecimal). More generally, the
buffer base address must be modulo the buffer size, or a multiple of 2k, where 2k is greater
than or equal to the size of the buffer.
Buffers may be allocated manually or by using one of the Assembler’s special buffer directives:
BUF1
BUF2
MOTOROLA
ORG
DS
DSM
X:$100
24
32
DSP ASSEMBLER REFERENCE MANUAL
4-11
Software Project Management
Address Assignment
The ORG statement sets the origin to hexadecimal 100 in X memory. The first buffer
BUF1 is manually allocated with a size of 24. Since the starting address is hex 100 the
buffer is already suitably aligned. The label BUF1 is assigned the runtime counter value
at the beginning of the buffer. The second buffer is allocated using the DSM directive,
which automatically sets the buffer starting address before reserving space. In this case,
the first buffer ended at location 117 hexadecimal, so the Assembler advances the program counter to location 120 hex before assigning a value to the buffer label BUF2.
Buffers are special-purpose data structures, but they are named and accessed with labels
like any other data block. They therefore adhere to the same rules governing data hiding
in sections that any other segment of code or data would follow. A buffer allocated when
the Assembler is in absolute mode (either via -A or an absolute ORG or MODE directive)
is placed in memory according to the absolute value of the runtime location counter at assembly time. A buffer allocated in relative mode (a relocatable buffer) is suitably aligned
within its relocation section at assembly time. During the link phase a section enclosing
any relocatable buffers is located based on the largest relocatable buffer it contains, unless the buffers inside the section are auto-aligned. This insures that any smaller buffers
within the section are properly aligned. If any buffers in the section are auto-aligned, they
will be relocated independent of any other code or data in the section. Note that repositioning of any buffer, whether relocatable or absolute, may result in alignment gaps in
memory depending on the layout of data surrounding the buffer blocks.
4-12
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Software Project Management
Example 1: Multi-programmer Environment
4.6
EXAMPLE 1: MULTI-PROGRAMMER ENVIRONMENT
Typical multi-programmer projects are often split into tasks representing functional units.
For discussion purposes, suppose a project has been divided into three tasks - I/O,
FILTER, and MAIN. Each task will be written by a separate programmer as a separate
section. For example, when the I/O task has been written, there will be a file called
IO.ASM. This file will have the following form:
SECTION I_O
XREF I_PORT,O_PORT
ORG XL:
.
.
<storage location definitions>
.
.
ORG P:
.
.
<IO section source statements>
.
.
ENDSEC
In this example, because the X space storage locations were defined within the section
I_O, they will be private storage locations that are accessible only by the I_O handler, and
cannot be referenced by other sections. If global memory resource management is desired, then the I_O section would not have defined any storage locations, and these would
have been defined as XREF. The X space data will be addressed through the Low
runtime counter. The P memory code is also private to the I_O section and uses the default runtime location counter for address generation.
In the discussion below, assume that the programmers responsible for the FILTER and
MAIN sections have similar program structures located in files named FILTER.ASM and
MAIN.ASM respectively. The program units can be combined either by invoking a final
assembly step to assign absolute addresses, or by assembling the modules separately
and then linking.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
4-13
Software Project Management
Example 1: Multi-programmer Environment
4.6.1
Absolute Mode Implementation
To assemble the entire project source code, a new file called PROJECT.ASM would be
created and would have the form:
ORG XLE:$0000
.
<global low memory X storage declarations (if any)>
.
ORG YLE:$0000
.
<global low memory Y storage declarations (if any)>
.
ORG YH:$FFC0
.
<global high memory Y storage declarations (if any)>
.
ORG XH:$FFC0
.
<global high memory X storage declarations (if any)>
.
; initialize internal low Program memory location counter
ORG PL:$1000
; initialize external high Program memory location counter
ORG PHE:$F000
INCLUDE 'MAIN.ASM'
INCLUDE 'IO.ASM'
INCLUDE 'FILTER.ASM'
END ENTRY
This file provides the project manager with a mechanism to organize memory utilization
to suit the application. For example, the external high P memory initialization statement
might correspond to the memory location of an external EPROM.
After the location counters corresponding to the X, Y, and P(rogram) memory spaces are
initialized, the Assembler is directed to take input from the MAIN.ASM file with the INCLUDE directive. Within the MAIN.ASM file, the source statements are assembled and
object code is generated. The X, Y, L, and P(rogram) location counters (High, Low) are
advanced corresponding to the number of words generated for each memory space and
location counter in use.
When the end of the MAIN.ASM file is encountered, the Assembler returns to the next sequential statement in the PROJECT.ASM file. This directs the Assembler to start taking
input from the IO.ASM file. Within this file, the ORG PL: statement directs the Assembler
4-14
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Software Project Management
Example 1: Multi-programmer Environment
to set the current memory space to P(rogram) and restore the last used P(rogram) L(ow)
location counter. The <IO source program statements> shown previously will be assembled at the next available Low Program memory space. When the end of the IO.ASM file
is encountered, the X, Y, and P(rogram) location counters (High and Low) will have been
advanced corresponding to the number of words generated for each memory space.
In a similar manner, the file FILTER.ASM will be assembled. The last statement of the
PROJECT.ASM file informs the Assembler that this is the last logical source statement,
and the starting address for the object module will be a label called ENTRY. In the example above, ENTRY would have been a label defined in the section MAIN and declared as
global with the XDEF directive.
4.6.2
Relative Mode Implementation
Using the Assembler default relative mode, each of the source files is assembled separately. For each section defined in the input files a separate set of location counters is
maintained such that all memory spaces for each section begin at relative address zero.
The linker is invoked to combine the files and establish base addresses:
DSPLNK -B -M -OXLI:0 -OYLI:0 -OYH:FFC0 -OXH:FFC0 \
-OPL:1000 -OPHE:A000 MAIN IO FILTER
The linker reads the command input and sets up base values for all counters specified on
the command line. In this example, the X and Y low memory counters are initialized to zero, whereas the X and Y high memory counters are set to FFC0 hexadecimal. The program low and high memory counters are initialized similarly. When the linker creates the
executable file it reads the input files and sets the starting address for all sections relative
to the values obtained from the command line. As the MAIN object file is read the linker
increments the section counters for all appropriate memory spaces.
After the MAIN object file is processed, the IO object file is read. The section named I_O
contained an ORG directive indicating a switch to the low X data memory counter. Recall
that the Assembler generated relocatable code for the I_O section source such that the
low X data memory counter begins at zero. The linker adjusts the low X memory counter
associated with section I_O to reflect any previous data generation performed in low X
memory (e.g. in MAIN). The FILTER module is linked in a similar fashion.
Another way for specifying base addresses, instead of lengthy command line options, is
through a memory control file. The memory control file allows the programmer to indicate memory space starting addresses analogously to the command line approach. In addition, the memory control file offers finer control over placement of sections in memory.
See the Motorola DSP Linker/Librarian Reference Manual for more information on the
memory control file.
The preceding examples described two methods for organizing a software project. Refer
to the descriptions of the ORG and SECTION directives in Chapter 6 for a more detailed
discussion. See also the Motorola DSP Linker/Librarian Reference Manual for more in-
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
4-15
Software Project Management
Example 2: Overlays
formation on relocation and linking. One other Assembler directive that should be mentioned (although not shown in the previous example) is the MACLIB directive which allows
sections to share a common macro library. The MACLIB directive is discussed more fully
in Chapter 5.
4.7
EXAMPLE 2: OVERLAYS
An overlay is a transfer of code or data from one memory space or address to another
memory space or address at runtime. Often the transfer involves copying different blocks
of code or data over a common storage area as runtime circumstances dictate; hence the
name overlay. Overlays are useful for moving code into internal program memory from
an external memory source such as EPROM. They are also effective when implementing
large programs with multiple segments which do not need to be accessed concurrently.
Consider the following program fragment contained in a file called OVER1.ASM:
SECTION
XREF
XDEF
ORG
OVERLAY1
OVLBASE
OVL1,O1SIZE
X:
ORG
P:OVLBASE,X:
OVL1
START
.
.
<overlay source statements>
.
.
END
O1SIZE
EQU
ENDSEC
END-START
This is a sample of overlay code bounded by a SECTION directive. The overlay base, or
the place to which this block of code will be moved for execution, is declared external at
OVLBASE (OVLBASE is actually defined elsewhere). The label OVL1 is XDEFed to provide a handle for moving the block at runtime, and O1SIZE is also XDEFed so that the
overlay management code knows how many words to move. Note that the OVL1 label is
placed before the ORG for the overlay so that it remains a valid address in X memory during execution. The overlay ORG directive insures that subsequent addresses will be
based from OVLBASE at runtime. The size of the overlay block (O1SIZE) is computed by
subtracting the START label value from the END label address. Assume for purposes of
discussion that there are other files containing similar overlay code with names
OVER2.ASM and OVER3.ASM.
4-16
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Software Project Management
Example 2: Overlays
4.7.1
Absolute Mode Implementation
In order to avoid binding addresses within the individual overlay modules, the programmer
could devise a preamble file called OVLPROJ.ASM which sets the appropriate counters
and establishes the overlay base address. Note that the following code assumes a
DSP96000, but similar instructions would apply for other target processors:
SECTION
XDEF
XREF
XREF
XREF
ORG
ORG
OVLBASE DS
MOVEOV1
MOVE
MOVE
MOVE
DO
MOVE
MOVE
_ENDLOOP
.
.
.
ENDSEC
OVLPROJECT
OVLBASE
OVL1,O1SIZE
OVL2,O2SIZE
OVL3,O3SIZE
XE:$100 ; set absolute base for overlay sections
PI:$200 ; set absolute base address for overlay
$400
; reserve space for overlay area
; code to move first overlay segment
#OVL1,R0; load overlay code address
#OVLBASE,R1; load overlay base address
#O1SIZE,D1.M; load overlay code size
D1.M,_ENDLOOP; loop to move data words into P memory
X:(R0)+,D0.M; get word of overlay from data memory
D0.M,P:(R1)+; store word of overlay into P memory
The overlay base address OVLBASE is made global with the XDEF statement. The overlay segments and their sizes are made visible to the project section by using the XREF
directive. The first ORG establishes where the overlay segments will be placed in memory contiguously at load time. The second ORG sets up the absolute base address for
the overlay area common to all of the overlay segments. Uninitialized space is allocated
for the overlay area, immediately followed by code to move the overlay segments into the
common area at runtime. The following Assembler command line will process the header
file and all overlay segments:
ASM96000 -A -B -L OVLPROJ OVER1 OVER2 OVER3 START
The Assembler is invoked in absolute mode (-A option), and generates an executable and
listing file. All files on the command line are processed as a single assembly run and all
are used to produce the output. OVLPROJ.ASM is read first and sets up the appropriate
absolute addresses for later sections. Then each overlay file is read and loaded one after
the other at external X memory address 100 hexadecimal. However, since each overlay
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
4-17
Software Project Management
Example 2: Overlays
module was intended to run starting at OVLBASE in P memory, all labels and jumps to
those labels within the overlay code will be relative to the overlay base address. This
means that the code in each of the overlay modules, when loaded by the overlay management code in the OVLPROJECT section, will start executing at internal P memory address
200 hexadecimal. The file START.ASM contains an END directive which indicates the
program start address after loading.
4.7.2
Relative Mode Implementation
In relative mode each of the overlay files is assembled separately to create individual object files. The object files are combined to build a single executable file. A preamble file
OVLPROJ.ASM containing overlay management code might appear as follows. Note that
this code assumes a DSP96000, but similar instructions would apply for other target processors:
SECTION
XDEF
XREF
XREF
XREF
ORG
OVLPROJECT
OVLBASE
OVL1,O1SIZE
OVL2,O2SIZE
OVL3,O3SIZE
PI:
MOVE
MOVE
MOVE
DO
#OVL1,R0
#OVLBASE,R1
#O1SIZE,D1.M
D1.M,_ENDLOOP
; load overlay code address
; load overlay base address
; load overlay code size
; loop to move data words into P
MOVE
X:(R0)+,D0.M
; get word of overlay from data
MOVE
D0.M,P:(R1)+
; store one word of overlay into P
$400
; reserve space for overlay area
MOVEOV1
ment
; set base address for overlay
; code to move first overlay seg-
memory
memory
memory
_ENDLOOP
OVLBASE
4-18
.
.
.
DS
ENDSEC
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Software Project Management
Example 2: Overlays
Note that the ORG to P space does not specify an absolute address. In order to obtain
the same result from these files as in an absolute mode implementation the following linker command line would be used:
DSPLNK -B -M -OXE:100 -OPI:200 OVLPROJ OVER1 OVER2 OVER3
The linker scans the command line and sets the base addresses for X and P memory.
Here the X default counter is set to hex 100 and mapped to external memory; likewise the
P default counter is set to hex 200 and mapped to internal memory. Base addresses can
also be established with the linker memory control file.
The linker reads each input object file, placing the header file in internal P memory and
combining the overlay modules into a contiguous block loaded into external X memory at
location 100 hexadecimal. Any labels or jumps within the overlay blocks are resolved to
addresses relative to the relocatable symbol OVLBASE. Since OVLBASE is the first load
P memory address it is assigned the value 200 hexadecimal. The linker does not guarantee that a given symbol or section will begin at a particular location unless that information
is explicitly specified in the linker memory control file. For more information on specific
linker operations see the Motorola DSP Linker/Librarian Reference Manual.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
4-19
Software Project Management
Example 3: Bootstrap Overlay
4.8
EXAMPLE 3: BOOTSTRAP OVERLAY
Many Motorola DSP processors, specifically those with RAM-based program memory,
support a bootstrap mode of operation. This involves mapping a built-in ROM-based bootstrap program into P memory, executing the program to move user-supplied code from
another location (usually EPROM) into program RAM, then transferring control to the user
program. Because the user program is loaded in one location (e.g. EPROM) but moved
to another for execution, it is a natural application for assembly language overlay semantics. Another wrinkle in bootstrap mode is that user instruction words are loaded in bytewise fashion, such that the load location counter must be incremented by bytes rather
than words. Consider the following section fragments contained in two files called
SECT1.ASM and SECT2.ASM respectively:
SECTION
ORG
SECT1
PI(1):,PE(2)
START1
.
.
<source statements>
.
.
END1
ENDSEC
...
SECTION
ORG
SECT2
PI(1):,PE(2)
START2
.
.
<source statements>
.
.
END2
ENDSEC
4-20
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Software Project Management
Example 3: Bootstrap Overlay
4.8.1
Absolute Mode Implementation
In order to avoid binding addresses within the individual modules, the programmer could
devise a preamble file called BOOTPROJ.ASM which sets the appropriate options and
establishes load and runtime base addresses:
OPT
LB
; increment load counter by
ORG
PI(1):$100,PE(2):$C000
; set runtime RAM address,
; bytewide load ROM ad-
bytes
dress
The OPT directive with the LB option indicates that the Assembler should increment the
load counter by the number of bytes in the target processor word. This guarantees that
the EPROM addresses will be correct for bytewide loading during bootstrap processing.
In the ORG directive, the runtime location counter, tagged as 1 and mapped to internal
memory, is set to hex 100. The load counter is tagged as 2, mapped to external memory,
and set to hex C000, where the built-in bootstrap program will begin loading bytes after
processor reset. The files are assembled using the command below:
ASM56100 -A -B -L BOOTPROJ SECT1 SECT2
The Assembler is invoked in absolute mode (-A option), and generates an executable and
listing file. All files on the command line are processed as a single assembly run and all
are used to produce the output. BOOTPROJ.ASM is read first and sets up the appropriate
absolute addresses for later sections. Since no explicit base address was given in the section files, both load and runtime addresses will continue from one section to the other, e.g.
they will be contiguous. For example, if only two words of instruction were between each
of the START and END labels, the runtime value for END1 and START2 would be hex
102. However, the load address of the code associated with these labels, assuming a 16
bit target word size, would be C004 hexadecimal. Similarly, the runtime value for END2
would be 104 hex and the corresponding load address would be C008 hexadecimal.
4.8.2
Relative Mode Implementation
In relative mode each of the source files is assembled separately to create individual object files. The object files are combined to build a single executable file. A preamble file is
not necessary to handle bootstrap files in relative mode because the addresses are established at link time. In order to generate bytewide load addresses the LB option can be
specified on the Assembler command line using the -O command line option:
ASM56100 -B -L -OLB SECT1
This command assembles the file SECT1.ASM and creates a relocatable object file called
SECT1.CLN. The listing file shows that the starting address of the section is zero; however, because of the LB option on the command line the load counter will increment at twice
the rate of the runtime counter (assuming a 16 bit DSP56100 family target processor). A
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
4-21
Software Project Management
Example 3: Bootstrap Overlay
similar command is used to assemble the SECT2 module. The two files are linked as follows:
DSPLNK -BBOOTPROJ.CLD "-OPI(1):100" "-OPE(2):C000" SECT1 SECT2
The linker scans the command line and sets the base addresses for P internal and external memory. The quotes around the -O options are necessary to avoid interpretation of
parentheses by some host command interpreters. Here the P counter number 1 is set to
hex 100 and mapped to internal memory; likewise the P counter number 2 is set to hex
C000 and mapped to external memory. Base addresses can also be established with the
linker memory control file. Since no explicit overlay base addresses were encountered in
the source files, both load and runtime addresses for the sections will be adjacent and
non-overlapping. Assuming a code size of 2 for each section and a 16 bit word size, the
value for label START1 will be hex 100 and the value for START2 will be hex 102; the
corresponding load addresses will be C000 hex and C004 hex, respectively. The executable output will be written to the file BOOTPROJ.CLD.
4-22
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Chapter 5
MACRO OPERATIONS AND CONDITIONAL ASSEMBLY
5.1
MACRO OPERATIONS
Programming applications frequently involve the coding of a repeated pattern or group of
instructions. Some patterns contain variable entries which change for each repetition of
the pattern. Others are subject to conditional assembly for a given occurrence of the instruction group. In either case, macros provide a shorthand notation for handling these
instruction patterns. Having determined the iterated pattern, the programmer can, within
the macro, designate selected fields of any statement as variable. Thereafter by invoking
a macro the programmer can use the entire pattern as many times as needed, substituting
different parameters for the designated variable portions of the statements.
When the pattern is defined it is given a name. This name becomes the mnemonic by
which the macro is subsequently invoked (called). If the name of the macro is the same
as an existing Assembler directive or mnemonic opcode, the macro will replace the directive or mnemonic opcode, and a warning will be issued. The warning can be avoided by
the use of the RDIRECT directive, which is used to remove entries from the Assembler’s
directive and mnemonic tables. If directives or mnemonics are removed from the Assembler’s tables, then no warning will be issued when the Assembler processes macros
whose names are the same as the removed directive or mnemonic entries. However, if
a macro is defined through the MACLIB directive which has the same name as an existing
directive or opcode, it will not automatically replace that directive or opcode as previously
described. In this case, the RDIRECT directive must be used to force the replacement.
See the description of the MACLIB directive below.
The macro call causes source statements to be generated. The generated statements
may contain substitutable arguments. The statements produced by a macro call are relatively unrestricted as to type. They can be any processor instruction, almost any Assembler directive, or any previously-defined macro. Source statements resulting from a
macro call are subject to the same conditions and restrictions that are applied to statements written by the programmer.
To invoke a macro, the macro name must appear in the operation code field of a source
statement. Any arguments are placed in the operand field. By suitably selecting the arguments in relation to their use as indicated by the macro definition, the programmer
causes the Assembler to produce in-line coding variations of the macro definition.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
5-1
Macro Operations And Conditional Assembly
Macro Libraries
The effect of a macro call is to produce in-line code to perform a predefined function. The
code is inserted in the normal flow of the program so that the generated instructions are
executed with the rest of the program each time the macro is called.
An important feature in defining a macro is the use of macro calls within the macro definition. The Assembler processes such nested macro calls at expansion time only. The
nesting of one macro definition within another definition is permitted. However, the nested
macro definition will not be processed until the primary macro is expanded. The macro
must be defined before its appearance in a source statement operation field.
5.2
MACRO LIBRARIES
The Motorola DSP Assembler allows for the maintenance of macro libraries with the MACLIB directive. This directive is used to specify the pathname (as defined by the host operating system) of a directory that contains macro definitions. Each macro definition must
be in a separate file, and the file must be named the same as the macro with the extension
.ASM added. For example, BLOCKMV.ASM would be a file that contained the definition
of the macro called BLOCKMV.
If a MACLIB directive has been specified in the source code and the Assembler encounters a name in the operation field that is not a previously defined macro or is not contained
in the directive or mnemonic tables, the directory specified in the MACLIB directive will be
searched for a file of that name (with the .ASM extension added). If such a file is found,
the current source line will be saved, and the file will be opened for input as an INCLUDE
file. When the end of the file is encountered, the source line is restored and processing
is resumed.
Because the source line is restored, the processed file must have a macro definition of the
unknown name, or an error will result when the source line is restored and processed.
However, the processed file is not limited to macro definitions, and can include any legal
source code statements. Multiple MACLIB directives may be given, in which case the Assembler will search each directory in the order in which they were specified.
5.3
MACRO DEFINITION
The definition of a macro consists of three parts: the header, which assigns a name to the
macro and defines the dummy arguments; the body, which consists of prototype or skeleton source statements; and the terminator. The header is the MACRO directive, its label,
and the dummy argument list. The body contains the pattern of standard source statements. The terminator is the ENDM directive.
The header of a macro definition has the form:
<label>
5-2
MACRO
[<dummy argument list>][<comment>]
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Macro Operations And Conditional Assembly
Macro Definition
The required label is the symbol by which the macro will be called. The dummy argument
list has the form:
[<dumarg>[,<dumarg>,...,<dumarg>]]
The dummy arguments are symbolic names that the macro processor will replace with arguments when the macro is expanded (called). Each dummy argument must obey the
same rules as global symbol names. Dummy argument names that are preceded by an
underscore are not allowed. Dummy arguments are separated by commas.
For example, consider the following macro definition:
N_R_MUL MACRO NMUL,AVEC,BVEC,RESULT
header
;
;This macro implements N real multiplies
;RESULT(I) = AVEC(I) * BVEC(I) I=1..NMUL
;where
;
NMUL
= number of multiplications
;
AVEC
= base address of array AVEC(I)
;
BVEC
= base address of array BVEC(I)
;
RESULT = base address of array RESULT(I)
;
MOVE
#AVEC,R0
body
MOVE
#BVEC,R4
MOVE
#RESULT,R1
MOVE
X:(R0)+,D4.S
Y:(R4)+,D7.S
DO
#NMUL,_ENDLOOP
FMPY.S
D4,D7,D0
X:(R0)+,D4.SY:(R4)+,D7.S
MOVE
D0.S,X:(R1)+
_ENDLOOP
ENDM
terminator
When a macro call is executed, the dummy arguments within the macro definition
(NMUL,AVEC,BVEC,RESULT in the example above) are replaced with the corresponding argument as defined by the macro call.
All local labels within a macro are considered distinct for the currently active level of macro
expansion (unless the macro local label override is used, see below). These local labels
are valid for the entire macro expansion and are not considered bounded by non-local labels. Therefore, all local labels within a macro must be unique. This mechanism allows
the programmer to freely use local labels within a macro definition without regard to the
number of times that the macro is expanded. Non-local labels within a macro expansion
are considered to be normal labels and thus cannot occur more than once unless used
with the SET directive (see Chapter 6).
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
5-3
Macro Operations And Conditional Assembly
Macro Calls
When specifying a local label within the body of a macro, the programmer must be aware
that the label symbol is valid for the entire body of the current level of macro expansion.
It is not valid for any nested macros within the current level of expansion. The example
above shows why the local label feature is useful. If the macro N_R_MUL were called
several times, there would be several _ENDLOOP labels resulting from the macro expansions. This is acceptable because each _ENDLOOP label is considered private to a particular instance of macro expansion.
It is sometimes desirable to pass local labels as macro arguments to be used within the
macro as address references (e.g. MOVE #_LABEL,R0). The Assembler effectively disallows this, however, since underscore label references within a macro invocation are regarded as labels local to that expansion of the macro. A macro local label override is
provided which causes local symbol lookup to have normal scope rather than macro call
scope. If a circumflex (^) precedes an expression containing an underscore label, at expansion the associated term will be evaluated using the normal local label list rather than
the macro local label list. The operator has no effect on normal labels or outside a macro
expansion.
5.4
MACRO CALLS
When a macro is invoked the statement causing the action is termed a macro call. The
syntax of a macro call consists of the following fields:
[<label>]
<macro name> [<arguments>][<comment>]
The argument field can have the form:
[<arg>[,<arg>,...,<arg>]]
The macro call statement is made up of three fields besides the comment field: the <label>, if any, will correspond to the value of the location counter at the start of the macro
expansion; the operation field which contains the macro name; and the operand field
which contains substitutable arguments. Within the operand field each calling argument
of a macro call corresponds one-to-one with a dummy argument of the macro definition.
For example, the N_R_MUL macro defined earlier could be invoked for expansion (called)
by the statement:
N_R_MUL
CNT+1,VEC1,VEC2,OUT
where the operand field arguments, separated by commas and taken left to right, correspond to the dummy arguments "N" through "RESULT", respectively. These arguments
are then substituted in their corresponding positions of the definition to produce a sequence of instructions.
Macro arguments consist of sequences of characters separated by commas. Although
these can be specified as quoted strings, to simplify coding the Assembler does not require single quotes around macro argument strings. However, if an argument has an embedded comma or space, that argument must be surrounded by single quotes ('). An
5-4
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Macro Operations And Conditional Assembly
Dummy Argument Operators
argument can be declared null when calling a macro. However, it must be declared explicitly null. Null arguments can be specified in four ways: by writing the delimiting commas in succession with no intervening spaces, by terminating the argument list with a
comma and omitting the rest of the argument list, by declaring the argument as a null
string, or by simply omitting some or all of the arguments. A null argument will cause no
character to be substituted in the generated statements that reference the argument. If
more arguments are supplied in the macro call than appear in the macro definition, a
warning will be output by the Assembler.
5.5
DUMMY ARGUMENT OPERATORS
The Assembler macro processor provides for text substitution of arguments during macro
expansion. In order to make the argument substitution facility more flexible, the Assembler also recognizes certain text operators within macro definitions which allow for transformations of the argument text. These operators can be used for text concatenation,
numeric conversion, and string handling.
5.5.1
Dummy argument concatenation operator - \
Dummy arguments that are intended to be concatenated with other characters must be
preceded by the concatenation operator, '\' to separate them from the rest of the characters. The argument may precede or follow the adjoining text, but there must be no intervening blanks between the concatenation operator and the rest of the characters. To
position an argument between two alphanumeric characters, place a backslash both before and after the argument name. For example, consider the following macro definition:
SWAP_REG
MACRO
MOVE
MOVE
MOVE
ENDM
REG1,REG2
;swap REG1,REG2 using X0 as temp
R\REG1,X0
R\REG2,R\REG1
X0,R\REG2
If this macro were called with the following statement,
SWAP_REG
0,1
then for the macro expansion, the macro processor would substitute the character 0 for
the dummy argument REG1, and the character 1 for the dummy argument REG2. The
concatenation operator (\) indicates to the macro processor that the substitution characters for the dummy arguments are to be concatenated in both cases with the character R.
The resulting expansion of this macro call would be:
MOVE
MOVE
MOVE
MOTOROLA
R0,X0
R1,R0
X0,R1
DSP ASSEMBLER REFERENCE MANUAL
5-5
Macro Operations And Conditional Assembly
Dummy Argument Operators
5.5.2
Return value operator - ?
Another macro definition operator is the question mark (?) that returns the value of a symbol. When the macro processor encounters this operator, the ?<symbol> sequence is
converted to a character string representing the decimal value of the <symbol>. For example, consider the following modification of the SWAP_REG macro described above:
SWAP_SYM
MACRO
MOVE
MOVE
MOVE
ENDM
REG1,REG2
;swap REG1,REG2 using X0 as temp
R\?REG1,X0
R\?REG2,R\?REG1
X0,R\?REG2
If the source file contained the following SET statements and macro call,
AREG
BREG
SET
SET
SWAP_SYM
0
1
AREG,BREG
then the sequence of events would be as follows: the macro processor would first substitute the characters AREG for each occurrence of REG1 and BREG for each occurrence
of REG2. For discussion purposes (this would never appear on the source listing), the
intermediate macro expansion would be:
MOVE
MOVE
MOVE
R\?AREG,X0
R\?BREG,R\?AREG
X0,R\?BREG
The macro processor would then replace ?AREG with the character 0 and ?BREG with
the character 1, since 0 is the value of the symbol AREG and 1 is the value of BREG. The
resulting intermediate expansion would be:
MOVE
MOVE
MOVE
R\0,X0
R\1,R\0
X0,R\1
Next, the macro processor would apply the concatenation operator (\), and the resulting
expansion as it would appear on the source listing would be:
MOVE
MOVE
MOVE
5-6
R0,X0
R1,R0
X0,R1
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Macro Operations And Conditional Assembly
Dummy Argument Operators
5.5.3
Return hex value operator - %
The percent sign (%) is similar to the standard return value operator except that it returns
the hexadecimal value of a symbol. When the macro processor encounters this operator,
the %<symbol> sequence is converted to a character string representing the hexadecimal
value of the <symbol>. Consider the following macro definition:
GEN_LAB
LAB\%VAL
MACRO LAB,VAL,STMT
STMT
ENDM
This macro generates a label consisting of the concatenation of the label prefix argument
and a value that is interpreted as hexadecimal. If this macro were called as follows,
NUM
SET
GEN_LAB
10
HEX,NUM,'NOP'
the macro processor would first substitute the characters HEX for LAB, then it would replace %VAL with the character A, since A is the hexadecimal representation for the decimal integer 10. Next, the macro processor would apply the concatenation operator (\).
Finally, the string 'NOP' would be substituted for the STMT argument. The resulting expansion as it would appear in the listing file would be:
HEXA
NOP
The percent sign is also the character used to indicate a binary constant. If a binary constant is required inside a macro it may be necessary to enclose the constant in parentheses or escape the constant by following the percent sign by a backslash (\).
5.5.4
Dummy argument string operator - "
Another dummy argument operator is the double quote ("). This character is replaced with
a single quote by the macro processor, but following characters are still examined for
dummy argument names. The effect in the macro call is to transform any enclosed dummy
arguments into literal strings. For example, consider the following macro definition:
STR_MAC
MACRO
DC
ENDM
STRING
"STRING"
If this macro were called with the following macro expansion line,
STR_MAC
ABCD
then the resulting macro expansion would be:
DC
MOTOROLA
'ABCD'
DSP ASSEMBLER REFERENCE MANUAL
5-7
Macro Operations And Conditional Assembly
Dummy Argument Operators
Double quotes also make possible DEFINE directive expansion within quoted strings. Because of this overloading of the double quotes, care must be taken to insure against inappropriate expansions in macro definitions. Since DEFINE expansion occurs before macro
substitution, any DEFINE symbols are replaced first within a macro dummy argument
string:
STR_MAC
DEFINE
MACRO
MSG
MSG
ENDM
LONG
'short'
STRING
'This is a LONG STRING'
"This is a LONG STRING"
If this macro were invoked as follows,
STR_MAC
sentence
then the resulting expansion would be:
MSG
MSG
5.5.5
'This is a LONG STRING'
'This is a short sentence'
Macro local label override operator - ^
It may be desirable to pass a local label as a macro argument to be used as an address
reference within the macro body. If a circumflex (^) precedes an expression containing
an underscore label, during macro expansion the associated term will be evaluated with
normal local label scope rather than macro call scope. Such interpretation disables the
usual local label semantics for this particular reference within the macro call. Here is an
example:
LOAD
MACRO ADDR
MOVE
P:^ADDR,R0
ENDM
The macro local label override operator causes the ADDR argument to be interpreted as
a local label outside the macro if the expanded argument has a leading underscore. If
there is no leading underscore on the actual argument then the override operator has no
effect. Consider the following macro call:
_LOCAL
LOAD
_LOCAL
Without the local label override in the macro definition, an error would occur at the macro
call because a symbol _LOCAL was not defined in the body of the macro. Because the
circumflex was used the value of _LOCAL gets moved to R0. Note that any arbitrary string
may be used as the actual parameter to the LOAD macro. The override operator has an
effect only with underscore labels. Care must be exercised, however, in not defining a
5-8
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Macro Operations And Conditional Assembly
DUP, DUPA, DUPC, DUPF Directives
macro label called _LOCAL and attempting to reference it as in the above example. In
that case the macro local label override operator prevents the Assembler from seeing the
local label definition for that reference, and an error would result.
5.6
DUP, DUPA, DUPC, DUPF DIRECTIVES
The DUP, DUPA, DUPC, and DUPF directives are specialized macro forms. They can be
thought of as a simultaneous definition and call of an unnamed macro. The source statements between the DUP, DUPA, DUPC, and DUPF directives and the ENDM directive follow the same rules as macro definitions, including (in the case of DUPA, DUPC, and
DUPF) the dummy operator characters described previously. For a detailed description of
these directives, refer to Chapter 6.
5.7
CONDITIONAL ASSEMBLY
Conditional assembly facilitates the writing of comprehensive source programs that can
cover many conditions. Assembly conditions may be specified through the use of arguments in the case of macros, and through definition of symbols via the DEFINE, SET, and
EQU directives. Variations of parameters can then cause assembly of only those parts
necessary for the given conditions. The built-in functions of the Assembler provide a versatile means of testing many conditions of the assembly environment (see Section 3.8 for
more information on the Assembler built-in functions).
Conditional directives can also be used within a macro definition to ensure at expansion
time that arguments fall within a range of allowable values. In this way macros become
self-checking and can generate error messages to any desired level of detail.
The conditional assembly directive IF has the following form:
IF
.
.
[ELSE]
.
.
ENDIF
<expression>
(the ELSE directive is optional)
A section of a program that is to be conditionally assembled must be bounded by an IFENDIF directive pair. If the optional ELSE directive is not present, then the source statements following the IF directive and up to the next ENDIF directive will be included as part
of the source file being assembled only if the <expression> had a nonzero result. If the
<expression> has a value of zero, the source file will be assembled as if those statements
between the IF and the ENDIF directives were never encountered. If the ELSE directive
is present and <expression> has a nonzero result, then the statements between the IF
and ELSE directives will be assembled, and the statements between the ELSE and
ENDIF directives will be skipped. Alternatively, if <expression> has a value of zero, then
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
5-9
Macro Operations And Conditional Assembly
Conditional Assembly
the statements between the IF and ELSE directives will be skipped, and the statements
between the ELSE and ENDIF directives will be assembled.
5-10
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Chapter 6
ASSEMBLER SIGNIFICANT CHARACTERS AND DIRECTIVES
6.1
INTRODUCTION
This chapter describes the directives that are recognized by the Motorola DSP Assembler. The Assembler directives are instructions to the Assembler rather than instructions
to be directly translated into object code. In addition, this chapter describes special characters that are considered significant to the Assembler.
6.2
ASSEMBLER SIGNIFICANT CHARACTERS
There are several one and two character sequences that are significant to the Assembler.
Some have multiple meanings depending on the context in which they are used. Special
characters associated with expression evaluation are described in Chapter 3. Other Assembler-significant characters are:
;
;;
\
-
?
%
^
"
-
@
*
++
[]
<<
<
>
#
-
MOTOROLA
Comment delimiter
Unreported comment delimiter
Line continuation character or
Macro dummy argument concatenation operator
Macro value substitution operator
Macro hex value substitution operator
Macro local label override operator
Macro string delimiter or
Quoted string DEFINE expansion character
Function delimiter
Location counter substitution
String concatenation operator
Substring delimiter
I/O short addressing mode force operator
Short addressing mode force operator
Long addressing mode force operator
Immediate addressing mode operator
DSP ASSEMBLER REFERENCE MANUAL
6-1
Assembler Significant Characters And Directives
Assembler Directives
#<
#>
6.3
-
Immediate short addressing mode force operator
Immediate long addressing mode force operator
ASSEMBLER DIRECTIVES
Assembler directives can be grouped by function into seven types:
1.
2.
3.
4.
5.
6.
7.
6.3.1
Assembly control
Symbol definition
Data definition/storage allocation
Listing control and options
Object file control
Macros and conditional assembly
Structured programming
Assembly Control
The directives used for assembly control are:
COMMENT
DEFINE
END
FAIL
FORCE
HIMEM
INCLUDE
LOMEM
MODE
MSG
ORG
RADIX
RDIRECT
SCSJMP
SCSREG
UNDEF
WARN
6-2
- Start comment lines
- Define substitution string
- End of source program
- Programmer generated error message
- Set operand forcing mode
- Set high memory bounds
- Include secondary file
- Set low memory bounds
- Change relocation mode
- Programmer generated message
- Initialize memory space and location counters
- Change input radix for constants
- Remove directive or mnemonic from table
- Set structured control branching mode
- Reassign structured control statement registers
- Undefine DEFINE symbol
- Programmer generated warning
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
6.3.2
Symbol Definition
The directives used to control symbol definition are:
ENDSEC
EQU
GLOBAL
GSET
LOCAL
SECTION
SET
XDEF
XREF
6.3.3
- End section
- Equate symbol to a value
- Global section symbol declaration
- Set global symbol to a value
- Local section symbol declaration
- Start section
- Set symbol to a value
- External section symbol definition
- External section symbol reference
Data Definition/Storage Allocation
The directives used to control constant data definition and storage allocation are:
BADDR
BSB
BSC
BSM
BUFFER
DC
DCB
DS
DSM
DSR
ENDBUF
6.3.4
- Set buffer address
- Block storage bit-reverse
- Block storage of constant
- Block storage modulo
- Start buffer
- Define constant
- Define constant byte
- Define storage
- Define modulo storage
- Define reverse carry storage
- End buffer
Listing Control and Options
The directives used to control the output listing are:
LIST
LSTCOL
NOLIST
OPT
PAGE
PRCTL
STITLE
TABS
TITLE
MOTOROLA
- List the assembly
- Set listing field widths
- Stop assembly listing
- Assembler options
- Top of page/size page
- Send control string to printer
- Initialize program subtitle
- Set listing tab stops
- Initialize program title
DSP ASSEMBLER REFERENCE MANUAL
6-3
Assembler Significant Characters And Directives
Assembler Directives
6.3.5
Object File Control
The directives used for control of the object file are:
COBJ
IDENT
SYMOBJ
6.3.6
- Comment object code
- Object code identification record
- Write symbol information to object file
Macros and Conditional Assembly
The directives used for macros and conditional assembly are:
DUP
DUPA
DUPC
DUPF
ENDIF
ENDM
EXITM
IF
MACLIB
MACRO
PMACRO
6.3.7
- Duplicate sequence of source lines
- Duplicate sequence with arguments
- Duplicate sequence with characters
- Duplicate sequence in loop
- End of conditional assembly
- End of macro definition
- Exit macro
- Conditional assembly directive
- Macro library
- Macro definition
- Purge macro definition
Structured Programming
The directives used for structured programming are:
.BREAK
.CONTINUE
.ELSE
.ENDF
.ENDI
.ENDL
.ENDW
.FOR
.IF
.LOOP
.REPEAT
.UNTIL
.WHILE
6-4
- Exit from structured loop construct
- Continue next iteration of structured loop
- Perform following statements when .IF false
- End of .FOR loop
- End of .IF condition
- End of hardware loop
- End of .WHILE loop
- Begin .FOR loop
- Begin .IF condition
- Begin hardware loop
- Begin .REPEAT loop
- End of .REPEAT loop
- Begin .WHILE loop
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
Individual descriptions of each of the Assembler special characters and directives follow.
They include usage guidelines, functional descriptions, and examples. Structured programming directives are discussed separately in Chapter 7.
Some directives require a label field, while in many cases a label is optional. If the description of an Assembler directive does not indicate a mandatory or optional label field, then
a label is not allowed on the same line as the directive. In general, it is disallowed to use
the label field of a data directive (such as DS, BSC, or buffer directives) in an expression
used to define the space being allocated. This is because in some cases the label value
cannot be determined until the operand field is fully evaluated. For example:
BADDS
DS
BADDS
The line above is invalid because the label BADDS cannot reasonably be determined in
this context.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
6-5
Assembler Significant Characters And Directives
Assembler Directives
;
Comment Delimiter Character
Any number of characters preceded by a semicolon (;), but not part of a literal string, is
considered a comment. Comments are not significant to the Assembler, but they can be
used to document the source program. Comments will be reproduced in the Assembler
output listing. Comments are normally preserved in macro definitions, but this option can
be turned off (see the OPT directive, this chapter).
Comments can occupy an entire line, or can be placed after the last Assembler-significant
field in a source statement. A comment starting in the first column of the source file will
be aligned with the label field in the listing file. Otherwise, the comment will be shifted right
and aligned with the comment field in the listing file.
EXAMPLE:
; THIS COMMENT BEGINS IN COLUMN 1 OF THE SOURCE FILE
LOOP
6-6
JSR
COMPUTE
; THIS IS A TRAILING COMMENT
; THESE TWO COMMENTS ARE PRECEDED
; BY A TAB IN THE SOURCE FILE
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
;;
Unreported Comment Delimiter Characters
Unreported comments are any number of characters preceded by two consecutive semicolons (;;) that are not part of a literal string. Unreported comments are not considered
significant by the Assembler, and can be included in the source statement, following the
same rules as normal comments. However, unreported comments are never reproduced
on the Assembler output listing, and are never saved as part of macro definitions.
EXAMPLE:
;; THESE LINES WILL NOT BE REPRODUCED
;; IN THE SOURCE LISTING
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
6-7
Assembler Significant Characters And Directives
Assembler Directives
\
Line Continuation Character or
Macro Argument Concatenation Character
Line Continuation
The backslash character (\), if used as the last character on a line, indicates to the Assembler that the source statement is continued on the following line. The continuation line will
be concatenated to the previous line of the source statement, and the result will be processed by the Assembler as if it were a single line source statement. The maximum
source statement length (the first line and any continuation lines) is 512 characters.
EXAMPLE:
; THIS COMMENT \
EXTENDS OVER \
THREE LINES
Macro Argument Concatenation
The backslash (\) is also used to cause the concatenation of a macro dummy argument
with other adjacent alphanumeric characters. For the macro processor to recognize dummy arguments, they must normally be separated from other alphanumeric characters by
a non-symbol character. However, sometimes it is desirable to concatenate the argument
characters with other characters. If an argument is to be concatenated in front of or behind some other symbol characters, then it must be followed by or preceded by the backslash, respectively.
EXAMPLE:
Suppose the source input file contained the following macro definition:
SWAP_REG
6-8
MACRO
MOVE
MOVE
MOVE
ENDM
REG1,REG2 ;swap REG1,REG2 using D4.L as temp
R\REG1,D4.L
R\REG2,R\REG1
D4.L,R\REG2
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
The concatenation operator (\) indicates to the macro processor that the substitution characters for the dummy arguments are to be concatenated in both cases with the character
R. If this macro were called with the following statement,
SWAP_REG
0,1
the resulting expansion would be:
MOVE
MOVE
MOVE
MOTOROLA
R0,D4.L
R1,R0
D4.L,R1
DSP ASSEMBLER REFERENCE MANUAL
6-9
Assembler Significant Characters And Directives
Assembler Directives
?
Return Value of Symbol Character
The ?<symbol> sequence, when used in macro definitions, will be replaced by an ASCII
string representing the value of <symbol>. This operator may be used in association with
the backslash (\) operator. The value of <symbol> must be an integer (not floating point).
EXAMPLE:
Consider the following macro definition:
SWAP_SYM
MACRO
MOVE
MOVE
MOVE
ENDM
REG1,REG2 ;swap REG1,REG2 using D4.L as temp
R\?REG1,D4.L
R\?REG2,R\?REG1
D4.L,R\?REG2
If the source file contained the following SET statements and macro call,
AREG
BREG
SET
SET
SWAP_SYM
0
1
AREG,BREG
the resulting expansion as it would appear on the source listing would be:
MOVE
MOVE
MOVE
6-10
R0,D4.L
R1,R0
D4.L,R1
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
%
Return Hex Value of Symbol Character
The %<symbol> sequence, when used in macro definitions, will be replaced by an ASCII
string representing the hexadecimal value of <symbol>. This operator may be used in association with the backslash (\) operator. The value of <symbol> must be an integer (not
floating point).
EXAMPLE:
Consider the following macro definition:
GEN_LAB
LAB\%VAL
MACRO
STMT
ENDM
LAB,VAL,STMT
If this macro were called as follows,
NUM
SET
GEN_LAB
10
HEX,NUM,'NOP'
The resulting expansion as it would appear in the listing file would be:
HEXA
MOTOROLA
NOP
DSP ASSEMBLER REFERENCE MANUAL
6-11
Assembler Significant Characters And Directives
Assembler Directives
^
Macro Local Label Override
The circumflex (^), when used as a unary expression operator in a macro expansion, will
cause any local labels in its associated term to be evaluated at normal scope rather than
macro scope. This means that any underscore labels in the expression term following the
circumflex will not be searched for in the macro local label list. The operator has no effect
on normal labels or outside of a macro expansion. The circumflex operator is useful for
passing local labels as macro arguments to be used as referents in the macro. Note that
the circumflex is also used as the binary exclusive OR operator.
EXAMPLE:
Consider the following macro definition:
LOAD
MACRO
MOVE
ENDM
ADDR
P:^ADDR,R0
If this macro were called as follows,
_LOCAL
LOAD
_LOCAL
the Assembler would ordinarily issue an error since _LOCAL is not defined within the body
of the macro. With the override operator the Assembler recognizes the _LOCAL symbol
outside the macro expansion and uses that value in the MOVE instruction.
6-12
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
"
Macro String Delimiter or
Quoted String DEFINE Expansion Character
Macro String
The double quote ("), when used in macro definitions, is transformed by the macro processor into the string delimiter, the single quote ('). The macro processor examines the
characters between the double quotes for any macro arguments. This mechanism allows
the use of macro arguments as literal strings.
EXAMPLE:
Using the following macro definition,
CSTR
MACRO
DC
ENDM
STRING
"STRING"
and a macro call,
CSTR
ABCD
the resulting macro expansion would be:
DC
'ABCD'
Quoted String DEFINE Expansion
A sequence of characters which matches a symbol created with a DEFINE directive will
not be expanded if the character sequence is contained within a quoted string. Assembler
strings generally are enclosed in single quotes ('). If the string is enclosed in double
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
6-13
Assembler Significant Characters And Directives
Assembler Directives
quotes (") then DEFINE symbols will be expanded within the string. In all other respects
usage of double quotes is equivalent to that of single quotes.
EXAMPLE:
Consider the source fragment below:
STR_MAC
DEFINE
MACRO
MSG
MSG
ENDM
LONG
'short'
STRING
'This is a LONG STRING'
"This is a LONG STRING"
If this macro were invoked as follows,
STR_MAC
sentence
then the resulting expansion would be:
MSG
MSG
6-14
'This is a LONG STRING'
'This is a short sentence'
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
@
Function Delimiter
All Assembler built-in functions start with the @ symbol. See Section 3.8 for a full discussion of these functions.
EXAMPLE:
SVAL
MOTOROLA
EQU
@SQT(FVAL)
; OBTAIN SQUARE ROOT
DSP ASSEMBLER REFERENCE MANUAL
6-15
Assembler Significant Characters And Directives
Assembler Directives
*
Location Counter Substitution
When used as an operand in an expression, the asterisk represents the current integer
value of the runtime location counter.
EXAMPLE:
XBASE
6-16
ORG
X:$100
EQU
*+$20
; XBASE = $120
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
++
String Concatenation Operator
Any two strings can be concatenated with the string concatenation operator (++). The two
strings must each be enclosed by single or double quotes, and there must be no intervening blanks between the string concatenation operator and the two strings.
EXAMPLE:
'ABC'++'DEF' = 'ABCDEF'
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
6-17
Assembler Significant Characters And Directives
Assembler Directives
[]
Substring Delimiter
[<string>,<offset><length>]
Square brackets delimit a substring operation. The <string> argument is the source
string. <offset> is the substring starting position within <string>. <length> is the length of
the desired substring. <string> may be any legal string combination, including another
substring. An error is issued if either <offset> or <length> exceed the length of <string>.
EXAMPLE:
DEFINE
6-18
ID
['DSP56000',3,5]
DSP ASSEMBLER REFERENCE MANUAL
; ID = '56000'
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
<<
I/O Short Addressing Mode Force Operator
Many DSP instructions allow an I/O short form of addressing. If the value of an absolute
address is known to the Assembler on pass one, then the Assembler will always pick the
shortest form of addressing consistent with the instruction format. If the absolute address
is not known to the Assembler on pass one (that is, the address is a forward or external
reference), then the Assembler will pick the long form of addressing by default. If this is
not desired, then the I/O short form of addressing can be forced by preceding the absolute
address by the I/O short addressing mode force operator (<<).
EXAMPLE:
Since the symbol IOPORT is a forward reference in the following sequence of source
lines, the Assembler would pick the long absolute form of addressing by default:
IOPORT
BTST
EQU
#4,Y:IOPORT
Y:$FFF3
Because the long absolute addressing mode would cause the instruction to be two words
long instead of one word for the I/O short absolute addressing mode, it would be desirable
to force the I/O short absolute addressing mode as shown below:
IOPORT
MOTOROLA
BTST
EQU
#4,Y:<<IOPORT
Y:$FFF3
DSP ASSEMBLER REFERENCE MANUAL
6-19
Assembler Significant Characters And Directives
Assembler Directives
<
Short Addressing Mode Force Operator
Many DSP instructions allow a short form of addressing. If the value of an absolute address is known to the Assembler on pass one, or the FORCE SHORT directive is active,
then the Assembler will always pick the shortest form of addressing consistent with the
instruction format. If the absolute address is not known to the Assembler on pass one
(that is, the address is a forward or external reference), then the Assembler will pick the
long form of addressing by default. If this is not desired, then the short absolute form of
addressing can be forced by preceding the absolute address by the short addressing
mode force operator (<).
See also: FORCE
EXAMPLE:
Since the symbol DATAST is a forward reference in the following sequence of source
lines, the Assembler would pick the long absolute form of addressing by default:
DATAST
MOVE
EQU
D0.L,Y:DATAST
Y:$23
Because the long absolute addressing mode would cause the instruction to be two words
long instead of one word for the short absolute addressing mode, it would be desirable to
force the short absolute addressing mode as shown below:
DATAST
6-20
MOVE
EQU
D0.L,Y:<DATAST
Y:$23
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
>
Long Addressing Mode Force Operator
Many DSP instructions allow a long form of addressing. If the value of an absolute address is known to the Assembler on pass one, then the Assembler will always pick the
shortest form of addressing consistent with the instruction format, unless the FORCE
LONG directive is active. If this is not desired, then the long absolute form of addressing
can be forced by preceding the absolute address by the long addressing mode force operator (>).
See also: FORCE
EXAMPLE:
Since the symbol DATAST is a not a forward reference in the following sequence of
source lines, the Assembler would pick the short absolute form of addressing:
DATAST
EQU
MOVE
Y:$23
D0.L,Y:DATAST
If this is not desirable, then the long absolute addressing mode can be forced as shown
below:
DATAST
MOTOROLA
EQU
MOVE
Y:$23
D0.L,Y:>DATAST
DSP ASSEMBLER REFERENCE MANUAL
6-21
Assembler Significant Characters And Directives
Assembler Directives
#
Immediate Addressing Mode
The pound sign (#) is used to indicate to the Assembler to use the immediate addressing
mode.
EXAMPLE:
CNST
6-22
EQU
MOVE
$5
#CNST,D0.L
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
#<
Immediate Short Addressing Mode Force Operator
Many DSP instructions allow a short immediate form of addressing. If the immediate data
is known to the Assembler on pass one (not a forward or external reference), or the
FORCE SHORT directive is active, then the Assembler will always pick the shortest form
of immediate addressing consistent with the instruction. If the immediate data is a forward
or external reference, then the Assembler will pick the long form of immediate addressing
by default. If this is not desired, then the short form of addressing can be forced using the
immediate short addressing mode force operator (#<).
See also: FORCE
EXAMPLE:
In the following sequence of source lines, the symbol CNST is not known to the Assembler
on pass one, and therefore, the Assembler would use the long immediate addressing form
for the MOVE instruction.
CNST
MOVE
EQU
#CNST,D0.L
$5
Because the long immediate addressing mode makes the instruction two words long instead of one word for the immediate short addressing mode, it may be desirable to force
the immediate short addressing mode as shown below:
CNST
MOTOROLA
MOVE
EQU
#<CNST,D0.L
$5
DSP ASSEMBLER REFERENCE MANUAL
6-23
Assembler Significant Characters And Directives
Assembler Directives
#>
Immediate Long Addressing Mode Force Operator
Many DSP instructions allow a long immediate form of addressing. If the immediate data
is known to the Assembler on pass one (not a forward or external reference), then the Assembler will always pick the shortest form of immediate addressing consistent with the instruction, unless the FORCE LONG directive is active. If this is not desired, then the long
form of addressing can be forced using the immediate long addressing mode force operator (#>).
See also: FORCE
EXAMPLE:
In the following sequence of source lines, the symbol CNST is known to the Assembler
on pass one, and therefore, the Assembler would use the short immediate addressing
form for the MOVE instruction.
CNST
EQU
MOVE
$5
#CNST,D0.L
If this is not desirable, then the long immediate form of addressing can be forced as shown
below:
CNST
6-24
EQU
MOVE
$5
#>CNST,D0.L
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
BADDR
Set Buffer Address
BADDR
<M | R>,<expression>
The BADDR directive sets the runtime location counter to the address of a buffer of the
given type, the length of which in words is equal to the value of <expression>. The buffer
type may be either Modulo or Reverse-carry. If the runtime location counter is not zero,
this directive first advances the runtime location counter to a base address that is a multiple of 2k, where 2k >= <expression>. An error will be issued if there is insufficient memory
remaining to establish a valid base address. Unlike other buffer allocation directives, the
runtime location counter is not advanced by the value of the integer expression in the operand field; the location counter remains at the buffer base address. The block of memory
intended for the buffer is not initialized to any value.
The result of <expression> may have any memory space attribute but must be an absolute integer greater than zero and cannot contain any forward references (symbols that
have not yet been defined). If a Modulo buffer is specified, the expression must fall within
the range 2 <= <expression> <= m, where m is the maximum address of the target DSP.
If a Reverse-carry buffer is designated and <expression> is not a power of two a warning
will be issued.
A label is not allowed with this directive.
See also: BSM, BSB, BUFFER, DSM, DSR
EXAMPLE:
M_BUF
MOTOROLA
ORG
X:$100
BADDR M,24
; CIRCULAR BUFFER MOD 24
DSP ASSEMBLER REFERENCE MANUAL
6-25
Assembler Significant Characters And Directives
Assembler Directives
BSB
Block Storage Bit-Reverse
[<label>]
BSB
<expression>[,<expression>]
The BSB directive causes the Assembler to allocate and initialize a block of words for a
reverse-carry buffer. The number of words in the block is given by the first expression,
which must evaluate to an absolute integer. Each word is assigned the initial value of the
second expression. If there is no second expression, an initial value of zero is assumed.
If the runtime location counter is not zero, this directive first advances the runtime location
counter to a base address that is a multiple of 2k, where 2k is greater than or equal to the
value of the first expression. An error will occur if the first expression contains symbols
that are not yet defined (forward references) or if the expression has a value of less than
or equal to zero. Also, if the first expression is not a power of two a warning will be generated. Both expressions can have any memory space attribute.
<label>, if present, will be assigned the value of the runtime location counter after a valid
base address has been established.
Only one word of object code will be shown on the listing, regardless of how large the first
expression is. However, the runtime location counter will be advanced by the number of
words generated.
See also: BSC, BSM, DC
EXAMPLE:
BUFFER
6-26
BSB
BUFSIZ
; INITIALIZE BUFFER TO ZEROS
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
BSC
Block Storage of Constant
[<label>]
BSC
<expression>[,<expression>]
The BSC directive causes the Assembler to allocate and initialize a block of words. The
number of words in the block is given by the first expression, which must evaluate to an
absolute integer. Each word is assigned the initial value of the second expression. If
there is no second expression, an initial value of zero is assumed. If the first expression
contains symbols that are not yet defined (forward references) or if the expression has a
value of less than or equal to zero, an error will be generated. Both expressions can have
any memory space attribute.
<label>, if present, will be assigned the value of the runtime location counter at the start
of the directive processing.
Only one word of object code will be shown on the listing, regardless of how large the first
expression is. However, the runtime location counter will be advanced by the number of
words generated.
See also: BSM, BSB, DC
EXAMPLE:
UNUSED
MOTOROLA
BSC
$2FFF-@LCV(R),$FFFFFFFF
; FILL UNUSED EPROM
DSP ASSEMBLER REFERENCE MANUAL
6-27
Assembler Significant Characters And Directives
Assembler Directives
BSM
Block Storage Modulo
[<label>]
BSM
<expression>[,<expression>]
The BSM directive causes the Assembler to allocate and initialize a block of words for a
modulo buffer. The number of words in the block is given by the first expression, which
must evaluate to an absolute integer. Each word is assigned the initial value of the second
expression. If there is no second expression, an initial value of zero is assumed. If the
runtime location counter is not zero, this directive first advances the runtime location
counter to a base address that is a multiple of 2k, where 2k is greater than or equal to the
value of the first expression. An error will occur if the first expression contains symbols
that are not yet defined (forward references), has a value of less than or equal to zero, or
falls outside the range 2 <= <expression> <= m, where m is the maximum address of the
target DSP. Both expressions can have any memory space attribute.
<label>, if present, will be assigned the value of the runtime location counter after a valid
base address has been established.
Only one word of object code will be shown on the listing, regardless of how large the first
expression is. However, the runtime location counter will be advanced by the number of
words generated.
See also: BSC, BSB, DC
EXAMPLE:
BUFFER
6-28
BSM
BUFSIZ,$FFFFFFFF
; INITIALIZE BUFFER TO ALL ONES
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
BUFFER
Start Buffer
BUFFER
<M | R>,<expression>
The BUFFER directive indicates the start of a buffer of the given type. Data is allocated
for the buffer until an ENDBUF directive is encountered. Instructions and most data definition directives may appear between the BUFFER and ENDBUF pair, although BUFFER directives may not be nested and certain types of directives such as MODE, ORG,
SECTION, and other buffer allocation directives may not be used. The <expression> represents the buffer size. If less data is allocated than the size of the buffer, the remaining
buffer locations will be uninitialized. If more data is allocated than the specified size of the
buffer, an error is issued.
The BUFFER directive sets the runtime location counter to the address of a buffer of the
given type, the length of which in words is equal to the value of <expression>. The buffer
type may be either Modulo or Reverse-carry. If the runtime location counter is not zero,
this directive first advances the runtime location counter to a base address that is a multiple of 2k, where 2k >= <expression>. An error will be issued if there is insufficient memory
remaining to establish a valid base address. Unlike other buffer allocation directives, the
runtime location counter is not advanced by the value of the integer expression in the operand field; the location counter remains at the buffer base address.
The result of <expression> may have any memory space attribute but must be an absolute integer greater than zero and cannot contain any forward references (symbols that
have not yet been defined). If a Modulo buffer is specified, the expression must fall within
the range 2 <= <expression> <= m, where m is the maximum address of the target DSP.
If a Reverse-carry buffer is designated and <expression> is not a power of two a warning
will be issued.
A label is not allowed with this directive.
See also: BADDR, BSM, BSB, DSM, DSR, ENDBUF
EXAMPLE:
M_BUF
MOTOROLA
ORG
BUFFER
DC
DS
ENDBUF
X:$100
M,24
0.5,0.5,0.5,0.5
20
; CIRCULAR BUFFER MOD 24
; REMAINDER UNINITIALIZED
DSP ASSEMBLER REFERENCE MANUAL
6-29
Assembler Significant Characters And Directives
Assembler Directives
COBJ
Comment Object File
COBJ
<string>
The COBJ directive is used to place a comment in the object code file. The <string> will
be put in the object file as a comment (refer to the object format description in Appendix
E).
A label is not allowed with this directive.
See also: IDENT
EXAMPLE:
COBJ
6-30
'Start of filter coefficients'
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
COMMENT
Start Comment Lines
COMMENT
.
.
<delimiter>
<delimiter>
The COMMENT directive is used to define one or more lines as comments. The first nonblank character after the COMMENT directive is the comment delimiter. The two delimiters are used to define the comment text. The line containing the second comment delimiter will be considered the last line of the comment. The comment text can include any
printable characters and the comment text will be reproduced in the source listing as it appears in the source file.
A label is not allowed with this directive.
EXAMPLE:
COMMENT
COMMENT
MOTOROLA
+ This is a one line comment +
*
This is a multiple line
comment. Any number of lines
can be placed between the two delimiters.
*
DSP ASSEMBLER REFERENCE MANUAL
6-31
Assembler Significant Characters And Directives
Assembler Directives
DC
Define Constant
[<label>]
DC
<arg>[,<arg>,...,<arg>]
The DC directive allocates and initializes a word of memory for each <arg> argument.
<arg> may be a numeric constant, a single or multiple character string constant, a symbol,
or an expression. The DC directive may have one or more arguments separated by commas. Multiple arguments are stored in successive address locations. If multiple arguments are present, one or more of them can be null (two adjacent commas), in which case
the corresponding address location will be filled with zeros. If the DC directive is used in
L memory, the arguments will be evaluated and stored as long word quantities. Otherwise, an error will occur if the evaluated argument value is too large to represent in a single DSP word.
<label>, if present, will be assigned the value of the runtime location counter at the start
of the directive processing.
Integer arguments are stored as is; floating point numbers are converted to binary values.
Single and multiple character strings are handled in the following manner:
1.
Single character strings are stored in a word whose lower seven bits represent the ASCII value of the character.
EXAMPLE:
'R'
= $000052
2.
Multiple character strings represent words whose bytes are composed of
concatenated sequences of the ASCII representation of the characters in the string
(unless the NOPS option is specified; see the OPT directive). If the number of
characters is not an even multiple of the number of bytes per DSP word, then the
last word will have the remaining characters left aligned and the rest of the word
will be zero-filled. If the NOPS option is given, each character in the string is stored
in a word whose lower seven bits represent the ASCII value of the character.
EXAMPLE:
'ABCD'
=
$414243
$440000
See also: BSC, DCB
EXAMPLE:
TABLE
CHARS
6-32
DC
DC
1426,253,$2662,'ABCD'
'A','B','C','D'
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
DCB
Define Constant Byte
[<label>]
DCB
<arg>[,<arg>,...,<arg>]
The DCB directive allocates and initializes a byte of memory for each <arg> argument.
<arg> may be a byte integer constant, a single or multiple character string constant, a
symbol, or a byte expression. The DCB directive may have one or more arguments separated by commas. Multiple arguments are stored in successive byte locations. If multiple arguments are present, one or more of them can be null (two adjacent commas), in
which case the corresponding byte location will be filled with zeros.
<label>, if present, will be assigned the value of the runtime location counter at the start
of the directive processing.
Integer arguments are stored as is, but must be byte values (e.g. within the range 0-255);
floating point numbers are not allowed. Single and multiple character strings are handled
in the following manner:
1.
Single character strings are stored in a word whose lower seven bits represent the ASCII value of the character.
EXAMPLE:
'R'
= $000052
2.
Multiple character strings represent words whose bytes are composed of
concatenated sequences of the ASCII representation of the characters in the string
(unless the NOPS option is specified; see the OPT directive). If the number of
characters is not an even multiple of the number of bytes per DSP word, then the
last word will have the remaining characters left aligned and the rest of the word
will be zero-filled. If the NOPS option is given, each character in the string is stored
in a word whose lower seven bits represent the ASCII value of the character.
EXAMPLE:
'AB',,'CD'
=
$414200
$434400
See also: BSC, DC
EXAMPLE:
TABLE
CHARS
MOTOROLA
DCB
DCB
'two',0,'strings',0
'A','B','C','D'
DSP ASSEMBLER REFERENCE MANUAL
6-33
Assembler Significant Characters And Directives
Assembler Directives
DEFINE
Define Substitution String
DEFINE
<symbol>
<string>
The DEFINE directive is used to define substitution strings that will be used on all following source lines. All succeeding lines will be searched for an occurrence of <symbol>,
which will be replaced by <string>. This directive is useful for providing better documentation in the source program. <symbol> must adhere to the restrictions for non-local labels. That is, it cannot exceed 512 characters, the first of which must be alphabetic, and
the remainder of which must be either alphanumeric or the underscore(_). A warning will
result if a new definition of a previously defined symbol is attempted. The Assembler output listing will show lines after the DEFINE directive has been applied and therefore redefined symbols will be replaced by their substitution strings (unless the NODXL option in
effect; see the OPT directive).
Macros represent a special case. DEFINE directive translations will be applied to the
macro definition as it is encountered. When the macro is expanded any active DEFINE
directive translations will again be applied.
DEFINE directive symbols that are defined within a section will only apply to that section.
See the SECTION directive.
A label is not allowed with this directive.
See also: UNDEF
EXAMPLE:
If the following DEFINE directive occurred in the first part of the source program:
DEFINE
ARRAYSIZ
'10 * SAMPLSIZ'
then the source line below:
DS
ARRAYSIZ
would be transformed by the Assembler to the following:
DS
6-34
10 * SAMPLSIZ
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
DS
Define Storage
[<label>]
DS
<expression>
The DS directive reserves a block of memory the length of which in words is equal to the
value of <expression>. This directive causes the runtime location counter to be advanced
by the value of the absolute integer expression in the operand field. <expression> can
have any memory space attribute. The block of memory reserved is not initialized to any
value. The expression must be an integer greater than zero and cannot contain any forward references (symbols that have not yet been defined).
<label>, if present, will be assigned the value of the runtime location counter at the start
of the directive processing.
See also: DSM, DSR
EXAMPLE:
S_BUF
MOTOROLA
DS
12
; SAMPLE BUFFER
DSP ASSEMBLER REFERENCE MANUAL
6-35
Assembler Significant Characters And Directives
Assembler Directives
DSM
Define Modulo Storage
[<label>]
DSM
<expression>
The DSM directive reserves a block of memory the length of which in words is equal to
the value of <expression>. If the runtime location counter is not zero, this directive first
advances the runtime location counter to a base address that is a multiple of 2k, where
2k >= <expression>. An error will be issued if there is insufficient memory remaining to establish a valid base address. Next the runtime location counter is advanced by the value
of the integer expression in the operand field. <expression> can have any memory space
attribute. The block of memory reserved is not initialized to any given value. The result of
<expression> must be an absolute integer greater than zero and cannot contain any forward references (symbols that have not yet been defined). The expression also must fall
within the range 2 <= <expression> <= m, where m is the maximum address of the target
DSP.
<label>, if present, will be assigned the value of the runtime location counter after a valid
base address has been established.
See also: DS, DSR
EXAMPLE:
M_BUF
6-36
ORG
DSM
X:$100
24
; CIRCULAR BUFFER MOD 24
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
DSR
Define Reverse Carry Storage
[<label>]
DSR
<expression>
The DSR directive reserves a block of memory the length of which in words is equal to the
value of <expression>. If the runtime location counter is not zero, this directive first advances the runtime location counter to a base address that is a multiple of 2k, where
2k >= <expression>. An error will be issued if there is insufficient memory remaining to
establish a valid base address. Next the runtime location counter is advanced by the value
of the integer expression in the operand field. <expression> can have any memory space
attribute. The block of memory reserved is not initialized to any given value. The result of
<expression> must be an absolute integer greater than zero and cannot contain any forward references (symbols that have not yet been defined). Since the DSR directive is useful mainly for generating FFT buffers, if <expression> is not a power of two a warning will
be generated.
<label>, if present, will be assigned the value of the runtime location counter after a valid
base address has been established.
See also: DS, DSM
EXAMPLE:
R_BUF
MOTOROLA
ORG
DSR
X:$100
8
; REVERSE CARRY BUFFER FOR 16 POINT FFT
DSP ASSEMBLER REFERENCE MANUAL
6-37
Assembler Significant Characters And Directives
Assembler Directives
DUP
Duplicate Sequence of Source Lines
[<label>]
DUP
.
.
ENDM
<expression>
The sequence of source lines between the DUP and ENDM directives will be duplicated
by the number specified by the integer <expression>. <expression> can have any memory space attribute. If the expression evaluates to a number less than or equal to 0, the
sequence of lines will not be included in the Assembler output. The expression result
must be an absolute integer and cannot contain any forward references (symbols that
have not already been defined). The DUP directive may be nested to any level.
<label>, if present, will be assigned the value of the runtime location counter at the start
of the DUP directive processing.
See also: DUPA, DUPC, DUPF, ENDM, MACRO
EXAMPLE:
The sequence of source input statements,
COUNT
SET
DUP
ASR
ENDM
3
COUNT
D0
; ASR BY COUNT
would generate the following in the source listing:
COUNT
6-38
SET
DUP
ASR
ASR
ASR
ENDM
3
COUNT
D0
D0
D0
; ASR BY COUNT
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
Note that the lines
DUP
ENDM
COUNT
;ASR BY COUNT
will only be shown on the source listing if the MD option is enabled. The lines
ASR
ASR
ASR
D0
D0
D0
will only be shown on the source listing if the MEX option is enabled.
See the OPT directive in this chapter for more information on the MD and MEX options.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
6-39
Assembler Significant Characters And Directives
Assembler Directives
DUPA
Duplicate Sequence With Arguments
[<label>]
DUPA
.
.
ENDM
<dummy>,<arg>[<,<arg>,...,<arg>]
The block of source statements defined by the DUPA and ENDM directives will be repeated for each argument. For each repetition, every occurrence of the dummy parameter
within the block is replaced with each succeeding argument string. If the argument string
is a null, then the block is repeated with each occurrence of the dummy parameter removed. If an argument includes an embedded blank or other Assembler-significant character, it must be enclosed with single quotes.
<label>, if present, will be assigned the value of the runtime location counter at the start
of the DUPA directive processing.
See also: DUP, DUPC, DUPF, ENDM, MACRO
EXAMPLE:
If the input source file contained the following statements,
DUPA
DC
ENDM
VALUE,12,32,34
VALUE
then the assembled source listing would show
DUPA
DC
DC
DC
ENDM
6-40
VALUE,12,32,34
12
32
34
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
Note that the lines
DUPA
ENDM
VALUE,12,32,34
will only be shown on the source listing if the MD option is enabled. The lines
DC
DC
DC
12
32
34
will only be shown on the source listing if the MEX option is enabled.
See the OPT directive in this chapter for more information on the MD and MEX options.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
6-41
Assembler Significant Characters And Directives
Assembler Directives
DUPC
Duplicate Sequence With Characters
[<label>]
DUPC
.
.
ENDM
<dummy>,<string>
The block of source statements defined by the DUPC and ENDM directives will be repeated for each character of <string>. For each repetition, every occurrence of the dummy
parameter within the block is replaced with each succeeding character in the string. If the
string is null, then the block is skipped.
<label>, if present, will be assigned the value of the runtime location counter at the start
of the DUPC directive processing.
See also: DUP, DUPA, DUPF, ENDM, MACRO
EXAMPLE:
If input source file contained the following statements,
DUPC
DC
ENDM
VALUE,'123'
VALUE
then the assembled source listing would show:
DUPC
DC
DC
DC
ENDM
VALUE,'123'
1
2
3
Note that the lines
DUPC
ENDM
VALUE,'123'
will only be shown on the source listing if the MD option is enabled. The lines
DC
DC
DC
1
2
3
will only be shown on the source listing if the MEX option is enabled.
See the OPT directive in this chapter for more information on the MD and MEX options.
6-42
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
DUPF
Duplicate Sequence In Loop
[<label>]
DUPF
.
.
ENDM
<dummy>,[<start>],<end>[,<increment>]
The block of source statements defined by the DUPF and ENDM directives will be repeated in general (<end> - <start>) + 1 times when <increment> is 1. <start> is the starting
value for the loop index; <end> represents the final value. <increment> is the increment
for the loop index; it defaults to 1 if omitted (as does the <start> value). The <dummy>
parameter holds the loop index value and may be used within the body of instructions.
<label>, if present, will be assigned the value of the runtime location counter at the start
of the DUPF directive processing.
See also: DUP, DUPA, DUPC, ENDM, MACRO
EXAMPLE:
If input source file contained the following statements,
DUPF
MOVE
ENDM
NUM,0,7
#0,R\NUM
then the assembled source listing would show:
DUPF
MOVE
MOVE
MOVE
MOVE
MOVE
MOVE
MOVE
MOVE
ENDM
MOTOROLA
NUM,0,7
#0,R0
#0,R1
#0,R2
#0,R3
#0,R4
#0,R5
#0,R6
#0,R7
DSP ASSEMBLER REFERENCE MANUAL
6-43
Assembler Significant Characters And Directives
Assembler Directives
Note that the lines
DUPF
ENDM
NUM,0,7
will only be shown on the source listing if the MD option is enabled. The lines
MOVE
MOVE
MOVE
MOVE
MOVE
MOVE
MOVE
MOVE
#0,R0
#0,R1
#0,R2
#0,R3
#0,R4
#0,R5
#0,R6
#0,R7
will only be shown on the source listing if the MEX option is enabled.
See the OPT directive in this chapter for more information on the MD and MEX options.
6-44
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
END
End of Source Program
END
[<expression>]
The optional END directive indicates that the logical end of the source program has been
encountered. Any statements following the END directive are ignored. The optional expression in the operand field can be used to specify the starting execution address of the
program. <expression> may be absolute or relocatable, but must have a memory space
attribute of Program or None. The END directive cannot be used in a macro expansion.
A label is not allowed with this directive.
EXAMPLE:
END
MOTOROLA
BEGIN
; BEGIN is the starting execution address
DSP ASSEMBLER REFERENCE MANUAL
6-45
Assembler Significant Characters And Directives
Assembler Directives
ENDBUF
End Buffer
ENDBUF
The ENDBUF directive is used to signify the end of a buffer block. The runtime location
counter will remain just beyond the end of the buffer when the ENDBUF directive is encountered.
A label is not allowed with this directive.
See also: BUFFER
EXAMPLE:
BUF
6-46
ORG
BUFFER
ENDBUF
X:$100
R,64
; uninitialized reverse-carry buffer
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
ENDIF
End of Conditional Assembly
ENDIF
The ENDIF directive is used to signify the end of the current level of conditional assembly.
Conditional assembly directives can be nested to any level, but the ENDIF directive always refers to the most previous IF directive.
A label is not allowed with this directive.
See also: IF
EXAMPLE:
SAVEPC
MOTOROLA
IF
SET
ENDIF
@REL()
*
; Save current program counter
DSP ASSEMBLER REFERENCE MANUAL
6-47
Assembler Significant Characters And Directives
Assembler Directives
ENDM
End of Macro Definition
ENDM
Every MACRO, DUP, DUPA, and DUPC directive must be terminated by an ENDM directive.
A label is not allowed with this directive.
See also: DUP, DUPA, DUPC, MACRO
EXAMPLE:
SWAP_SYM
6-48
MACRO
MOVE
MOVE
MOVE
ENDM
REG1,REG
;swap REG1,REG2 using D4.L as temp
R\?REG1,D4.L
R\?REG2,R\?REG1
D4.L,R\?REG2
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
ENDSEC
End Section
ENDSEC
Every SECTION directive must be terminated by an ENDSEC directive.
A label is not allowed with this directive.
See also: SECTION
EXAMPLE:
VALUES
MOTOROLA
SECTION COEFF
ORG
Y:
BSC
$100
ENDSEC
; Initialize to zero
DSP ASSEMBLER REFERENCE MANUAL
6-49
Assembler Significant Characters And Directives
Assembler Directives
EQU
Equate Symbol to a Value
<label>
EQU [{X: | Y: | L: | P: | E:}]<expression>
The EQU directive assigns the value and memory space attribute of <expression> to the
symbol <label>. If <expression> has a memory space attribute of None, then it can optionally be preceded by any of the indicated memory space qualifiers to force a memory
space attribute. An error will occur if the expression has a memory space attribute other
than None and it is different than the forcing memory space attribute. The optional forcing
memory space attribute is useful to assign a memory space attribute to an expression that
consists only of constants but is intended to refer to a fixed address in a memory space.
The EQU directive is one of the directives that assigns a value other than the program
counter to the label. The label cannot be redefined anywhere else in the program (or section, if SECTION directives are being used). The <expression> may be relative or absolute, but cannot include a symbol that is not yet defined (no forward references are
allowed).
See also: SET
EXAMPLE:
A_D_PORT EQU
X:$4000
This would assign the value $4000 with a memory space attribute of X to the symbol
A_D_PORT.
COMPUTE
EQU
@LCV(L)
@LCV(L) is used to refer to the value and memory space attribute of the load location
counter. This value and memory space attribute would be assigned to the symbol COMPUTE.
6-50
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
EXITM
Exit Macro
EXITM
The EXITM directive will cause immediate termination of a macro expansion. It is useful
when used with the conditional assembly directive IF to terminate macro expansion when
error conditions are detected.
A label is not allowed with this directive.
See also: DUP, DUPA, DUPC, MACRO
EXAMPLE:
CALC
MOTOROLA
MACRO
IF
FAIL
EXITM
ENDIF
.
.
.
ENDM
XVAL,YVAL
XVAL<0
'Macro parameter value out of range'
; Exit macro
DSP ASSEMBLER REFERENCE MANUAL
6-51
Assembler Significant Characters And Directives
Assembler Directives
FAIL
Programmer Generated Error
FAIL
[{<str>|<exp>}[,{<str>|<exp>},...,{<str>|<exp>}]]
The FAIL directive will cause an error message to be output by the Assembler. The total
error count will be incremented as with any other error. The FAIL directive is normally
used in conjunction with conditional assembly directives for exceptional condition checking. The assembly proceeds normally after the error has been printed. An arbitrary number of strings and expressions, in any order but separated by commas with no intervening
white space, can be specified optionally to describe the nature of the generated error.
A label is not allowed with this directive.
See also: MSG, WARN
EXAMPLE:
FAIL
6-52
'Parameter out of range'
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
FORCE
Set Operand Forcing Mode
FORCE
{SHORT | LONG | NONE}
The FORCE directive causes the Assembler to force all immediate, memory, and address
operands to the specified mode as if an explicit forcing operator were used. Note that if
a relocatable operand value forced short is determined to be too large for the instruction
word, an error will occur at link time, not during assembly. Explicit forcing operators override the effect of this directive.
A label is not allowed with this directive.
See also: <, >, #<, #>
EXAMPLE:
FORCE
MOTOROLA
SHORT
; force operands short
DSP ASSEMBLER REFERENCE MANUAL
6-53
Assembler Significant Characters And Directives
Assembler Directives
GLOBAL
Global Section Symbol Declaration
GLOBAL
<symbol>[,<symbol>,...,<symbol>]
The GLOBAL directive is used to specify that the list of symbols is defined within the current section, and that those definitions should be accessible by all sections. This directive
is only valid if used within a program block bounded by the SECTION and ENDSEC directives. If the symbols that appear in the operand field are not defined in the section, an
error will be generated.
A label is not allowed with this directive.
See also: SECTION, XDEF, XREF
EXAMPLE:
SECTION
GLOBAL
.
.
.
ENDSEC
6-54
IO
LOOPA
; LOOPA will be globally accessible by other sections
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
GSET
Set Global Symbol to a Value
<label>
GSET
<expression>
GSET
<label>
<expression>
The GSET directive is used to assign the value of the expression in the operand field to
the label. The GSET directive functions somewhat like the EQU directive. However, labels
defined via the GSET directive can have their values redefined in another part of the program (but only through the use of another GSET or SET directive). The GSET directive is
useful for resetting a global SET symbol within a section, where the SET symbol would
otherwise be considered local. The expression in the operand field of a GSET must be
absolute and cannot include a symbol that is not yet defined (no forward references are
allowed).
See also: EQU, SET
EXAMPLE:
COUNT
MOTOROLA
GSET
0
; INITIALIZE COUNT
DSP ASSEMBLER REFERENCE MANUAL
6-55
Assembler Significant Characters And Directives
Assembler Directives
HIMEM
Set High Memory Bounds
HIMEM
<mem>[<rl>]:<expression>[,...]
The HIMEM directive establishes an absolute high memory bound for code and data generation. <mem> corresponds to one of the DSP memory spaces (X, Y, L, P, E). <rl> is one
of the letters R for runtime counter or L for load counter. The <expression> is an absolute
integer value within the address range of the machine. If during assembly the specified
location counter exceeds the value given by <expression>, a warning is issued.
A label is not allowed with this directive.
See also: LOMEM
EXAMPLE:
HIMEM
BOUNDS
6-56
XR:$7FFF,YR:$7FFF
; SET X/Y RUN HIGH MEM
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
IDENT
Object Code Identification Record
[<label>]
IDENT
<expression1>,<expression2>
The IDENT directive is used to create an identification record for the object module. If <label> is specified, it will be used as the module name. If <label> is not specified, then the
filename of the source input file is used as the module name. <expression1> is the version number; <expression2> is the revision number. The two expressions must each
evaluate to an integer result. The comment field of the IDENT directive will also be passed
on to the object module.
See also: COBJ
EXAMPLE:
If the following line was included in the source file,
FFILTER
IDENT
1,2
; FIR FILTER MODULE
then the object module identification record would include the module name (FFILTER),
the version number (1), the revision number (2), and the comment field (; FIR FILTER
MODULE).
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
6-57
Assembler Significant Characters And Directives
Assembler Directives
IF
Conditional Assembly Directive
IF
.
.
[ELSE]
.
.
ENDIF
<expression>
(the ELSE directive is optional)
Part of a program that is to be conditionally assembled must be bounded by an IF-ENDIF
directive pair. If the optional ELSE directive is not present, then the source statements
following the IF directive and up to the next ENDIF directive will be included as part of the
source file being assembled only if the <expression> has a nonzero result. If the <expression> has a value of zero, the source file will be assembled as if those statements between the IF and the ENDIF directives were never encountered. If the ELSE directive is
present and <expression> has a nonzero result, then the statements between the IF and
ELSE directives will be assembled, and the statements between the ELSE and ENDIF directives will be skipped. Alternatively, if <expression> has a value of zero, then the statements between the IF and ELSE directives will be skipped, and the statements between
the ELSE and ENDIF directives will be assembled.
The <expression> must have an absolute integer result and is considered true if it has a
nonzero result. The <expression> is false only if it has a result of 0. Because of the nature
of the directive, <expression> must be known on pass one (no forward references allowed). IF directives can be nested to any level. The ELSE directive will always refer to
the nearest previous IF directive as will the ENDIF directive.
A label is not allowed with this directive.
See also: ENDIF
EXAMPLE:
IF
@LST>0
DUP
@LST
NOLIST
ENDM
ENDIF
6-58
; Unwind LIST directive stack
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
INCLUDE
Include Secondary File
INCLUDE
<string> | <<string>>
This directive is inserted into the source program at any point where a secondary file is to
be included in the source input stream. The string specifies the filename of the secondary
file. The filename must be compatible with the operating system and can include a directory specification. If no extension is given for the filename, a default extension of .ASM is
supplied.
The file is searched for first in the current directory, unless the <<string>> syntax is used,
or in the directory specified in <string>. If the file is not found, and the -I option was used
on the command line that invoked the Assembler, then the string specified with the -I option is prefixed to <string> and that directory is searched. If the <<string>> syntax is given,
the file is searched for only in the directories specified with the -I option. Refer to Chapter
1, Running The Assembler.
A label is not allowed with this directive.
See also: MACLIB
EXAMPLE:
MOTOROLA
INCLUDE 'headers/io.asm'
; Unix example
INCLUDE 'storage\mem.asm'
; MS-DOS example
INCLUDE <data.asm>
; Do not look in current directory
DSP ASSEMBLER REFERENCE MANUAL
6-59
Assembler Significant Characters And Directives
Assembler Directives
LIST
List the Assembly
LIST
Print the listing from this point on. The LIST directive will not be printed, but the subsequent source lines will be output to the source listing. The default is to print the source
listing. If the IL option has been specified, the LIST directive has no effect when encountered within the source program.
The LIST directive actually increments a counter that is checked for a positive value and
is symmetrical with respect to the NOLIST directive. Note the following sequence:
; Counter value currently 1
LIST
LIST
NOLIST
NOLIST
; Counter value = 2
; Counter value = 3
; Counter value = 2
; Counter value = 1
The listing still would not be disabled until another NOLIST directive was issued.
A label is not allowed with this directive.
See also: NOLIST, OPT
EXAMPLE:
IF
LIST
ENDIF
6-60
LISTON
; Turn the listing back on
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
LOCAL
Local Section Symbol Declaration
LOCAL
<symbol>[,<symbol>,...,<symbol>]
The LOCAL directive is used to specify that the list of symbols is defined within the current
section, and that those definitions are explicitly local to that section. It is useful in cases
where a symbol is used as a forward reference in a nested section where the enclosing
section contains a like-named symbol. This directive is only valid if used within a program
block bounded by the SECTION and ENDSEC directives. The LOCAL directive must appear before <symbol> is defined in the section. If the symbols that appear in the operand
field are not defined in the section, an error will be generated.
A label is not allowed with this directive.
See also: SECTION, XDEF, XREF
EXAMPLE:
SECTION
LOCAL
.
.
.
ENDSEC
MOTOROLA
IO
LOOPA
; LOOPA local to this section
DSP ASSEMBLER REFERENCE MANUAL
6-61
Assembler Significant Characters And Directives
Assembler Directives
LOMEM
Set Low Memory Bounds
LOMEM
<mem>[<rl>]:<expression>[,...]
The LOMEM directive establishes an absolute low memory bound for code and data generation. <mem> corresponds to one of the DSP memory spaces (X, Y, L, P, E). <rl> is one
of the letters R for runtime counter or L for load counter. The <expression> is an absolute
integer value within the address range of the machine. If during assembly the specified
location counter falls below the value given by <expression>, a warning is issued.
A label is not allowed with this directive.
See also: HIMEM
EXAMPLE:
LOMEM
6-62
XR:$100,YR:$100 ; SET X/Y RUN LOW MEM BOUNDS
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
LSTCOL
Set Listing Field Widths
LSTCOL [<labw>[,<opcw>[,<oprw>[,<opc2w>[,<opr2w>[,<xw>[,<yw>]]]]]]]
Sets the width of the output fields in the source listing. Widths are specified in terms of
column positions. The starting position of any field is relative to its predecessor except for
the label field, which always starts at the same position relative to page left margin, program counter value, and cycle count display. The widths may be expressed as any positive absolute integer expression. However, if the width is not adequate to accommodate
the contents of a field, the text is separated from the next field by at least one space.
Any field for which the default is desired may be null. A null field can be indicated by two
adjacent commas with no intervening space or by omitting any trailing fields altogether. If
the LSTCOL directive is given with no arguments all field widths are reset to their default
values.
A label is not allowed with this directive.
See also: PAGE
EXAMPLE:
LSTCOL
MOTOROLA
40,,,,,20,20
; Reset label, X, and Y data field widths
DSP ASSEMBLER REFERENCE MANUAL
6-63
Assembler Significant Characters And Directives
Assembler Directives
MACLIB
Macro Library
MACLIB
<pathname>
This directive is used to specify the <pathname> (as defined by the operating system) of
a directory that contains macro definitions. Each macro definition must be in a separate
file, and the file must be named the same as the macro with the extension .ASM added.
For example, BLOCKMV.ASM would be a file that contained the definition of the macro
called BLOCKMV.
If the Assembler encounters a directive in the operation field that is not contained in the
directive or mnemonic tables, the directory specified by <pathname> will be searched for
a file of the unknown name (with the .ASM extension added). If such a file is found, the
current source line will be saved, and the file will be opened for input as an INCLUDE file.
When the end of the file is encountered, the source line is restored and processing is resumed. Because the source line is restored, the processed file must have a macro definition of the unknown directive name, or else an error will result when the source line is
restored and processed. However, the processed file is not limited to macro definitions,
and can include any legal source code statements.
Multiple MACLIB directives may be given, in which case the Assembler will search each
directory in the order in which it is encountered.
A label is not allowed with this directive.
See also: INCLUDE
EXAMPLE:
MACLIB 'macros\mymacs\'
MACLIB 'fftlib/'
6-64
; IBM PC example
; UNIX example
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
MACRO
Macro Definition
<label>
MACRO [<dummy argument list>]
.
.
<macro definition statements>
.
.
ENDM
The dummy argument list has the form:
[<dumarg>[,<dumarg>,...,<dumarg>]]
The required label is the symbol by which the macro will be called. If the macro is named
the same as an existing Assembler directive or mnemonic, a warning will be issued. This
warning can be avoided with the RDIRECT directive.
The definition of a macro consists of three parts: the header, which assigns a name to the
macro and defines the dummy arguments; the body, which consists of prototype or skeleton source statements; and the terminator. The header is the MACRO directive, its label,
and the dummy argument list. The body contains the pattern of standard source statements. The terminator is the ENDM directive.
The dummy arguments are symbolic names that the macro processor will replace with arguments when the macro is expanded (called). Each dummy argument must obey the
same rules as symbol names. Dummy argument names that are preceded by an underscore are not allowed. Within each of the three dummy argument fields, the dummy arguments are separated by commas. The dummy argument fields are separated by one
or more blanks.
Macro definitions may be nested but the nested macro will not be defined until the primary
macro is expanded.
Chapter 5 contains a complete description of macros.
See also: DUP, DUPA, DUPC, DUPF, ENDM
EXAMPLE:
SWAP_SYM
MOTOROLA
MACRO
MOVE
MOVE
MOVE
ENDM
REG1,REG2
;swap REG1,REG2 using X0 as temp
R\?REG1,X0
R\?REG2,R\?REG1
X0,R\?REG2
DSP ASSEMBLER REFERENCE MANUAL
6-65
Assembler Significant Characters And Directives
Assembler Directives
MODE
Change Relocation Mode
MODE
<ABS[OLUTE] | REL[ATIVE]>
Causes the Assembler to change to the designated operational mode. The MODE directive may be given at any time in the assembly source to alter the set of location counters
used for section addressing. Code generated while in absolute mode will be placed in
memory at the location determined during assembly. Relocatable code and data are
based from the enclosing section start address. The MODE directive has no effect when
the command line -A option is issued. See Chapter 4 for more information on modes, sections, and relocation.
A label is not allowed with this directive.
See also: ORG
EXAMPLE:
MODE
6-66
ABS
; Change to absolute mode
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
MSG
Programmer Generated Message
MSG
[{<str>|<exp>}[,{<str>|<exp>},...,{<str>|<exp>}]]
The MSG directive will cause a message to be output by the Assembler. The error and
warning counts will not be affected. The MSG directive is normally used in conjunction
with conditional assembly directives for informational purposes. The assembly proceeds
normally after the message has been printed. An arbitrary number of strings and expressions, in any order but separated by commas with no intervening white space, can be
specified optionally to describe the nature of the message.
A label is not allowed with this directive.
See also: FAIL, WARN
EXAMPLE:
MSG
MOTOROLA
'Generating sine tables'
DSP ASSEMBLER REFERENCE MANUAL
6-67
Assembler Significant Characters And Directives
Assembler Directives
NOLIST
Stop Assembly Listing
NOLIST
Do not print the listing from this point on (including the NOLIST directive). Subsequent
source lines will not be printed.
The NOLIST directive actually decrements a counter that is checked for a positive value
and is symmetrical with respect to the LIST directive. Note the following sequence:
; Counter value currently 1
LIST
LIST
NOLIST
NOLIST
; Counter value = 2
; Counter value = 3
; Counter value = 2
; Counter value = 1
The listing still would not be disabled until another NOLIST directive was issued.
A label is not allowed with this directive.
See also: LIST, OPT
EXAMPLE:
IF
LISTOFF
NOLIST
ENDIF
6-68
; Turn the listing off
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
OPT
Assembler Options
OPT
<option>[,<option>,...,<option>]
[<comment>]
The OPT directive is used to designate the Assembler options. Assembler options are given in the operand field of the source input file and are separated by commas. Options also
may be specified using the command line -O option (see Chapter 1). All options have a
default condition. Some options are reset to their default condition at the end of pass one.
Some are allowed to have the prefix NO attached to them, which then reverses their
meaning.
Options can be grouped by function into five different types:
1.
2.
3.
4.
5.
Listing format control
Reporting options
Message control
Symbol options
Assembler operation
Listing Format Control
These options control the format of the listing file:
FC
FF
FM
PP
RC
MOTOROLA
- Fold trailing comments
- Form feeds for page ejects
- Format messages
- Pretty print listing
- Relative comment spacing
DSP ASSEMBLER REFERENCE MANUAL
6-69
Assembler Significant Characters And Directives
Assembler Directives
Reporting Options
These options control what is reported in the listing file:
CC
CEX
CL
CM
CONTC
CRE
DXL
HDR
IL
LOC
MC
MD
MEX
MU
NL
S
U
- Enable cycle counts
- Print DC expansions
- Print conditional assembly directives
- Preserve comment lines within macros
- Continue cycle counts
- Print symbol cross-reference
- Expand DEFINE directive strings in listing
- Generate listing headers
- Inhibit source listing
- Print local labels in cross-reference
- Print macro calls
- Print macro definitions
- Print macro expansions
- Print memory utilization report
- Print conditional assembly and section nesting levels
- Print symbol table
- Print skipped conditional assembly lines
Message Control
These options control the types of Assembler messages that are generated:
AE
IDW
MSW
NDE
UR
W
6-70
- Check address expressions
- Warn on pipeline stalls
- Warn on memory space incompatibilities
- Warn on DALU pipeline interlocks
- Flag unresolved references
- Display warning messages
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
Symbol Options
These options deal with the handling of symbols by the Assembler:
CONST
DEX
GL
GS
IC
NS
SCL
SCO
SMS
SO
XLL
XR
- Make EQU symbols assembly time constants
- Expand DEFINE symbols within quoted strings
- Make all section symbols global
- Make all sections global static
- Ignore case in symbol names
- Support symbol scoping in nested sections
- Scope structured control statement labels
- Structured control statement labels to listing/object file
- Preserve memory space in SET symbols
- Write symbols to object file
- Write local labels to object file
- Recognize XDEFed symbols without XREF
Assembler Operation
Miscellaneous options having to do with internal Assembler operation:
AL
CK
CONTCK
DBL
DLD
EM
INTR
LB
LBX
LDB
MI
PS
PSB
PSM
RP
RSV
SBM
SI
SVO
MOTOROLA
- Align load counter in overlay buffers
- Enable checksumming
- Continue checksumming
- Split dual read instructions
- Do not restrict directives in loops
- Emulate 56100 instructions on the 56800
- Perform interrupt location checks
- Byte increment load counter
- Split load words into bytes
- Listing file debug
- Scan MACLIB directories for include files
- Pack strings
- Preserve sign bit in negative operands
- Programmable short addressing mode
- Generate NOP to accommodate pipeline delay
- Check reserve data memory locations
- Sixteen bit mode support
- Interpret short immediate as long or sign extended
- Preserve object file on errors
DSP ASSEMBLER REFERENCE MANUAL
6-71
Assembler Significant Characters And Directives
Assembler Directives
Following are descriptions of the individual options. The parenthetical inserts specify default if the option is the default condition, and reset if the option is reset to its default state
at the end of pass one.
A label is not allowed with this directive.
AE
(default, reset) Check address expressions for appropriate arithmetic operations. For example, this will check that only valid add or subtract operations
are performed on address terms.
AL
(default, reset) Align load counter in overlay buffers.
CC
Enable cycle counts and clear total cycle count. Cycle counts will be shown
on the output listing for each instruction. Cycle counts assume a full instruction fetch pipeline and no wait states.
CEX
Print DC expansions.
CK
Enable checksumming of instruction and data values and clear cumulative
checksum. The checksum value can be obtained using the @CHK() function
(see Chapter 3).
CL
(default, reset) Print the conditional assembly directives.
CM
(default, reset) Preserve comment lines of macros when they are defined.
Note that any comment line within a macro definition that starts with two consecutive semicolons (;;) is never preserved in the macro definition.
CONST
EQU symbols are maintained as assembly time constants and will not be sent
to the object file.
CONTC
Re-enable cycle counts. Does not clear total cycle counts. The cycle count
for each instruction will be shown on the output listing.
CONTCK Re-enable checksumming of instructions and data. Does not clear cumulative checksum value.
CRE
Print a cross reference table at the end of the source listing. This option, if
used, must be specified before the first symbol in the source program is defined.
DBL
(DSP56800 only) Split dual read instructions.
DEX
Expand DEFINE symbols within quoted strings. Can also be done on a caseby-case basis using double-quoted strings.
DLD
Do not restrict directives in DO loops. The presence of some directives in DO
loops does not make sense, including some OPT directive variations. This option suppresses errors on particular directives in loops.
DXL
(default, reset) Expand DEFINE directive strings in listing.
6-72
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
EM
(DSP56800 only) Used when it is necessary to emulate 56100 instructions.
This option must be used in order to use the following 56100 instructions in
the 56800 part: ASR16, IMAC, NEGW, TFR2, SUBL and SWAP.
FC
Fold trailing comments. Any trailing comments that are included in a source
line will be folded underneath the source line and aligned with the opcode
field. Lines that start with the comment character will be aligned with the label
field in the source listing. The FC option is useful for displaying the source
listing on 80 column devices.
FF
Use form feeds for page ejects in the listing file.
FM
Format Assembler messages so that the message text is aligned and broken
at word boundaries.
GL
Make all section symbols global. This has the same effect as declaring every
section explicitly GLOBAL. This option must be given before any sections are
defined explicitly in the source file.
GS
(default, reset in absolute mode) Make all sections global static. All section
counters and attributes will be associated with the GLOBAL section. This option must be given before any sections are defined explicitly in the source file.
HDR
(default, reset) Generate listing header along with titles and subtitles.
IC
Ignore case in symbol, section, and macro names. This directive must be issued before any symbols, sections, or macros are defined.
IDW
(DSP56300 only) (default, reset) Generate warning on instruction delays due
to pipeline stalls.
IL
Inhibit source listing. This option will stop the Assembler from producing a
source listing.
INTR
(default, reset in absolute mode) Perform interrupt location checks. Certain
DSP instructions may not appear in the interrupt vector locations in program
memory. This option enables the Assembler to check for these instructions
when the program counter is within the interrupt vector bounds.
LB
Increment load counter (if different from runtime) by number of bytes in DSP
word to provide byte-wide support for overlays in bootstrap mode. This option
must appear before any code or data generation.
LBX
Split overlay load words into bytes and increment load counter by bytes. This
option facilitates debugging of custom boot code. It must appear prior to any
code or data generation.
LDB
Use the listing file as the debug source file rather than the assembly language
file. The -L command line option to generate a listing file must be specified for
this option to take effect.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
6-73
Assembler Significant Characters And Directives
Assembler Directives
LOC
Include local labels in the symbol table and cross-reference listing. Local labels are not normally included in these listings. If neither the S or CRE options
are specified, then this option has no effect. The LOC option must be specified before the first symbol is encountered in the source file.
MC
(default, reset) Print macro calls.
MD
(default, reset) Print macro definitions.
MEX
Print macro expansions.
MI
Scan MACLIB directory paths for include files. The Assembler ordinarily
looks for included files only in the directory specified in the INCLUDE directory
or in the paths given by the -I command line option. If the MI option is used
the Assembler will also look for included files in any designated MACLIB directories.
MSW
(default, reset) Issue warning on memory space incompatibilities.
MU
Include a memory utilization report in the source listing. This option must appear before any code or data generation.
NDE
(DSP56300 only) (default, reset) This is used to check for DALU pipeline interlocks. It flags all interlocks that occur as a result of using the accumulator
register as a destination in previous instructions.
NL
Display conditional assembly (IF-ELSE-ENDIF) and section nesting levels on
listing.
NOAE
Do not check address expressions.
NOAL
Do not align load counter in overlay buffers.
NOCC
(default, reset) Disable cycle counts. Does not clear total cycle count.
NOCEX
(default, reset) Do not print DC expansions.
NOCK
(default, reset) Disable checksumming of instruction and data values.
NOCL
Do not print the conditional assembly directives.
NOCM
Do not preserve comment lines of macros when they are defined.
NOCONST (default, reset) EQU symbols are exported to the object file.
NODBL
(DSP56800 only) (default, reset) Do not split dual read instructions.
NODEX
(default, reset) Do not expand DEFINE symbols within quoted strings.
NODLD
(default, reset) Restrict use of certain directives in DO loop.
NODXL
Do not expand DEFINE directive strings in listing.
6-74
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
NOEM
(DSP56800 only) (default, reset) Do not emulate 56100 instructions.
NOFC
(default, reset) Inhibit folded comments.
NOFF
(default, reset) Use multiple line feeds for page ejects in the listing file.
NOFM
(default, reset) Do not format Assembler messages.
NOGS
(default, reset in relative mode) Do not make all sections global static.
NOHDR
Do not generate listing header. This also turns off titles and subtitles.
NOIDW
(DSP56300 only) Do not generate warnings on pipeline stalls.
NOINTR
(default, reset in relative mode) Do not perform interrupt location checks.
NOMC
Do not print macro calls.
NOMD
Do not print macro definitions.
NOMEX
(default, reset) Do not print macro expansions.
NOMI
(default, reset) Do not scan MACLIB directory paths for include files.
NOMSW
Do not issue warning on memory space incompatibilities.
NONDE
(DSP56300 only) Do not flag DALU pipeline interlocks.
NONL
(default, reset) Do not display nesting levels on listing.
NONS
Do not allow scoping of symbols within nested sections.
NOPP
Do not pretty print listing file. Source lines are sent to the listing file as they
are encountered in the source, with the exception that tabs are expanded to
spaces and continuation lines are concatenated into a single physical line for
printing.
NOPS
Do not pack strings in DC directive. Individual bytes in strings will be stored
one byte per word.
NOPSB
Do not preserve sign bit in twos-complement negative operands.
NOPSM
(DSP56166 only) (default, reset) Do not allow programmable short addressing.
NORC
(default, reset) Do not space comments relatively.
NORP
(default, reset) Do not generate instructions to accommodate pipeline delay.
NORSV
(DSP96000 only) (default, reset) Do not perform reserve memory checks.
NOSCL
Do not maintain the current local label scope when a structured control statement label is encountered.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
6-75
Assembler Significant Characters And Directives
Assembler Directives
NOSI
(DSP56000 only) (default, reset) Interpret an eight-bit short immediate value
moved to a fractional register as a short unless forced long.
(DSP56100 only) (default, reset) Do not interpret eighth bit of short immediate
value as implied sign extension.
NOSMS
Do not preserve memory space in SET symbols.
NOU
(default, reset) Do not print the lines excluded from the assembly due to a conditional assembly directive.
NOUR
(default, reset) Do not flag unresolved external references.
NOW
Do not print warning messages.
NS
(default, reset) Allow scoping of symbols within nested sections.
PP
(default, reset) Pretty print listing file. The Assembler attempts to align fields
at a consistent column position without regard to source file formatting.
PS
(default, reset) Pack strings in DC directive. Individual bytes in strings will be
packed into consecutive target words for the length of the string.
PSB
(default, reset) Preserve sign bit in twos-complement negative operands.
PSM
(DSP56100 only) Allow programmable short addressing, disabling short and
I/O short address checking.
RC
Space comments relatively in listing fields. By default, the Assembler always
places comments at a consistent column position in the listing file. This option
allows the comment field to float: on a line containing only a label and opcode,
the comment would begin in the operand field.
RP
Generate NOP instructions to accommodate pipeline delay. If an address
register is loaded in one instruction then the contents of the register is not
available for use as a pointer until after the next instruction. Ordinarily when
the Assembler detects this condition it issues an error message. The RP option will cause the Assembler to output a NOP instruction into the output
stream instead of issuing an error.
RSV
(DSP96000 only) Perform location counter checks to insure code/data is not
located in DSP96000 reserve data memory locations. The Assembler will issue a warning if the program counter value falls within the reserved range.
S
Print symbol table at the end of the source listing. This option has no effect if
the CRE option is used.
SBM
(DSP56300 only) Supports 16 bit mode operation for the 56300 when used in
such a mode. This option ensures that in evaluations of fractional values the
6-76
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
upper 16 bits are considered rather than the lower 16 bits. Not using this option does not preclude the use of the 16 bit mode in the 56300.
SCL
(default, reset) Structured control statements generate non-local labels that
ordinarily are not visible to the programmer. This can create problems when
local labels are interspersed among structured control statements. This option causes the Assembler to maintain the current local label scope when a
structured control statement label is encountered.
SCO
Send structured control statement labels to object and listing files. Normally
the Assembler does not externalize these labels. This option must appear before any symbol definition.
SI
(DSP56000 only) Interpret an eight-bit short immediate value moved to a fractional register as a long unless forced short.
(DSP56100 only) Interpret eighth bit of short immediate as implied sign extension.
SMS
(default, reset) Preserve memory space in SET symbols.
SO
Write symbol information to object file. This option is recognized but performs
no operation in COFF Assemblers.
SVO
Preserve object file on errors. Normally any object file produced by the Assembler is deleted if errors occur during assembly. This option must be given
before any code or data is generated.
U
Print the unassembled lines skipped due to failure to satisfy the condition of a
conditional assembly directive.
UR
Generate a warning at assembly time for each unresolved external reference.
This option works only in relocatable mode.
W
(default, reset) Print all warning messages.
WEX
Add warning count to exit status. Ordinarily the Assembler exits with a count
of errors. This option causes the count of warnings to be added to the error
count.
XLL
Write underscore local labels to object file. This is primarily used to aid debugging. This option, if used, must be specified before the first symbol in the
source program is defined.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
6-77
Assembler Significant Characters And Directives
Assembler Directives
XR
Causes XDEFed symbols to be recognized within other sections without being XREFed. This option, if used, must be specified before the first symbol in
the source program is encountered.
EXAMPLE:
OPT
OPT
6-78
CEX,MEX
CRE,MU
; Turn on DC and macro expansions
; Cross reference, memory utilization
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
ORG
Initialize Memory Space and Location Counters
ORG
<rms>[<rlc>][<rmp>]:[<exp1>][,<lms>[<llc>][<lmp>]:[<exp2>]]
ORG
<rms>[<rmp>][(<rce>)]:[<exp1>][,<lms>[<lmp>][(<lce>)]:[<exp2>]]
The ORG directive is used to specify addresses and to indicate memory space and mapping changes. It also can designate an implicit counter mode switch in the Assembler and
serves as a mechanism for initiating overlays.
A label is not allowed with this directive.
<rms>
Which memory space (X, Y, L, P, or E) will be used as the runtime memory
space. If the memory space is L, any allocated datum with a value greater
than the target word size will be extended to two words; otherwise, it is truncated. If the memory space is E, then depending on the memory space qualifier, any generated words will be split into bytes, one byte per word, or a 16/
8-bit combination.
<rlc>
Which runtime counter H, L, or default (if neither H or L is specified), that is
associated with the <rms> will be used as the runtime location counter.
<rmp>
Indicates the runtime physical mapping to DSP memory: I - internal, E - external, R - ROM, A - port A, B - port B. If not present, no explicit mapping is
done.
<rce>
Non-negative absolute integer expression representing the counter number
to be used as the runtime location counter. Must be enclosed in parentheses. Should not exceed the value 65535.
<exp1>
Initial value to assign to the runtime counter used as the <rlc>. If <exp1> is
a relative expression the Assembler uses the relative location counter. If
<exp1> is an absolute expression the Assembler uses the absolute location
counter. If <exp1> is not specified, then the last value and mode that the
counter had will be used.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
6-79
Assembler Significant Characters And Directives
Assembler Directives
<lms>
Which memory space (X, Y, L, P, or E) will be used as the load memory
space. If the memory space is L, any allocated datum with a value greater
than the target word size will be extended to two words; otherwise, it is truncated. If the memory space is E, then depending on the memory space qualifier, any generated words will be split into bytes, one byte per word, or a 16/
8-bit combination.
<llc>
Which load counter, H, L, or default (if neither H or L is specified), that is associated with the <lms> will be used as the load location counter.
<lmp>
Indicates the load physical mapping to DSP memory: I - internal, E - external, R - ROM, A - port A, B - port B. If not present, no explicit mapping is
done.
<lce>
Non-negative absolute integer expression representing the counter number
to be used as the load location counter. Must be enclosed in parentheses.
Should not exceed the value 65535.
<exp2>
Initial value to assign to the load counter used as the <llc>. If <exp2> is a
relative expression the Assembler uses the relative location counter. If
<exp2> is an absolute expression the Assembler uses the absolute location counter. If <exp2> is not specified, then the last value and mode that
the counter had will be used.
If the last half of the operand field in an ORG directive dealing with the load memory space
and counter is not specified, then the Assembler will assume that the load memory space
and load location counter are the same as the runtime memory space and runtime location counter. In this case, object code is being assembled to be loaded into the address
and memory space where it will be when the program is run, and is not an overlay.
If the load memory space and counter are given in the operand field, then the Assembler
always generates code for an overlay. Whether the overlay is absolute or relocatable depends upon the current operating mode of the Assembler and whether the load counter
value is an absolute or relative expression. If the Assembler is running in absolute mode,
or if the load counter expression is absolute, then the overlay is absolute. If the Assembler
is in relative mode and the load counter expression is relative, the overlay is relocatable.
Runtime relocatable overlay code is addressed relative to the location given in the runtime
6-80
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
location counter expression. This expression, if relative, may not refer to another overlay
block.
See also: MODE
EXAMPLES:
ORG P:$1000
Sets the runtime memory space to P. Selects the default runtime counter (counter
0) associated with P space to use as the runtime location counter and initializes it
to $1000. The load memory space is implied to be P, and the load location counter
is assumed to be the same as the runtime location counter.
ORG PHE:
Sets the runtime memory space to P. Selects the H load counter (counter 2) associated with P space to use as the runtime location counter. The H counter will
not be initialized, and its last value will be used. Code generated hereafter will be
mapped to external (E) memory. The load memory space is implied to be P, and
the load location counter is assumed to be the same as the runtime location
counter.
ORG PI:OVL1,Y:
Indicates code will be generated for an overlay. The runtime memory space is P,
and the default counter is used as the runtime location counter. It will be reset to
the value of OVL1. If the Assembler is in absolute mode via the -A command line
option then OVL1 must be an absolute expression. If OVL1 is an absolute expression the Assembler uses the absolute runtime location counter. If OVL1 is a relocatable value the Assembler uses the relative runtime location counter. In this case
OVL1 must not itself be an overlay symbol (e.g. defined within an overlay block).
The load memory space is Y. Since neither H, L, nor any counter expression was
specified as the load counter, the default load counter (counter 0) will be used as
the load location counter. The counter value and mode will be whatever it was the
last time it was referenced.
ORG XL:,E8:
Sets the runtime memory space to X. Selects the L counter (counter 1) associated
with X space to use as the runtime location counter. The L counter will not be initialized, and its last value will be used. The load memory space is set to E, and the
qualifier 8 indicates a bytewise RAM configuration. Instructions and data will be
generated eight bits per output word with byte-oriented load addresses. The default load counter will be used and there is no explicit load origin.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
6-81
Assembler Significant Characters And Directives
Assembler Directives
ORG P(5):,Y:$8000
Indicates code will be generated for an absolute overlay. The runtime memory
space is P, and the counter used as the runtime location counter is counter 5. It
will not be initialized, and the last previous value of counter 5 will be used. The load
memory space is Y. Since neither H, L, nor any counter expression was specified
as the load counter, the default load counter (counter 0) will be used as the load
location counter. The default load counter will be initialized to $8000.
6-82
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
PAGE
Top of Page/Size Page
PAGE
[<exp1>[,<exp2>...,<exp5>]]
The PAGE directive has two forms:
1.
If no arguments are supplied, then the Assembler will advance the listing to the top
of the next page. In this case, the PAGE directive will not be output.
2.
The PAGE directive with arguments can be used to specify the printed format of
the output listing. Arguments may be any positive absolute integer expression.
The arguments in the operand field (as explained below) are separated by commas. Any argument can be left as the default or last set value by omitting the argument and using two adjacent commas. The PAGE directive with arguments will
not cause a page eject and will be printed in the source listing.
A label is not allowed with this directive.
The arguments in order are:
PAGE_WIDTH
<exp1>
Page width in terms of number of output columns per line (default 80, min 1, max
255).
PAGE_LENGTH
<exp2>
Page length in terms of total number of lines per page (default 66, min 10, max
255). As a special case a page length of 0 (zero) turns off all headers, titles, subtitles, and page breaks.
BLANK_TOP
<exp3>
Blank lines at top of page. (default 0, min 0, max see below).
BLANK_BOTTOM
<exp4>
Blank lines at bottom of page. (default 0, min 0, max see below).
BLANK_LEFT
<exp5>
Blank left margin. Number of blank columns at the left of the page. (default 0, min
0, max see below).
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
6-83
Assembler Significant Characters And Directives
Assembler Directives
The following relationships must be maintained:
BLANK_TOP + BLANK_BOTTOM <= PAGE_LENGTH - 10
BLANK_LEFT < PAGE_WIDTH
See also: LSTCOL
EXAMPLE:
PAGE
PAGE
6-84
132,,3,3
; Set width to132, 3 line top/bottom margins
; Page eject
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
PMACRO
Purge Macro Definition
PMACRO
<symbol>[,<symbol>,...,<symbol>]
The specified macro definition will be purged from the macro table, allowing the macro table space to be reclaimed.
A label is not allowed with this directive.
See also: MACRO
EXAMPLE:
PMACRO MAC1,MAC2
This statement would cause the macros named MAC1 and MAC2 to be purged.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
6-85
Assembler Significant Characters And Directives
Assembler Directives
PRCTL
Send Control String to Printer
PRCTL
<exp>I<string>,...,<exp>I<string>
PRCTL simply concatenates its arguments and ships them to the listing file (the directive
line itself is not printed unless there is an error). <exp> is a byte expression and <string>
is an Assembler string. A byte expression would be used to encode non-printing control
characters, such as ESC. The string may be of arbitrary length, up to the maximum Assembler-defined limits.
PRCTL may appear anywhere in the source file and the control string will be output at the
corresponding place in the listing file. However, if a PRCTL directive is the last line in the
last input file to be processed, the Assembler insures that all error summaries, symbol tables, and cross-references have been printed before sending out the control string. This
is so a PRCTL directive can be used to restore a printer to a previous mode after printing
is done. Similarly, if the PRCTL directive appears as the first line in the first input file, the
control string will be output before page headings or titles.
The PRCTL directive only works if the -L command line option is given; otherwise it is ignored. See Chapter 1 for more information on the -L option.
A label is not allowed with this directive.
EXAMPLE:
PRCTL
6-86
$1B,'E'
; Reset HP LaserJet printer
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
RADIX
Change Input Radix for Constants
RADIX
<expression>
Changes the input base of constants to the result of <expression>. The absolute integer
expression must evaluate to one of the legal constant bases (2, 10, or 16). The default
radix is 10. The RADIX directive allows the programmer to specify constants in a preferred radix without a leading radix indicator. The radix prefix for base 10 numbers is the
grave accent (`). Note that if a constant is used to alter the radix, it must be in the appropriate input base at the time the RADIX directive is encountered.
A label is not allowed with this directive.
EXAMPLE:
_RAD10
_RAD2
_RAD16
MOTOROLA
DC
RADIX
DC
RADIX
DC
RADIX
10
2
10
`16
10
3
; Evaluates to hex A
; Evaluates to hex 2
; Evaluates to hex 10
; Bad radix expression
DSP ASSEMBLER REFERENCE MANUAL
6-87
Assembler Significant Characters And Directives
Assembler Directives
RDIRECT
Remove Directive or Mnemonic from Table
RDIRECT
<direc>[,<direc>,...,<direc>]
The RDIRECT directive is used to remove directives from the Assembler directive and
mnemonic tables. If the directive or mnemonic that has been removed is later encountered in the source file, it will be assumed to be a macro. Macro definitions that have the
same name as Assembler directives or mnemonics will cause a warning message to be
output unless the RDIRECT directive has been used to remove the directive or mnemonic
name from the Assembler’s tables. Additionally, if a macro is defined through the MACLIB directive which has the same name as an existing directive or opcode, it will not automatically replace that directive or opcode as previously described. In this case, the
RDIRECT directive must be used to force the replacement.
Since the effect of this directive is global, it cannot be used in an explicitly-defined section
(see SECTION directive). An error will result if the RDIRECT directive is encountered in
a section.
A label is not allowed with this directive.
EXAMPLE:
RDIRECT
PAGE,MOVE
This would cause the Assembler to remove the PAGE directive from the directive table
and the MOVE mnemonic from the mnemonic table.
6-88
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
SCSJMP
Set Structured Control Statement Branching Mode
SCSJMP
{SHORT | LONG | NONE}
The SCSJMP directive is analogous to the FORCE directive, but it only applies to branches generated automatically by structured control statements (see Chapter 7). There is no
explicit way, as with a forcing operator, to force a branch short or long when it is produced
by a structured control statement. This directive will cause all branches resulting from subsequent structured control statements to be forced to the specified mode.
Just like the FORCE pseudo-op, errors can result if a value is too large to be forced short.
For relocatable code, the error may not occur until the linking phase.
See also: FORCE, SCSREG
A label is not allowed with this directive.
EXAMPLE:
SCSJMP
MOTOROLA
SHORT
; force all subsequent SCS jumps short
DSP ASSEMBLER REFERENCE MANUAL
6-89
Assembler Significant Characters And Directives
Assembler Directives
SCSREG
Reassign Structured Control Statement Registers
SCSREG
[<srcreg>[,<dstreg>[,<tmpreg>[,<extreg>]]]]
The SCSREG directive reassigns the registers used by structured control statement
(SCS) directives (see Chapter 7). It is convenient for reclaiming default SCS registers
when they are needed as application operands within a structured control construct. <srcreg> is ordinarily the source register for SCS data moves. <dstreg> is the destination register. <tmpreg> is a temporary register for swapping SCS operands. <extreg> is an extra
register for complex SCS operations. With no arguments SCSREG resets the SCS registers to their default assignments.
The SCSREG directive should be used judiciously to avoid register context errors during
SCS expansion. Source and destination registers may not necessarily be used strictly as
source and destination operands. The Assembler does no checking of reassigned registers beyond validity for the target processor. Errors can result when a structured control
statement is expanded and an improper register reassignment has occurred. It is recommended that the MEX option (see the OPT directive) be used to examine structured control statement expansion for relevant constructs to determine default register usage and
applicable reassignment strategies.
See also: OPT (MEX), SCSJMP
A label is not allowed with this directive.
EXAMPLE:
SCSREG
6-90
Y0,B
; reassign SCS source and dest. registers
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
SECTION
Start Section
SECTION
<symbol>
[GLOBAL | STATIC | LOCAL]
.
.
<section source statements>
.
.
ENDSEC
The SECTION directive defines the start of a section. All symbols that are defined within
a section have the <symbol> associated with them as their section name. This serves to
protect them from like-named symbols elsewhere in the program. By default, a symbol
defined inside any given section is private to that section unless the GLOBAL or LOCAL
qualifier accompanies the SECTION directive.
Any code or data inside a section is considered an indivisible block with respect to relocation. Code or data associated with a section is independently relocatable within the
memory space to which it is bound, unless the STATIC qualifier follows the SECTION directive on the instruction line.
Symbols within a section are generally distinct from other symbols used elsewhere in the
source program, even if the symbol name is the same. This is true as long as the section
name associated with each symbol is unique, the symbol is not declared public (XDEF/
GLOBAL), and the GLOBAL or LOCAL qualifier is not used in the section declaration.
Symbols that are defined outside of a section are considered global symbols and have no
explicit section name associated with them. Global symbols may be referenced freely
from inside or outside of any section, as long as the global symbol name does not conflict
with another symbol by the same name in a given section.
If the GLOBAL qualifier follows the <section name> in the SECTION directive, then all
symbols defined in the section until the next ENDSEC directive are considered global.
The effect is as if every symbol in the section were declared with GLOBAL. This is useful
when a section needs to be independently relocatable, but data hiding is not desired.
If the STATIC qualifier follows the <section name> in the SECTION directive, then all code
and data defined in the section until the next ENDSEC directive are relocated in terms of
the immediately enclosing section. The effect with respect to relocation is as if all code
and data in the section were defined within the parent section. This is useful when a section needs data hiding, but independent relocation is not required.
If the LOCAL qualifier follows the <section name> in the SECTION directive, then all symbols defined in the section until the next ENDSEC directive are visible to the immediately
enclosing section. The effect is as if every symbol in the section were defined within the
parent section. This is useful when a section needs to be independently relocatable, but
data hiding within an enclosing section is not required.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
6-91
Assembler Significant Characters And Directives
Assembler Directives
The division of a program into sections controls not only labels and symbols, but also macros and DEFINE directive symbols. Macros defined within a section are private to that
section and are distinct from macros defined in other sections even if they have the same
macro name. Macros defined outside of sections are considered global and may be used
within any section. Similarly, DEFINE directive symbols defined within a section are private to that section and DEFINE directive symbols defined outside of any section are globally applied. There are no directives that correspond to XDEF for macros or DEFINE
symbols, and therefore, macros and DEFINE symbols defined in a section can never be
accessed globally. If global accessibility is desired, the macros and DEFINE symbols
should be defined outside of any section.
Sections can be nested to any level. When the Assembler encounters a nested section,
the current section is stacked and the new section is used. When the ENDSEC directive
of the nested section is encountered, the Assembler restores the old section and uses it.
The ENDSEC directive always applies to the most previous SECTION directive. Nesting
sections provides a measure of scoping for symbol names, in that symbols defined within
a given section are visible to other sections nested within it. For example, if section B is
nested inside section A, then a symbol defined in section A can be used in section B without XDEFing in section A or XREFing in section B. This scoping behavior can be turned
off and on with the NONS and NS options respectively (see the OPT directive, this chapter).
Sections may also be split into separate parts. That is, <section name> can be used multiple times with SECTION and ENDSEC directive pairs. If this occurs, then these separate
(but identically named) sections can access each others symbols freely without the use of
the XREF and XDEF directives. If the XDEF and XREF directives are used within one
section, they apply to all sections with the same section name. The reuse of the section
name is allowed to permit the program source to be arranged in an arbitrary manner (for
example, all statements that reserve X space storage locations grouped together), but retain the privacy of the symbols for each section.
When the Assembler operates in relative mode (the default), sections act as the basic
grouping for relocation of code and data blocks. For every section defined in the source
a set of location counters is allocated for each DSP memory space. These counters are
used to maintain offsets of data and instructions relative to the beginning of the section.
At link time sections can be relocated to an absolute address, loaded in a particular order,
or linked contiguously as specified by the programmer. Sections which are split into parts
or among files are logically recombined so that each section can be relocated as a unit.
Sections may be relocatable or absolute. In the Assembler absolute mode (command line
-A option) all sections are considered absolute. A full set of locations counters is reserved
for each absolute section unless the GS option is given (see the OPT directive, this chapter). In relative mode, all sections are initially relocatable. However, a section or a part of
6-92
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
a section may be made absolute either implicitly by using the ORG directive, or explicitly
through use of the MODE directive.
A label is not allowed with this directive.
See also: MODE, ORG, GLOBAL, LOCAL, XDEF, XREF
EXAMPLE:
SECTION
MOTOROLA
TABLES
; TABLES will be the section name
DSP ASSEMBLER REFERENCE MANUAL
6-93
Assembler Significant Characters And Directives
Assembler Directives
SET
Set Symbol to a Value
<label>
SET
<expression>
SET
<label>
<expression>
The SET directive is used to assign the value of the expression in the operand field to the
label. The SET directive functions somewhat like the EQU directive. However, labels defined via the SET directive can have their values redefined in another part of the program
(but only through the use of another SET directive). The SET directive is useful in establishing temporary or reusable counters within macros. The expression in the operand field
of a SET must be absolute and cannot include a symbol that is not yet defined (no forward
references are allowed).
See also: EQU, GSET
EXAMPLE:
COUNT
6-94
SET
0
; INITIALIZE COUNT
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
STITLE
Initialize Program Sub-Title
STITLE
[<string>]
The STITLE directive initializes the program subtitle to the string in the operand field. The
subtitle will be printed on the top of all succeeding pages until another STITLE directive is
encountered. The subtitle is initially blank. The STITLE directive will not be printed in the
source listing. An STITLE directive with no string argument will cause the current subtitle
to be blank.
A label is not allowed with this directive.
See also: TITLE
EXAMPLE:
STITLE
MOTOROLA
'COLLECT SAMPLES'
DSP ASSEMBLER REFERENCE MANUAL
6-95
Assembler Significant Characters And Directives
Assembler Directives
SYMOBJ
Write Symbol Information to Object File
SYMOBJ
<symbol>[,<symbol>,...,<symbol>]
The SYMOBJ directive causes information for each <symbol> to be written to the object
file. This directive is recognized but currently performs no operation in COFF Assemblers
(see Appendix E, Motorola DSP Object File Format (COFF)).
A label is not allowed with this directive.
EXAMPLE:
SYMOBJ
6-96
XSTART,HIRTN,ERRPROC
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
TABS
Set Listing Tab Stops
TABS
<tabstops>
The TABS directive allows resetting the listing file tab stops from the default value of 8.
A label is not allowed with this directive.
See also: LSTCOL
EXAMPLE:
TABS
MOTOROLA
4
; Set listing file tab stops to 4
DSP ASSEMBLER REFERENCE MANUAL
6-97
Assembler Significant Characters And Directives
Assembler Directives
TITLE
Initialize Program Title
TITLE
[<string>]
The TITLE directive initializes the program title to the string in the operand field. The program title will be printed on the top of all succeeding pages until another TITLE directive
is encountered. The title is initially blank. The TITLE directive will not be printed in the
source listing. A TITLE directive with no string argument will cause the current title to be
blank.
A label is not allowed with this directive.
See also: STITLE
EXAMPLE:
TITLE
6-98
'FIR FILTER'
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
UNDEF
Undefine DEFINE Symbol
UNDEF
[<symbol>]
The UNDEF directive causes the substitution string associated with <symbol> to be released, and <symbol> will no longer represent a valid DEFINE substitution. See the DEFINE directive for more information.
A label is not allowed with this directive.
See also: DEFINE
EXAMPLE:
UNDEF
MOTOROLA
DEBUG ; UNDEFINES THE DEBUG SUBSTITUTION STRING
DSP ASSEMBLER REFERENCE MANUAL
6-99
Assembler Significant Characters And Directives
Assembler Directives
WARN
Programmer Generated Warning
WARN
[{<str>|<exp>}[,{<str>|<exp>},...,{<str>|<exp>}]]
The WARN directive will cause a warning message to be output by the Assembler. The
total warning count will be incremented as with any other warning. The WARN directive
is normally used in conjunction with conditional assembly directives for exceptional condition checking. The assembly proceeds normally after the warning has been printed. An
arbitrary number of strings and expressions, in any order but separated by commas with
no intervening white space, can be specified optionally to describe the nature of the generated warning.
A label is not allowed with this directive.
See also: FAIL, MSG
EXAMPLE:
WARN
6-100
'parameter too large'
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Significant Characters And Directives
Assembler Directives
XDEF
External Section Symbol Definition
XDEF
<symbol>[,<symbol>,...,<symbol>]
The XDEF directive is used to specify that the list of symbols is defined within the current
section, and that those definitions should be accessible by sections with a corresponding
XREF directive. This directive is only valid if used within a program section bounded by
the SECTION and ENDSEC directives. The XDEF directive must appear before <symbol> is defined in the section. If the symbols that appear in the operand field are not defined in the section, an error will be generated.
A label is not allowed with this directive.
See also: SECTION, XREF
EXAMPLE:
SECTION
XDEF
.
.
.
ENDSEC
MOTOROLA
IO
LOOPA
; LOOPA will be accessible by sections with XREF
DSP ASSEMBLER REFERENCE MANUAL
6-101
Assembler Significant Characters And Directives
Assembler Directives
XREF
External Section Symbol Reference
XREF
<symbol>[,<symbol>,...,<symbol>]
The XREF directive is used to specify that the list of symbols is referenced in the current
section, but is not defined within the current section. These symbols must either have
been defined outside of any section or declared as globally accessible within another section using the XDEF directive. If the XREF directive is not used to specify that a symbol
is defined globally and the symbol is not defined within the current section, an error will be
generated, and all references within the current section to such a symbol will be flagged
as undefined. The XREF directive must appear before any reference to <symbol> in the
section.
A label is not allowed with this directive.
See also: SECTION, XDEF
EXAMPLE:
SECTION
XREF
.
.
.
ENDSEC
6-102
FILTER
AA,CC,DD
; XDEFed symbols within section
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Chapter 7
STRUCTURED CONTROL STATEMENTS
7.1
INTRODUCTION
An assembly language provides an instruction set for performing certain rudimentary operations. These operations in turn may be combined into control structures such as loops
(FOR, REPEAT, WHILE) or conditional branches (IF-THEN, IF-THEN-ELSE). The Assembler, however, accepts formal, high-level directives that specify these control structures, generating the appropriate assembly language instructions for their efficient
implementation. This use of structured control statement directives improves the readability of assembly language programs, without compromising the desirable aspects of
programming in an assembly language.
7.2
STRUCTURED CONTROL DIRECTIVES
The following directives are used for structured control. Note the leading period, which
distinguishes these keywords from other directives and mnemonics. Structured control
directives may be specified in either upper or lower case, but they must appear in the opcode field of the instruction line (e.g. they must be preceded either by a label, a space,
or a tab).
.BREAK
.CONTINUE
.ELSE
.ENDF
.ENDI
.ENDL
.ENDW
.FOR
.IF
.LOOP
.REPEAT
.UNTIL
.WHILE
In addition, the following keywords are used in structured control statements:
AND
BY
DO
DOWNTO
OR
THEN
TO
Note that AND, DO, and OR are reserved Assembler instruction mnemonics.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
7-1
Structured Control Statements
Syntax
7.3
SYNTAX
The formats for the .BREAK, .CONTINUE, .FOR, .IF, .LOOP, .REPEAT, and .WHILE
statements are given in sections 7.3.4 through 7.3.2. Syntactic variables used in the formats are defined as follows:
<expression>
A simple or compound expression (section 7.4).
<stmtlist>
Zero or more Assembler directives, structured control statements, or executable instructions.
Note than an Assembler directive (Chapter 6) occurring within a structured control
statement is examined exactly once -- at assembly time. Thus the presence of a
directive within a .FOR, .LOOP, .REPEAT, or .WHILE statement does not imply repeated occurrence of an Assembler directive; nor does the presence of a directive
within an .IF-THEN-.ELSE structured control statement imply conditional assembly.
<op1>
A user-defined operand whose register/memory location holds
the .FOR loop counter. The effective address must use a memory alterable addressing mode (e.g. it cannot be an immediate value).
<op2>
The initial value of the .FOR loop counter. The effective address
may be any mode, and may represent an arbitrary Assembler expression (Chapter 3).
<op3>
The terminating value of the .FOR loop counter. The effective address may be any mode, and may represent an arbitrary Assembler expression (Chapter 3).
<op4>
The step (increment/decrement) of the .FOR loop counter each
time through the loop. If not specified, it defaults to a value of #1.
The effective address may be any mode, and may represent an
arbitrary Assembler expression (Chapter 3).
<cnt>
The terminating value in a .LOOP statement. This can be any arbitrary Assembler expression (Chapter 3).
All structured control statements may be followed by normal Assembler comments on the
same logical line.
7.3.1
.BREAK Statement
SYNTAX:
.BREAK [<expression>]
7-2
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Structured Control Statements
Syntax
FUNCTION:
The .BREAK statement causes an immediate exit from the innermost enclosing loop construct (.WHILE, .REPEAT, .FOR, .LOOP). If the optional
<expression> is given, loop exit will be dependent on the outcome of the
condition.
NOTES:
A .BREAK statement does not exit an .IF-THEN-.ELSE construct. If a
.BREAK is encountered with no loop statement active, a warning is issued.
.BREAK should be used with care near .ENDL directives or near the end of
DO loops. It generates a jump instruction which is illegal in those contexts.
The optional <expression> is limited to condition code expressions only
(see 7.4.1.1).
EXAMPLE:
.WHILE
x:(r1)+ <GT> #0
;loop until zero is found
.
.
.
.IF
<cs>
.BREAK
;causes exit from WHILE loop
.ENDI
.
.
;any instructions here are skipped
.
.ENDW
;execution resumes here after .BREAK
7.3.2
.CONTINUE Statement
SYNTAX:
.CONTINUE
FUNCTION:
The .CONTINUE statement causes the next iteration of a looping construct
(.WHILE, .REPEAT, .FOR, .LOOP) to begin. This means that the loop expression or operand comparison is performed immediately, bypassing any
subsequent instructions.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
7-3
Structured Control Statements
Syntax
NOTES:
If a .CONTINUE is encountered with no loop statement active, a warning is
issued.
.CONTINUE should be used with care near .ENDL directives or near the
end of DO loops. It generates a jump instruction which is illegal in those
contexts.
One or more .CONTINUE directives inside a .LOOP construct will generate
a NOP instruction just before the loop address.
EXAMPLE:
.REPEAT
.
.
.
.IF
<cs>
.CONTINUE
.ENDI
.
.
.
.UNTIL x:(r1)+ <EQ> #0
7.3.3
;causes immediate jump to .UNTIL
;any instructions here are skipped
;evaluation here after .CONTINUE
.FOR Statement
SYNTAX:
.FOR <op1> = <op2> {TO | DOWNTO} <op3> [BY <op4>] [DO]
<stmtlist>
.ENDF
FUNCTION:
Initialize <op1> to <op2> and perform <stmtlist> until <op1> is greater (TO)
or less than (DOWNTO) <op3>. Makes use of a user-defined operand,
<op1>, to serve as a loop counter. .FOR-TO allows counting upward, while
.FOR-DOWNTO allows counting downward. The programmer may specify
an increment/decrement step size in <op4>, or elect the default step size of
#1 by omitting the BY clause. A .FOR-TO loop is not executed if <op2> is
greater than <op3> upon entry to the loop. Similarly, a .FOR-DOWNTO
loop is not executed if <op2> is less than <op3>.
7-4
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Structured Control Statements
Syntax
NOTES:
<op1> must be a writable register or memory location. It is initialized at the
beginning of the loop, and updated at each pass through the loop. Any immediate operands must be preceded by a pound sign (#). Memory references must be preceded by a memory space qualifier (X:, Y:, or P:). L
memory references are not allowed. Operands must be or refer to singleword values.
The logic generated by the .FOR directive makes use of several DSP data
registers (see Appendix F). In fact, two data registers are used to hold the
step and target values, respectively, throughout the loop; they are never reloaded by the generated code. It is recommended that these registers not
be used within the body of the loop, or that they be saved and restored prior
to loop evaluation.
The DO keyword is optional.
EXAMPLE:
.FOR
.
.
.
.ENDF
7.3.4
X:CNT = #0 TO Y:(targ*2)+114
; loop on X:CNT
.IF Statement
SYNTAX:
.IF
<stmtlist>
[.ELSE
<stmtlist>]
.ENDI
<expression>
[THEN]
FUNCTION:
If <expression> is true, execute <stmtlist> following THEN (the keyword
THEN is optional); if <expression> is false, execute <stmtlist> following
.ELSE, if present; otherwise, advance to the instruction following .ENDI.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
7-5
Structured Control Statements
Syntax
NOTES:
In the case of nested .IF-THEN-.ELSE statements, each .ELSE refers to the
most recent .IF-THEN sequence.
EXAMPLE:
.IF
.
.
.
.ENDI
7.3.5
<EQ>
; zero bit set?
.LOOP Statement
SYNAX:
.LOOP [<cnt>]
<stmtlist>
.ENDL
FUNCTION:
Execute <stmtlist> <cnt> times. This is similar to the .FOR loop construct,
except that the initial counter and step value are implied to be #1. It is actually a shorthand method for setting up a hardware DO loop on the DSP,
without having to worry about addressing modes or label placement.
NOTES:
Since the .LOOP statement generates instructions for a hardware DO loop,
the same restrictions apply as to the use of certain instructions near the end
of the loop, nesting restrictions, etc.
One or more .CONTINUE directives inside a .LOOP construct will generate
a NOP instruction just before the loop address.
if <cnt> is not specified an infinite loop is implied. For processors which support it, FOREVER may be substituted for <cnt>, in which cas a hardware infinite loop will be generated (DO FOREVER).
EXAMPLE:
.LOOP
.
.
.
.ENDL
7-6
LPCNT
; hardware loop LPCNT times
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Structured Control Statements
Syntax
7.3.6
.REPEAT Statement
SYNTAX:
.REPEAT
<stmtlist>
.UNTIL <expression>
FUNCTION:
<stmtlist> is executed repeatedly until <expression> is true. When expression becomes true, advance to the next instruction following .UNTIL.
NOTES:
The <stmtlist> is executed at least once, even if <expression> is true upon
entry to the .REPEAT loop.
EXAMPLE:
.REPEAT
.
.
.
.UNTIL x:(r1)+ <EQ> #0
7.3.7
; loop until zero is found
.WHILE Statement
SYNTAX:
.WHILE
<expression>
[DO]
<stmtlist>
.ENDW
FUNCTION:
The <expression> is tested before execution of <stmtlist>. While <expression> remains true, <stmtlist> is executed repeatedly. When <expression>
evaluates false, advance to the instruction following the .ENDW statement.
NOTES:
If <expression> is false upon entry to the .WHILE loop, <stmtlist> is not executed; execution continues after the .ENDW directive.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
7-7
Structured Control Statements
Simple And Compound Expressions
The DO keyword is optional.
EXAMPLE:
.WHILE
.
.
.
.ENDW
7.4
x:(r1)+ <GT> #0 ; loop until zero is found
SIMPLE AND COMPOUND EXPRESSIONS
Expressions are an integral part of .IF, .REPEAT, and .WHILE statements. Structured
control statement expressions should not be confused with the Assembler expressions
discussed in Chapter 3. The latter are evaluated at assembly time and will be referred to
here as "Assembler expressions"; they can serve as operands in structured control statement expressions. The structured control statement expressions described below are
evaluated at run time and will be referred to in the following discussion simply as "expressions".
A structured control statement expression may be simple or compound. A compound expression consists of two or more simple expressions joined by either AND or OR (but not
both in a single compound expression).
7.4.1
Simple Expressions
Simple expressions are concerned with the bits of the Condition Code Register (CCR).
These expressions are of two types. The first type merely tests conditions currently specified by the contents of the CCR (section 7.4.1.1). The second type sets up a comparison
of two operands to set the condition codes, and afterwards tests the codes (section
7.4.1.2).
7.4.1.1 Condition Code Expressions
A variety of tests (identical to those in the Jcc instruction) may be performed, based on
the CCR condition codes. The condition codes, in this case, are preset by either a usergenerated instruction or a structured operand-comparison expression (section 7.4.1.2).
Each test is expressed in the structured control statement by a mnemonic enclosed in angle brackets; the mnemonics are described in Appendix F, Condition Code Mnemonics.
7-8
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Structured Control Statements
Simple And Compound Expressions
When processed by the Assembler, the expression generates an inverse conditional jump
to beyond the matching .ENDx/.UNTIL directive. For example:
+
+
+
+
.IF
bne
CLR
.ENDI
Z_L00002
.REPEAT
Z_L00034
SUB
.UNTIL
bge
<EQ>
Z_L00002
D1
D7,D0
<LT>
Z_L00034
;zero bit set?
;code generated by Assembler
;user code
;Assembler-generated label
;subtract until D0 < D7
;Assembler-generated label
;user code
;code generated by Assembler
7.4.1.2 Operand Comparison Expressions
Two operands may be compared in a simple expression, with subsequent transfer of control based on that comparison. Such a comparison takes the form:
<op1> <cc> <op2>
where <cc> is a condition mnemonic enclosed in angle brackets (as described in section
7.4.1.1), and <op1> and <op2> are register or memory references, symbols, or Assembler
expressions. When processed by the Assembler, the operands are arranged such that a
compare/jump sequence of the following form always results:
CMP
(J|B)cc
<reg1>,<reg2>
<label>
where the jump conditional is the inverse of <cc>. Ordinarily <op1> is moved to the
<reg1> data register and <op2> is moved to the <reg2> data register prior to the compare.
This is not always the case, however: if <op1> happens to be <reg2> and <op2> is
<reg1>, an intermediate register is used as a scratch register. In any event, worst case
code generation for a given operand comparison expression is generally two moves, a
compare, and a conditional jump.
Jumps or branches generated by structured control statements are forced long because
the number and address of intervening instructions between a control statement and its
termination are not known by the Assembler. The programmer may circumvent this behavior by use of the SCSJMP directive (see Chapter 6).
Any immediate operands must be preceded by a pound sign (#). Memory references
must be preceded by a memory space qualifier (X:, Y:, or P:). L memory references are
not allowed. Operands must be or refer to single-word values.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
7-9
Structured Control Statements
Statement Formatting
Note that values in the <reg1> and <reg2> data registers are not saved before expression
evaluation. This means that any user data in those registers will be overwritten each time
the expression is evaluated at runtime. The programmer should take care either to save
needed contents of the registers, reassign data registers using the SCSREG directive, or
not use them at all in the body of the particular structured construct being executed. The
data registers used by the structured control statements are listed in Appendix F.
7.4.2
Compound Expressions
A compound expression consists of two or more simple expressions (section 7.4.1) joined
by a logical operator (AND or OR). The boolean value of the compound expression is determined by the boolean values of the simple expressions and the nature of the logical
operator. Note that the result of mixing logical operators in a compound expression is undefined:
.IF
.IF
X1 <GT> B AND <LS> AND R1 <NE> R2
X1 <LE> B AND <LC> OR R5 <GT> R6
;this is OK
;undefined
The simple expressions are evaluated left to right. Note that this means the result of one
simple expression could have an impact on the result of subsequent simple expressions,
because of the condition code settings stemming from the Assembler-generated compare.
If the compound expression is an AND expression and one of the simple expressions is
found to be false, any further simple expressions are not evaluated. Likewise, if the compound expression is an OR expression and one of the simple expressions is found to be
true, any further simple expressions are not evaluated. In these cases, the compound expression is either false or true, respectively, and the condition codes reflect the result of
the last simple expression evaluated.
7.5
STATEMENT FORMATTING
The format of structured control statements differs somewhat from normal Assembler usage. Whereas a standard Assembler line is split into fields separated by blanks or tabs,
with no white space inside the fields, structured control statement formats vary depending
on the statement being analyzed. In general, all structured control directives are placed
in the opcode field (with an optional label in the label field) and white space separates all
distinct fields in the statement. Any structured control statement may be followed by a
comment on the same logical line.
7.5.1
Expression Formatting
Given an expression of the form:
<op1> <LT> <op2> OR <op3> <GE> <op4>
7-10
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Structured Control Statements
Effects On The Programmer’s Environment
there must be white space (blank, tab) between all operands and their associated operators, including boolean operators in compound expressions. Moreover, there must be
white space between the structured control directive and the expression, and between the
expression and any optional directive modifier (THEN, DO). An Assembler expression
(Chapter 3) used as an operand in a structured control statement expression must not
have white space in it, since it is parsed by the standard Assembler evaluation routines:
.IF
7.5.2
#@CVI(@SQT(4.0)) <GT> #2
; no white space in first operand
.FOR/.LOOP Formatting
The .FOR and .LOOP directives represent special cases. The .FOR structured control
statement consists of several fields:
.FOR <op1> = <op2> TO <op3> BY <op4> DO
There must be white space between all operands and other syntactic entities such as =,
TO, BY, and DO. As with expression formatting, an Assembler expression used as an
operand must not have white space in it:
.FOR X:CNT = #0 TO Y:(targ*2)+1 BY #@CVI(@POW(2.0,@CVF(R)))
In the example above, the .FOR loop operands represented as Assembler expressions
(symbol, function) do not have embedded white space, whereas the loop operands are
always separated from structured control statement keywords by white space.
The count field of a .LOOP statement must be separated from the .LOOP directive by
white space. The count itself may be any arbitrary Assembler expression, and therefore
must not contain embedded blanks.
7.5.3
Assembly Listing Format
Structured control statements begin with the directive in the opcode field; any optional label is output in the label field. The rest of the statement is left as is in the operand field,
except for any trailing comment; the X and Y data movement fields are ignored. Comments following the statement are output in the comment field (unless the unreported
comment delimiter is used; see Chapter 6).
Statements are expanded using the macro facilities of the Assembler. Thus the generated
code can be sent to the listing by specifying the MEX Assembler option, either via the OPT
directive (Chapter 6) or the -O command line option (Chapter 1).
7.6
EFFECTS ON THE PROGRAMMER’S ENVIRONMENT
During assembly, global labels beginning with "Z_L" are generated. They are stored in the
symbol table and should not be duplicated in user-defined labels. Because these non-local labels ordinarily are not visible to the programmer there can be problems when local
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
7-11
Structured Control Statements
Effects On The Programmer’s Environment
(underscore) labels are interspersed among structured control statements. The SCL option (see the OPT directive, Chapter 6) causes the Assembler to maintain the current local
label scope when a structured control statement label is encountered.
In the .FOR loop, <op1> is a user-defined symbol. When exiting the loop, the memory/
register assigned to this symbol contains the value which caused the exit from the loop.
A compare instruction is produced by the Assembler whenever two operands are tested
in a structured statement. At runtime, these Assembler-generated instructions set the
condition codes of the CCR (in the case of a loop, the condition codes are set repeatedly).
Any user-written code either within or following a structured statement that references
CCR directly (move) or indirectly (conditional jump/transfer) should be attentive to the effect of these instructions.
Jumps or branches generated by structured control statements are forced long because
the number and address of intervening instructions between a control statement and its
termination are not known by the Assembler. The programmer may circumvent this behavior by use of the SCSJMP directive (see Chapter 6).
In all structured control statements except those using only a single condition code expression, registers are used to set up the required counters and comparands. In some
cases, these registers are effectively reserved; the .FOR loop uses two data registers to
hold the step and target values, respectively, and performs no save/restore operations on
these registers. The Assembler, in fact, does no save/restore processing in any structured
control operation; it simply moves the operands into appropriate registers to execute the
compare. See Appendix F for a list of registers used by the Assembler in support of structured control statements on a particular processor. The SCSREG directive (Chapter 6)
may be used to reassign structured control statement registers. The MEX Assembler option (see the OPT directive, Chapter 6) may be used to send the Assembler-generated
code to the listing file for examination of possible register use conflicts.
7-12
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Appendix A
ASCII CHARACTER CODES
DecimalHex
ASCII
DecimalHex
ASCII
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
NUL
SOH
STX
ETX
EOT
ENQ
ACK
BEL
BS
HT
LF
VT
FF
CR
S0
S1
DLW
DC1
DC2
DC3
DC4
NAK
SYN
ETB
CAN
EM
SUB
ESC
FS
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
@
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
[
\
MOTOROLA
00
01
02
03
04
05
06
07
08
09
0A
0B
0C
0D
0E
0F
10
11
12
13
14
15
16
17
18
19
1A
1B
1C
40
41
42
43
44
45
46
47
48
49
4A
4B
4C
4D
4E
4F
50
51
52
53
54
55
56
57
58
59
5A
5B
5C
DSP ASSEMBLER REFERENCE MANUAL
A-1
ASCII Character Codes
A-2
DecimalHex
ASCII
DecimalHex
ASCII
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
GS
RS
US
SP
!
"
#
$
%
&
’
(
)
*
+
,
.
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
]
^
_
‘
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
{
|
}
~
DEL
1D
1E
1F
20
21
22
23
24
25
26
27
28
29
2A
2B
2C
2D
2E
2F
30
31
32
33
34
35
36
37
38
39
3A
3B
3C
3D
3E
3F
5D
5E
5F
60
61
62
63
64
65
66
67
68
69
6A
6B
6C
6D
6E
6F
70
71
72
73
74
75
76
77
78
79
7A
7B
7C
7D
7E
7F
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Appendix B
DIRECTIVE SUMMARY
Assembler directives can be grouped by function into seven types:
1.
2.
3.
4.
5.
6.
7.
B.1
Assembly control
Symbol definition
Data definition/storage allocation
Listing control and options
Object file control
Macros and conditional assembly
Structured programming
ASSEMBLY CONTROL
The directives used for assembly control are:
COMMENT
DEFINE
END
FAIL
FORCE
HIMEM
INCLUDE
LOMEM
MODE
MSG
ORG
RADIX
RDIRECT
SCSJMP
SCSREG
UNDEF
WARN
MOTOROLA
- Start comment lines
- Define substitution string
- End of source program
- Programmer generated error message
- Set operand forcing mode
- Set high memory bounds
- Include secondary file
- Set low memory bounds
- Change relocation mode
- Programmer generated message
- Initialize memory space and location counters
- Change input radix for constants
- Remove directive or mnemonic from table
- Set structured control branching mode
- Reassign structured control statement registers
- Undefine DEFINE symbol
- Programmer generated warning
DSP ASSEMBLER REFERENCE MANUAL
B-1
Directive Summary
Symbol Definition
B.2
SYMBOL DEFINITION
The directives used to control symbol definition are:
ENDSEC
EQU
GLOBAL
GSET
LOCAL
SECTION
SET
XDEF
XREF
B.3
- End section
- Equate symbol to a value
- Global section symbol declaration
- Set global symbol to a value
- Local section symbol declaration
- Start section
- Set symbol to a value
- External section symbol definition
- External section symbol reference
DATA DEFINITION/STORAGE ALLOCATION
The directives used to control constant data definition and storage allocation are:
BADDR
BSB
BSC
BSM
BUFFER
DC
DCB
DS
DSM
DSR
ENDBUF
B.4
- Set buffer address
- Block storage bit-reverse
- Block storage of constant
- Block storage modulo
- Start buffer
- Define constant
- Define constant byte
- Define storage
- Define modulo storage
- Define reverse carry storage
- End buffer
LISTING CONTROL AND OPTIONS
The directives used to control the output listing are:
LIST
LSTCOL
NOLIST
OPT
PAGE
PRCTL
STITLE
TABS
TITLE
B-2
- List the assembly
- Set listing field widths
- Stop assembly listing
- Assembler options
- Top of page/size page
- Send control string to printer
- Initialize program subtitle
- Set listing tab stops
- Initialize program title
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Directive Summary
Object File Control
B.5
OBJECT FILE CONTROL
The directives used for control of the object file are:
COBJ
IDENT
SYMOBJ
B.6
- Comment object code
- Object code identification record
- Write symbol information to object file
MACROS AND CONDITIONAL ASSEMBLY
The directives used for macros and conditional assembly are:
DUP
DUPA
DUPC
DUPF
ENDIF
ENDM
EXITM
IF
MACLIB
MACRO
PMACRO
B.7
- Duplicate sequence of source lines
- Duplicate sequence with arguments
- Duplicate sequence with characters
- Duplicate sequence in loop
- End of conditional assembly
- End of macro definition
- Exit macro
- Conditional assembly directive
- Macro library
- Macro definition
- Purge macro definition
STRUCTURED PROGRAMMING
The directives used for structured programming are:
.BREAK
.CONTINUE
.ELSE
.ENDF
.ENDI
.ENDL
.ENDW
.FOR
.IF
.LOOP
.REPEAT
.UNTIL
.WHILE
MOTOROLA
- Exit from structured loop construct
- Continue next iteration of structured loop
- Perform following statements when .IF false
- End of .FOR loop
- End of .IF condition
- End of hardware loop
- End of .WHILE loop
- Begin .FOR loop
- Begin .IF condition
- Begin hardware loop
- Begin .REPEAT loop
- End of .REPEAT loop
- Begin .WHILE loop
DSP ASSEMBLER REFERENCE MANUAL
B-3
Appendix C
ASSEMBLER MESSAGES
C.1
INTRODUCTION
Assembler messages are grouped into four categories:
Command Line Errors
These errors indicate invalid command line options, missing filenames, file open
errors, or other invocation errors. Command line errors generally cause the Assembler to stop processing.
Warnings
Warnings notify the programmer of suspect constructs but do not otherwise affect
the object file output.
Errors
These errors indicate problems with syntax, addressing modes, or usage. In these
cases the resulting object code is generally not valid.
Fatal
Fatal errors signify serious problems encountered during the assembly process
such as lack of memory, file not found, or other internal errors. The Assembler halts
immediately.
The Assembler also will provide information on the source field location of the error, if it
can be ascertained. If a listing file is produced, messages ordinarily will appear immediately before the line containing the error. One exception is when the relationship between
the first and last instructions in a DO loop produces an error. In this case the error text will
appear after the last instruction at the end of the loop. Messages are always routed to
standard output.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-1
Assembler Messages
Command Line Errors
C.2
COMMAND LINE ERRORS
Cannot open command file
Cannot open listing file
Cannot open object file
The file associated with a -F, -L, or -B command line option was not found.
Cannot open source file
The assembly source input file was not found.
Duplicate listing file specified - ignored
Duplicate object file specified - ignored
The -L and -B command line options were encountered more than once on the
command line. Only the first occurrence of each option is used. The Assembler
continues processing.
Illegal command line -D option argument
The symbol name given in a -D command line option is invalid (possibly too long
or does not begin with an alphabetic character), or the substitution string is not enclosed in single quotes.
Illegal command line -E option
Neither of the qualifiers -A or -W were provided with the -E option.
Illegal command line -I option argument
A problem occurred when attempting to save the include file path string.
Illegal command line -M option argument
A problem occurred when attempting to save the MACLIB file path string.
Illegal command line -P option argument
The string provided as the processor type is not valid.
Illegal command line -R option argument
The string provided as the revision level is not valid.
Illegal command line option
The option specified on the command line was not recognized by the Assembler.
Interrupted
The Assembler was interrupted by a keyboard break (Control-C).
C-2
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Messages
Command Line Errors
Invalid syntax for command line -E option
There must be whitespace between the -E option and its filename argument.
LDB option with no listing file specified; using source file
The LDB option was given on the command line without a corresponding -L to generate a listing file. If a listing file is not produced, debugging packages cannot use
it for source tracking. Therefore the Assembler uses the default assembly language file as input for source tracking.
Missing argument for command line -E option
The -E command line option must have a filename argument.
Missing command line option argument
The expected arguments following a command line option specifier were missing.
Missing source filename
There must be at least one source filename specified on the command line.
Source file name same as listing file name
Source file name same as object file name
One of the source files appeared to the Assembler to have the same name as the
specified listing or object file. The Assembler aborts rather than potentially writing
over a source input file.
Strip not valid in relocatable mode - ignored
The -Z option is not valid without the -A command line option.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-3
Assembler Messages
Warnings
C.3
WARNINGS
Absolute address involves incompatible memory spaces
The memory space attribute is regarded by the Assembler as a type, in the same
sense that high level languages use type for variables. Symbols may have memory
space attributes of X, Y, L, P(rogram), E(MI), or N(one); only N is fully compatible
with all other attributes. In this case, an operand was evaluated with a different
memory space attribute than that specified in the instruction.
Absolute address too large to use I/O short - long substituted
The absolute address is not within the range specifying an I/O short address, even
though the I/O short forcing operator has been used. The Assembler substitutes
long absolute addressing.
Absolute address too large to use short - long substituted
The absolute address value being forced short will not fit in the storage allocated
for a short address. The Assembler substitutes long absolute addressing.
Absolute address too small to use I/O short - long substituted
The absolute address is not within the range specifying an I/O short address, even
though the I/O short forcing operator has been used. The Assembler substitutes
long absolute addressing.
Address involves incompatible memory spaces
The memory space attribute is regarded by the Assembler as a type, in the same
sense that high level languages use type for variables. Symbols may have memory
space attributes of X, Y, L, P(rogram), E(MI), or N(one); only N is fully compatible
with all other attributes. In this case, an operand was evaluated with a different
memory space attribute than that specified in the instruction.
Cannot force short addressing for source and destination
In a MOVEP or MOVES instruction an attempt was made to force both operands
to short or I/O short. The second operand defaults to long.
Cannot force short immediate with this parallel move
The immediate operand in the X field of a parallel X memory and register move
cannot be forced short. The mode is changed to long immediate.
Contents of assigned register in previous instruction not available generating NOP instruction
Due to pipelining, if an address register (Rn or Nn) is changed in the previous instruction, the new contents are not available for use as a pointer until the next instruction. If the RP option is in effect (see the OPT directive, Chapter 6) the
C-4
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Messages
Warnings
Assembler produces this warning and generates a NOP prior to the offending instruction.
Debug directives ignored - use command line debug option
A source-level debug directive was encountered but the Assembler command line
-G option was not given.
Destination operand assumed I/O short
Neither operand in a MOVEP instruction is explicitly declared I/O short; however,
the source operand does not qualify, so the destination operand is assumed to be
the I/O short operand.
Directive not allowed in command line absolute mode
The MODE directive is ignored when the Assembler command line -A option is active.
Displacement too large to use short - long substituted
Short displacement addressing is not valid for this operation. The Assembler substitutes long displacement addressing.
Duplicate listing file specified - ignored
Duplicate object file specified - ignored
The -B or -L command line options were given more than once.
EMI 8-bit memory value truncated
EMI 12-bit memory value truncated
EMI 16-bit memory value truncated
EMI 20-bit memory value truncated
The value in a data directive was too large for the current EMI memory configuration.
ENDDO instruction not inside DO loop
An ENDDO instruction was found outside the scope of an active DO loop.
Explicit bottom margin ignored with page length of zero
Explicit top margin ignored with page length of zero
The top or bottom margin parameters to a PAGE directive are ignored because the
page length parameter was zero.
Expression involves incompatible memory spaces
The memory space attribute is regarded by the Assembler as a type, in the same
sense that high level languages use type for variables. Symbols may have memory
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-5
Assembler Messages
Warnings
space attributes of X, Y, L, P(rogram), E(MI), or N(one); only N is fully compatible
with all other attributes. In this case, two operands were evaluated with different
memory space attributes, neither of which was N.
Expression value outside fractional domain
The expected fractional value was not within the range -1.0 <= m < 1.
Extra dimensions ignored
A source-level debug .DIM directive contained more than four arguments specifying the dimensions of an array.
FMPY suffix ignored - using secondary opcode suffix
The single or extended precision suffix on a dual-opcode instruction has been ignored. The precision is taken from the suffix on the secondary opcode.
Immediate value too large to use short - long substituted
An immediate data value being forced short is too large to fit in the space allocated
for a short immediate value. The Assembler substitutes long immediate addressing.
Improper nesting of DO loops
The end address of a subordinate (nested) DO loop is greater than or equal to the
end address of the loop enclosing it. The end address of a nested DO instruction
must be less than the end address of the enclosing loop.
Invalid register for short displacement addressing mode - long substituted
The register specified in the displacement address cannot be used with the short
form of the instruction. The Assembler substitutes long displacement addressing.
Instruction cannot appear in interrupt vector locations
Some instructions cannot be used reliably as interrupt code. These instructions include RTI, RTS, DO, and ENDDO.
Instruction does not allow data movement specified - using MOVE encoding
Instruction does not allow data movement specified - using MOVEP encoding
Instruction does not allow data movement specified - using MOVES encoding
An inappropriate MOVE-type instruction was written given the type of the operands. The Assembler substitutes a valid encoding for the operands in question.
Invalid destination register for this instruction - using TFR3 encoding
The destination register for a TFR2 instruction was not either X or Y.
C-6
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Messages
Warnings
Invalid interrupt vector address - using SWI address
Currently only the SWI address is supported by the TRAPcc instruction.
I/O short absolute address cannot be forced
I/O short absolute addressing is not valid for this operation. An appropriate addressing mode (long absolute, short jump, short absolute) is substituted.
I/O short absolute address cannot be forced - long substituted
I/O short absolute addressing is not valid for this operation. The Assembler substitutes long absolute addressing.
I/O short address cannot be forced
I/O short addressing is not valid for this operation. An appropriate addressing
mode (long, short, short jump) is substituted.
I/O short address cannot be forced - long substituted
I/O short addressing is not valid for this operation. The Assembler substitutes long
addressing.
Label field ignored
The Assembler directive does not allow a label, so the Assembler will not store the
label value in the symbol table.
LDB option with no listing file specified; using source file
The LDB option was given without an explicit -L command line option to create a
listing file for debugging.
Load location counter overflow
Load location counter underflow
The load location counter exceeded its maximum or minimum value. The Assembler wraps the counter value around and continues.
Load origin involves incompatible memory spaces
The memory space attribute is regarded by the Assembler as a type, in the same
sense that high level languages use type for variables. Symbols may have memory
space attributes of X, Y, L, P(rogram), E(MI), or N(one); only N is fully compatible
with all other attributes. In this case, an operand was evaluated with a different
memory space attribute than that specified in the directive.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-7
Assembler Messages
Warnings
Load reserved address space violation
The load location counter has incremented into a reserved area of data address
space.
Long absolute address cannot be forced
Long absolute addressing is not valid for this operation. An appropriate addressing
mode (I/O absolute, short jump, short absolute) is substituted.
Long absolute address cannot be forced - substituting I/O short addressing
Long absolute addressing is not valid for this operation. The Assembler substitutes
I/O short addressing.
Long absolute address cannot be forced - substituting short addressing
Long absolute addressing is not valid for this operation. The Assembler substitutes
short absolute addressing.
Long displacement cannot be forced
Long displacement addressing is not valid for this operation. An appropriate size
for the target DSP is substituted.
Long immediate cannot be forced
Long immediate data is not valid for this operation. An appropriate size for the target DSP is substituted.
Long PC-relative address cannot be forced
Long PC-relative addressing is not valid for this operation. An appropriate addressing mode (short PC-relative) is substituted.
Macro expansion not active
A macro must have been called prior to using the @ARG() or @CNT() functions
(see Chapter 3).
Macro name is the same as existing Assembler directive
Macro name is the same as existing Assembler mnemonic
The name of the macro being defined conflicts with the name of an Assembler directive or mnemonic. Either use a different macro name or use the RDIRECT directive to remove the directive or mnemonic name from the Assembler lookup
tables.
C-8
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Messages
Warnings
No control registers accessed - using MOVE encoding
A MOVEC-type instruction was given but no control registers were used as operands. The Assembler substitutes a valid encoding for the operands in question.
No looping construct found - .BREAK ignored
No looping construct found - .CONTINUE ignored
A .BREAK or .CONTINUE structure control statement was encountered outside of
any active looping construct (.FOR, .LOOP, .REPEAT, .WHILE).
Number of macro expansion arguments is greater than definition
Number of macro expansion arguments is less than definition
A discrepancy exists between the number of arguments specified in a macro definition and the number of arguments provided in the macro call.
Options for both absolute and C mode specified - C mode ignored
Both the -A and -C options were given on the command line. The -A option takes
precedence.
Options for both debug and strip specified - strip ignored
Both the -G and -Z options were given on the command line. The -G option takes
precedence.
P space not accessed - using MOVE encoding
A MOVEP-type instruction was given but a P memory reference was not used as
an operand. The Assembler substitutes a valid encoding for the operands in question.
Page directive with no arguments ignored with page length of zero
A PAGE directive with no arguments, which ordinarily produces a form feed in the
listing output, is ignored because a previous PAGE directive specified a page
length of zero.
PC-relative address involves incompatible memory spaces
The memory space attribute is regarded by the Assembler as a type, in the same
sense that high level languages use type for variables. Symbols may have memory
space attributes of X, Y, L, P(rogram), E(MI), or N(one); only N is fully compatible
with all other attributes. In this case, an operand was evaluated with a different
memory space attribute than that specified in the instruction.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-9
Assembler Messages
Warnings
PC-relative address too large to use short - long substituted
The PC-relative offset is not within the range specifying a short PC-relative offset,
even though the short forcing operator has been used. The Assembler substitutes
long PC-relative addressing.
Pipeline stall reading register written in instruction at address xxxx
Pipeline stall reading register written in previous instruction
The Assembler warns when an extra cycle is inserted to circumvent a bus conflict.
Possible duplicate destination register
In the DSP96000 assembly language there is potential ambiguity in the specification of registers for some types of DALU instructions and parallel moves. The Assembler detects the ambiguity and warns if a duplicate register write is possible.
Post-update operation will not occur on destination register
If the source operand in a MOVE operation specifies a post-update addressing
mode and the destination register is the same as the source operand register then
the post-update operation will not take place.
PRCTL directive ignored - no explicit listing file
The PRCTL directive takes effect only if the -L option is used on the command line
to explicitly specify a listing file.
Redefinition of symbol
A symbol used in a DEFINE directive has been redefined without an intervening
UNDEF directive. The Assembler discards the previous definition and replaces it
with the new definition.
Relative address involves incompatible memory spaces
The target of a jump or branch instruction is not assigned to program memory.
Rounding not available with LMS move - using MAC/MPY encoding
A MACR or MPYR instruction was specified in conjunction with LMS move syntax.
Runtime location counter overflow
Runtime location counter underflow
The runtime location counter exceeded its maximum or minimum value. The Assembler wraps the counter value around and continues.
C-10
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Messages
Warnings
Runtime origin involves incompatible memory spaces
The memory space attribute is regarded by the Assembler as a type, in the same
sense that high level languages use type for variables. Symbols may have memory
space attributes of X, Y, L, P(rogram), E(MI), or N(one); only N is fully compatible
with all other attributes. In this case, an operand was evaluated with a different
memory space attribute than that specified in the directive.
Runtime reserved address space violation
The runtime location counter has incremented into a reserved area of data address
space.
Short absolute address cannot be forced
Short absolute addressing is not valid for this operation. An appropriate addressing
mode (long absolute) is substituted.
Short absolute address cannot be forced - long substituted
Short absolute addressing is not valid for this operation. The Assembler substitutes
long absolute addressing.
Short displacement cannot be forced
Short displacement addressing is not valid for this operation. An appropriate addressing mode (long displacement) is substituted.
Short immediate cannot be forced
Short immediate data is not valid for this operation. An appropriate size is substituted.
Short PC-relative address cannot be forced
Short PC-relative addressing is not valid for this operation. An appropriate addressing mode (long PC-relative) is substituted.
Signed operand must come first in signed/unsigned combinations
In a MPYSU, MACSU, or DMACSU instruction, the signed operand must come first
in the operand ordering.
Source operand assumed I/O short
Neither operand in a MOVEP instruction is explicitly declared I/O short; however,
the destination operand does not qualify, so the source operand is assumed to be
the I/O short operand.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-11
Assembler Messages
Warnings
Storage block size not a power of 2
The expression in a DSR directive did not evaluate to a power of 2. Since the DSR
directive is generally used to allocate FFT buffers for reverse carry operations, the
size of the buffer may be in error.
String truncated in expression evaluation
Only the first four characters of a string constant are used during expression evaluation except for arguments to the DC directive (see Chapter 6).
Strip not valid in relocatable mode - ignored
The -Z option is valid only when the -A option is also given.
Two-word instruction assembled at odd address in interrupt vector locations
A two-word instruction may only be assembled at an even address within the interrupt vector range.
Unresolved external reference
Ordinarily the Assembler does not flag unresolved references in relative mode, assuming they will be resolved at link time. If the UR option is specified, the Assembler will generate this warning if any symbols are undefined during the second
pass.
Using TFR3 encoding - only limiting performed on register transfer
A parallel move was performed with an accumulator source register in the second
data move field. The Assembler assumes a TFR3 transfer.
C-12
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Messages
Errors
C.4
ERRORS
Absolute address contains forward reference - force short or I/O short address
The Assembler attempted a default to short addressing which failed. Either the absolute address is too large or it needs to be forced I/O short.
Absolute address must be either short or I/O short
The absolute address is too large for a short address and outside the range of valid
I/O short addresses.
Absolute address too large to use I/O short
Absolute address too small to use I/O short
The absolute address being forced short is outside the range of valid I/O short addresses. This usually means that the I/O short address has not been ones extended.
Absolute address too large to use short
The absolute address value is too large to be forced short.
Absolute addressing mode not allowed
Absolute operands are not allowed with some instructions, in particular parallel XY
data memory moves.
Address mode syntax error - expected ')'
Address mode syntax error - expected '+'
Address mode syntax error - expected '+' or '-'
Address mode syntax error - expected comma
Address mode syntax error - expected comma or end of field
Address mode syntax error - expected offset register
Address mode syntax error - extra characters
Address mode syntax error - probably missing ')'
A syntax error was detected when scanning the source line operand and/or X and
Y data fields. These errors may indicate omission of a source operand, insufficient
white space between fields, or improper specification of address register indirect
addressing modes.
Argument outside function domain
An argument to one of the transcendental built-in functions was inappropriate.
Arithmetic exception
An internal floating point exception occurred while evaluating an expression. The
result of the evaluation is probably not valid.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-13
Assembler Messages
Errors
Assembler directive or mnemonic not found
An argument to the RDIRECT directive was not a recognized Assembler directive
or mnemonic.
Base argument larger than machine word size
The base parameter of a @FLD() function has a value larger than can fit in the target machine word.
Binary constant expected
A character other than ASCII '0' or '1' either followed the binary constant delimiter
(%) or appeared in an expression where a binary value was expected by default.
Bit operation on SSH or SSL cannot follow update of SP or SC
A move to the SP or SC register was followed by a bit manipulation instruction with
destination of SSH or SSL. This operation is prohibited by the machine architecture.
Bit mask cannot span more than eight bits
If the first operand of a BFxxx-type instruction was shifted one bit to the right until
the low-order bit was a 1, the resulting value must not exceed $FF hexadecimal.
Cannot conditionally repeat write to memory
A move to memory cannot be preceded by a REPcc-type instruction.
Cannot nest section inside itself
A section of a given name may not have another SECTION directive with the same
name declared inside it.
Cannot nest symbol definitions
A source-level debug .DEF directive was encountered inside another .DEF-.ENDEF pair.
Cannot open include file
The specified INCLUDE file cannot be found, or the operating system limit on open
files has been exceeded.
Cannot repeat this instruction
Cannot repeat two-word instruction
The REP instruction cannot be used to repeat two-word instructions or instructions
that change program flow. Instructions that cannot be repeated include DO, Jcc,
JCLR, JMP, JSET, JScc, JSCLR, JSR, JSSET, REP, RTI, RTS, and SWI.
C-14
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Messages
Errors
CONST option must be used before any label
This option, which prevents EQU symbols from being exported to the object file,
must be given before any label is encountered in the source file.
Contents of register written in previous instruction not available
Due to pipelining, if an address register (Rn or Nn) is changed in the previous instruction, the new contents are not available for use as a pointer until the next instruction.
Count must be an integer value
The argument to a DUP directive did not evaluate as an integer expression.
CRE option must be used before any label
The CRE option must be activated before any labels are encountered so that the
Assembler can append cross-reference data to all applicable symbol table entries.
Data allocation exceeds buffer size
Data allocated between a BUFFER-ENDBUF sequence exceeded the size specified in the BUFFER directive.
Decimal constant expected
A character other than ASCII '0' through '9' either followed the decimal constant delimiter (‘) or appeared in an expression where a decimal value was expected by default.
DEFINE symbol must be a global symbol name
A local label (a symbol beginning with the underscore character) may not be used
as a DEFINE directive symbol.
Directive not allowed in EMI memory
Any kind of buffer directive is disallowed when the runtime memory space is E(MI).
Displacement addressing mode not allowed
Long displacement addressing is not allowed with some instructions, in particular
parallel XY data memory moves.
Displacement must be short
The offset operand value is too large for the space allotted in the instruction.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-15
Assembler Messages
Errors
Displacement too large to use short
The displacement value being forced short is too large to fit into the instruction
word.
Divide by zero
The expression evaluator detected a divide by zero.
DO loop address must be in current section
The loop address of a DO loop cannot fall outside the bounds of its enclosing section. This is particularly important in relative mode as the loop address is calculated based on the starting address of the section.
Dummy argument not found
The dummy argument name given as an argument to the @ARG() function was
not found in the macro dummy argument list.
Duplicate destination register not allowed
If the opcode-operand portion of an instruction specifies a destination register, the
same register or portion of that register may not be specified as a destination in the
parallel data bus move operation.
Duplicate source and destination register not allowed
If the opcode-operand portion of an instruction specifies a source register, the
same register or portion of that register may not be specified as a destination in the
parallel data bus move operation.
Either source or destination memory space must be X or Y
One of the operands in a MOVEP instruction must reference a location in X or Y
memory.
ELSE without associated IF directive
An ELSE directive was encountered without a preceding IF conditional assembly
directive.
.ELSE without associated .IF directive
An .ELSE directive was encountered before a matching .IF conditional structured
control statement.
Empty bit mask field
The first operand of a BFxxx-type instruction was zero.
C-16
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Messages
Errors
End of structure or union without matching definition
A source-level debug end-of-structure symbol declaration was recognized without
a preceding structure or union definition.
ENDBUF without associated BUFFER directive
An ENDBUF directive was encountered without a preceding BUFFER directive.
.ENDEF without associated .DEF directive
A source-level debug .ENDEF directive was encountered without a preceding
.DEF directive.
.ENDF without associated .FOR directive
.ENDI without associated .IF directive
An end-of-conditional or end-of-loop directive was encountered before a matching
conditional or loop structured control statement.
ENDIF without associated IF directive
An ENDIF directive was encountered without a preceding IF conditional assembly
directive.
.ENDL without associated .LOOP directive
An end-of-loop directive was encountered before a matching loop structured control statement.
ENDM without associated MACRO directive
An ENDM directive was encountered without a preceding MACRO directive.
ENDSEC without associated SECTION directive
An ENDSEC directive was encountered without a preceding SECTION directive.
.ENDW without associated .WHILE directive
An end-of-loop directive was encountered before a matching loop structured control statement.
EQU requires label
The EQU directive must have a label to associate with the equated expression.
EXITM without associated MACRO directive
An EXITM directive was encountered without a preceding MACRO directive.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-17
Assembler Messages
Errors
Expression cannot have a negative value
Some directives do not allow negative expression arguments, as for example in the
PAGE directive controls.
Expression contains forward references
Some directives do not allow expression arguments which have not yet been defined in the source, as for example in the IF, EQU, or SET directives.
Expression involves incompatible memory spaces
The memory space attribute is regarded by the Assembler as a type, in the same
sense that high level languages use type for variables. Symbols may have memory
space attributes of X, Y, L, P(rogram), E(MI), or N(one); only N is fully compatible
with all other attributes. In this case, two operands were evaluated with different
memory space attributes, neither of which was N.
Expression must be greater than zero
Some directives require a nonzero argument, as for example in the BSC directive.
Expression result must be absolute
Certain directives and some Assembler usage require absolute values as arguments or operands.
Expression result must be integer
Certain directives and some Assembler usage require integer values as arguments
or operands.
Expression result too large
The expression evaluated to a value greater than the acceptable range. This error
can occur when an expression result exceeds the native word size of the target
DSP.
External reference not allowed in expression
References to external symbols (e.g. symbols not defined in the current assembly
source input) are not allowed in some types of byte or integer expressions.
External reference not allowed in function
References to external symbols (e.g. symbols not defined in the current assembly
source input) are not allowed as direct or indirect arguments to any built-in function.
C-18
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Messages
Errors
Extra characters beyond expression
The expression evaluator found extra characters after the end of a valid expression. Unbalanced parentheses can cause this error.
Extra characters following string
An end-of-string delimiter was followed by unexpected characters on the source
line.
Extra characters following symbol name
A non-alphanumeric character other than the underscore (_) was encountered in a
symbol name.
Extra characters in function argument or missing ')' for function
Mismatched parentheses or wrong number of parameters in a function invocation.
Extra characters in operand field
The PAGE directive contains too many operands.
Extra fields ignored
There were extra fields specified in an Assembler directive.
First data move destination accumulator same as operand destination accumulator
The destination of the data move field is the same as the Data ALU destination.
First data move field required with this instruction
A TFR3 instruction requires a register and a data move operand field.
First data move source accumulator same as operand destination accumulator
The source of the data move field is the same as the Data ALU destination.
Floating point constant expected
A character other than ASCII '0' through '9', 'e' or 'E', or '.' appeared in an expression where a floating point value was expected by default.
Floating point not allowed in relative expression
Relative expressions are generally used for address computation, therefore a floating point value would not be appropriate.
Floating point value not allowed
An immediate value expressed in floating point notation is only valid in a MOVEtype instruction.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-19
Assembler Messages
Errors
Forcing not specified
The type of forcing operand was not given in a FORCE directive.
Function result out of range
The result computed by a transcendental function was too large to be represented
on the host machine.
GL option must be used before any section
The GL option must be activated before any explicit sections are encountered so
that the Assembler can insure that all section symbols are global.
GLOBAL without preceding SECTION directive
A GLOBAL directive was encountered outside any previously defined section.
GS option must be used before any section
The GS option must be activated before any explicit sections are encountered so
that the Assembler can use the appropriate counters for section relocation.
Hex constant expected
A character other than ASCII '0' through '9', 'a' through 'f', or 'A' through 'F' either
followed the hexadecimal constant delimiter ($) or appeared in an expression
where a hexadecimal value was expected by default.
IC option must be used before any symbol, section, or macro definition
The IC option must be activated before any symbols, sections, or macros are defined so that the Assembler can remain consistent when storing label names in the
symbol table.
IDENT directive must contain revision number
IDENT directive must contain version number
The version and revision numbers are both required arguments for the IDENT directive.
Illegal directive in buffer declaration
A directive was encountered between a BUFFER-ENDBUF pair that is not allowed
in that context. Some invalid directives include any other buffer-type directive
(DSM, DSR, etc.), section directives, or any directive which alters the current location counter designation (MODE, ORG).
C-20
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Messages
Errors
Illegal directive inside .DEF-.ENDEF declaration
Illegal directive outside .DEF-.ENDEF declaration
Some source-level debug directives, such as .FILE, make no sense and are not
allowed inside .DEF-.ENDEF declarations. Conversely, other directives such as
.VAL are not allowed outside of a .DEF-.ENDEF declaration.
Illegal directive inside DO loop
A directive was encountered inside a DO loop that is not allowed in that context.
Some invalid directives include any buffer-type directive (DSM, DSR, etc.), section
directives, or any directive which alters the current location counter designation
(MODE, ORG).
Illegal function argument
An invalid argument was passed to one of the Assembler built-in functions, in particular the @LCV() function.
Illegal instruction in single-instruction DO loop
A conditional break instruction (BRKcc) cannot be used as the only instruction in
a DO loop.
Illegal memory counter specified
The memory counter designation supplied in the ORG directive was not one of H
(high), L (low), or a positive integer expression in parentheses.
Illegal memory map character
The memory map character supplied in the ORG directive was not one of I (internal), E (external), R (ROM), A (port A), or B (port B).
Illegal memory space specified
Illegal memory space specified - L:
Illegal memory space specified - P:
Illegal memory space specified - X:
Illegal memory space specified - Y:
The memory space given is either invalid or inappropriate for the desired operation.
Illegal move field destination specified
Illegal move field destination register specified
The destination operand in a data memory move is invalid for the type of instruction
specified.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-21
Assembler Messages
Errors
Illegal move field source specified
The source operand in a data memory move is invalid for the type of instruction
specified.
Illegal operator for floating point element
Bitwise operators are invalid for floating point values.
Illegal option
An argument to the OPT directive is invalid.
Illegal processor type
The argument to the -P command line option is invalid.
Illegal revision
The argument to the -R command line option is invalid.
Illegal secondary mnemonic
The secondary mnemonic to an FMPY instruction was not one of FADD, FSUB, or
FADDSUB.
Illegal use of SSH as loop count operand
The contents of the system stack high register may not be used as the loop count
operand of a DO instruction.
Illegal X field destination specified
Illegal X field destination register specified
Illegal Y field destination specified
The destination operand in an X or Y memory data move is invalid for the type of
instruction specified.
Illegal Y field source specified
The source operand in an X memory data move is invalid for the type of instruction
specified.
Immediate addressing mode not allowed
Immediate operands are not allowed with some instructions, in particular program
memory moves (MOVEM).
Immediate operand not allowed
Immediate operands are not allowed with some instructions, in particular program
memory moves (MOVEM).
C-22
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Messages
Errors
Immediate operand required
The ANDI and ORI instructions must have an immediate value as the source operand.
Immediate value outside 0..55 range
The immediate operand for a multi-bit arithmetic shift is too large for the space allotted in the instruction.
Immediate value too large
The immediate operand value is too large for the space allotted in the instruction.
Immediate value too large to use short
The immediate value being forced short is too large to fit into the instruction word.
Increment value cannot be zero
The increment parameter to a DUPF directive must be greater than zero.
Indexed address mode not allowed
XY parallel data moves and the LEA instruction do not allow indexed addressing
mode.
Initial debug directive must be .FILE
In a source file containing debug directives being assembled with the -G option the
.FILE directive must be the first source-level debug directive in the input stream.
Instruction cannot appear at last address of a DO loop
Instruction cannot appear at next to last address of a DO loop
Instruction cannot appear within last 2 words of a DO loop
Instruction cannot appear within last 3 words of a DO loop
Some instructions are restricted within a variable range of the DO instruction loop
address. These instructions include DO, ENDDO, JMP, Jcc, JCLR, JSET, and
moves to or from particular control registers.
Instruction cannot appear immediately after arithmetic or logical instruction
A BREAK instruction must not appear immediately after any DALU instruction.
Instruction cannot appear immediately after control register access
Some instructions must not appear immediately after certain control registers have
been accessed. These instructions include RTI, RTS, DO, and ENDDO.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-23
Assembler Messages
Errors
Instruction does not allow data movement specified
The desired operation may only be done with a MOVE instruction.
Invalid address expression
An attempt was made to evaluate an expression consisting of two relative terms
with the same sign.
Invalid addressing mode
The addressing mode of one of the operands in the instruction was not recognized.
Invalid buffer type
The buffer type specified in a BADDR or BUFFER directive was not one of M (modulo) or R (reverse-carry).
Invalid conditional register transfer syntax
The syntax for an IFcc or FFcc conditional address register move was incorrect.
Invalid destination register
The first data move destination register in a double memory read operation was not
valid.
Invalid dummy argument name
Macro argument names cannot be local symbols, e.g. they cannot begin with the
underscore (_) character.
Invalid force type
The argument to a FORCE directive must be SHORT, LONG, or NONE.
Invalid function name
The name following the function invocation character (@) was not recognized.
Invalid label field width specified
The argument given to the LSTCOL directive does not allow enough room on the
listing line for the remaining fields to be output.
Invalid macro name
Macro names cannot be local symbols, e.g. they cannot begin with the underscore
(_) character.
Invalid memory space attribute
The memory space attribute given is not one of the letters X, Y, L, P, or E.
C-24
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Messages
Errors
Invalid mode
The mode specified in a MODE directive was not either RELATIVE or ABSOLUTE.
Invalid opcode field width specified
Invalid opcode 2 field width specified
Invalid operand field width specified
Invalid operand 2 field width specified
The argument given to the LSTCOL directive does not allow enough room on the
listing line for the remaining fields to be output.
Invalid option for target processor
The PSM/NOPSM options are only available on the 56100 series of processors.
Invalid page length specified
The minimum page length allowed by the PAGE directive is 10 lines per page. The
maximum is 255.
Invalid page width specified
The minimum page width allowed by the PAGE directive is 1 column per line. The
maximum is 255.
Invalid radix expression
The expression in the RADIX directive does not evaluate to one of the supported
constant bases (2, 8, 10, or 16).
Invalid register combination
The source operand registers in a FMPY instruction cannot be used together.
Invalid register specified
The direct register operand is incorrect for this instruction.
Invalid relative expression
The terms of a relative expression may only participate in addition and subtraction
operations and must have opposing signs.
Invalid secondary opcode
The opcode in the second operation field is not one of the instructions FADD,
FSUB, or FADDSUB.
Invalid section directive modifier
The qualifier specified in a SECTION directive was not either GLOBAL or STATIC.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-25
Assembler Messages
Errors
Invalid section name
Section names cannot be local symbols, e.g. they cannot begin with the underscore (_) character.
Invalid shift amount
A shift expression must evaluate to within the range 0 <= n <= m, where m is the
maximum address of the target DSP.
Invalid source address mode
The source address mode in a MOVEP instruction was not valid.
Invalid source address register
Invalid source register
The source register in a double memory read operation was not valid.
Invalid storage class
The storage class given in a source-level debug symbol declaration is unknown.
Invalid tabs stops specified
The argument to the TAB directive is out of range.
Invalid X field destination address mode
Invalid X field source address mode
The address mode in the source or destination of the X data move field was invalid.
Invalid X field width specified
Invalid Y field width specified
The argument given to the LSTCOL directive does not allow enough room on the
listing line for the remaining fields to be output.
Invalid XY address register specification
In some XY memory parallel data moves, if the register forming the effective address of the X data field is from the set R0-R3, the effective address register in the
Y field must be from the set R4-R7. Conversely, if the register forming the effective
address of the X data field is from the set R4-R7, the effective address register in
the Y field must be from the set R0-R3.
Invalid XY data register specification
In some XY memory parallel data moves, if the data register of the X data field is
from the set D0-D3, the data register in the Y field must be from the set D4-D7.
C-26
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Messages
Errors
Conversely, if the data register of the X data field is from the set D4-D7, the data
register in the Y field must be from the set D0-D3.
I/O short addressing mode not allowed
An operand was forced I/O short when I/O short addressing was not allowed.
Jump based on SSH or SSL cannot follow update of SP
Jump via SSH or SSL cannot follow write to SP
A JSET, JCLR, JSSET, or JSCLR instruction which tested a bit in either the SSH
or SSL register was immediately preceded by a MOVE to the SP register.
L space specified for load, but not for runtime
L space specified for runtime, but not for load
Since L memory space is the only double-wide memory space, if L memory space
is the runtime memory space, the only valid load memory space is L. Likewise, L
memory space can never be specified as the load memory space if runtime memory space is X, Y, or P.
LB option must be used before any code or data generation
The LB option must be specified before any code or data in order for the Assembler
to increment the location counter appropriately.
LB option not allowed in EMI load memory
The LB option is not supported when the load memory is configured as EMI memory.
LDB option must be used before any code or data generation
The LDB option must be specified before any code or data in order for the Assembler to establish the debug source file appropriately.
Left margin exceeds page width
The blank left margin value in the PAGE directive exceeds the default or specified
page width parameter.
Length value greater than string size
The length parameter in a substring construct is larger than the composite length
of the input string argument.
Line too long
Source statements, including continuation lines, cannot exceed 512 characters in
length.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-27
Assembler Messages
Errors
LOC option must be used before any local label
The LOC option must appear before any local label so that the Assembler can keep
the local label lists synchronized.
LOCAL directive not valid in global section
The LOCAL directive is not allowed inside an implicit or explicit global section.
Local symbol names cannot be used with GLOBAL
Local symbol names cannot be used with LOCAL
Local symbol names cannot be used with XDEF
Local symbol names cannot be used with XREF
Underscore labels are not allowed with this directive.
LOCAL without preceding SECTION directive
A LOCAL directive was encountered outside any previously defined section.
Long absolute address cannot be used
An operand was forced long where only a short or I/O short address was valid.
Long absolute cannot be used - force short or I/O short
A forward reference was forced long where only a short or I/O short address was
valid.
Macro cannot be redefined
A macro name cannot be used as the label for a second macro definition in the
same source file unless the macro is defined and used within a declared section
(see the SECTION directive, Chapter 6).
Macro not defined
The macro name was not found in the macro lookup table.
Macro value substitution failed
The evaluation of a macro argument expression failed.
Memory bounds greater than maximum address
The bounds argument in a LOMEM or HIMEM directive is invalid.
Memory counter designator value too large
The integer counter designator in an ORG directive is greater than 65535.
C-28
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Messages
Errors
Memory space must be P or NONE
An END directive was encountered while the runtime memory space was X, Y, or L.
Missing '(' for function
All Assembler built-in functions require at least one argument which must be enclosed in parentheses.
Missing ')' in expression
Parentheses are not balanced in an expression.
Missing argument
The argument to a DUPA or DUPC directive was not found.
Missing definition string
The substitution string for a DEFINE directive is missing.
Missing delimiter in substring
A substring construct was missing the closing square bracket.
Missing dimension
The .DIM directive had no arguments.
Missing directive name
The argument to an RDIRECT directive is missing.
Missing expression
An expression was expected by the expression evaluator.
Missing filename
No filename was provided as an argument to the INCLUDE directive.
Missing line number
No line number was provided as an argument to the .LINE directive.
Missing macro name
A MACRO directive was encountered without a label or the macro name was omitted from a PMACRO directive.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-29
Assembler Messages
Errors
Missing memory space specifier
One of the operands of an instruction was expected to have a memory space specifier (X:, Y:, L:, or P:) preceding the address mode specifier.
Missing option
The OPT directive was specified without an argument.
Missing or illegal memory space specifier
One of the operands of an instruction was expected to have a memory space specifier (X:, Y:, L:, or P:) preceding the address mode specifier.
Missing or mismatched quote
A single or double quote character was expected by the string parsing routines.
Missing pathname
No pathname was provided as an argument to the MACLIB directive.
Missing processor type
There was no argument provided for the -P command line option.
Missing quote
Missing quote in string
A single or double quote character was expected by the string parsing routines.
Missing revision
There was no argument provided for the -R command line option.
Missing section name
No section name was given as an argument to the SECTION directive.
Missing size argument
No size value was given as an argument to the .SIZE directive.
Missing string after concatenation operator
The string concatenation operator (++) must be followed by another quoted string.
Missing symbol name
The SYMOBJ, XDEF, and XREF directives require at least one symbol name as
an argument.
C-30
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Messages
Errors
Missing symbol value
No symbol value was given as an argument to the .VAL directive.
Missing tag for end of structure or union
A source-level debug structure or union declaration was found without a corresponding tag definition.
Missing tag name
No tag name was given as an argument to the .TAG directive.
Mnemonic must indicate precision using .S or .X suffix
Floating point instructions generally must indicate the precision of their operation
by appending either .S for single precision or .X for single-extended precision.
Mode not specified
The MODE directive was not followed by either RELATIVE or ABSOLUTE.
Move from SSH or SSL cannot follow move to SP
Move from SSH or SSL cannot follow update to SP
A MOVE instruction using the system stack (SSH or SSL) as a source operand
cannot immediately follow a MOVE which uses the stack pointer (SP) as a destination operand.
MU option must be used before any code or data generation
The MU option must be given before any data allocation directive (BSC, DC, DS,
DSM, DSR) or any instruction appears in the source file.
Negative immediate value not allowed
The immediate count value for a DO or REP instruction cannot be less than zero.
Negative or empty DO loop not allowed
Negative or empty DOR loop not allowed
The loop address given in a DO or DOR instruction must specify an address at
least one greater than the current program counter value.
NOGS option must be used before any section
The NOGS option must be activated before any explicit sections are encountered
so that the Assembler can use the appropriate counters for section relocation.
No previous function declaration
A .EF debugging directive was encountered without a corresponding .BF directive.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-31
Assembler Messages
Errors
Not enough fields specified for instruction
There were no operands specified for a MOVE, MOVEC, MOVEM, or MOVEP instruction.
No-update mode not allowed
The no-update register addressing mode is not allowed for this instruction (e.g., the
LEA instruction).
Offset register number must be the same as address register number
The explicit offset register number in an operand using post-increment, post-decrement, or indexed by offset addressing mode (Nn) is different from the number
specified for the address register (Rn). The offset register number may be omitted
from these types of indirect addressing modes; the Assembler defaults to the address register number.
Offset value greater than string size
The offset parameter in a substring construct is larger than the composite length of
the input string argument.
Only absolute addressing allowed
The instruction allows only absolute addressing.
Only absolute and register direct addressing allowed
The instruction allows only absolute and register direct addressing.
Only immediate addressing allowed
The instruction allows an immediate source operand only.
Only immediate and register direct addressing allowed
The instruction allows only immediate and register direct addressing modes.
Only immediate and register direct and indirect addressing allowed
The instruction allows only immediate, register direct, and register indirect addressing modes.
Only PC-relative addressing allowed
The instruction allows only PC-relative addressing.
Only PC-relative and register direct addressing allowed
The instruction allows only PC-relative and register direct addressing.
C-32
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Messages
Errors
Only post-increment by offset addressing allowed with LMS move
The initial data move destination operand in an LMS move must use post-increment by offset addressing.
Only post-increment or post-increment by offset addressing allowed
Moves to P memory allow only post-increment or post-increment by offset addressing.
Only register direct addressing allowed
The instruction allows only register direct addressing.
Only register direct and indirect addressing allowed
The instruction allows only register direct and indirect addressing.
Only register indirect addressing allowed
The instruction allows only register indirect addressing.
Operation not allowed with address term
Only addition and subtraction are allowed in expressions involving addresses or
relative terms.
Page length too small for specified top and bottom margins
The sum of the top and bottom margins specified in the PAGE directive is greater
than the page length - 10.
Page length too small to allow default bottom margin
The bottom margin exceeds the page length specified in the PAGE directive.
PC-relative address too large to use short
The PC-relative offset being forced short is too large to fit into the instruction word.
PC-relative addressing mode not allowed
The PC-relative addressing mode is not allowed for this instruction. The restriction
applies, for example, to bit manipulation instructions and some jump-type instructions.
Phasing error
The value associated with a symbol has changed between pass 1 of the assembly
and pass 2. This error can occur spontaneously in conjunction with other errors.
The Assembler is designed to avoid phasing errors in general. If a phasing error
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-33
Assembler Messages
Errors
occurs without any other errors this may represent an internal error which should
be reported to Motorola.
One exception is the use of the checksumming function @CHK() with the EQU directive. Instruction encoding may be incomplete after the first pass due to forward
referencing, causing the checksum value to change between passes. Because of
this the SET directive must be used to assign the checksum value to a symbol.
Possible invalid white space between operands or arguments
The Assembler verifies that fields which should not contain operands or values are
empty. If these fields are not empty the Assembler produces this error.
Post-decrement addressing mode not allowed
The post-decrement addressing mode is not allowed for this instruction. The restriction applies, for example, to bit manipulation instructions and some jump-type
instructions.
Post-decrement by offset addressing mode not allowed
The post-decrement by offset addressing mode is not allowed for this instruction.
The restriction applies, for example, to bit manipulation instructions and some
jump-type instructions.
Post-increment addressing mode not allowed
The post-increment addressing mode is not allowed for this instruction. The restriction applies, for example, to bit manipulation instructions and some jump-type instructions.
Post-increment by offset addressing mode not allowed
The post-increment by offset addressing mode is not allowed for this instruction.
The restriction applies, for example, to bit manipulation instructions and some
jump-type instructions.
Pre-decrement addressing mode not allowed
The pre-decrement addressing mode is not allowed for this instruction. The restriction applies, for example, to instructions which include parallel XY memory data
transfers.
RDIRECT directive not allowed in section
Since the effect of the RDIRECT directive is global, it cannot be used within a section which has been declared using the SECTION directive. Move the RDIRECT
directive outside the declared section to avoid this error.
C-34
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Messages
Errors
Redefinition would overflow line
A substitution string declared using the DEFINE directive will cause the current
source line to overflow if substitution occurs.
Reference outside of current buffer block
Reference outside of current overlay block
Reference was made to an underscore local label which fell outside the current
buffer or overlay definition.
Register direct addressing not allowed
Register direct addressing mode is not allowed for this instruction. The restriction
applies, for example, to bit manipulation instructions, some jump-type instructions,
and parallel XY data memory moves.
Register displacement valid only with address register R2
Only address register R2 is valid as a displacement register.
Relative equate must be in same section
An EQU directive with a relative expression operand must be defined in the same
section as the section associated with the operand expression.
Relative expression must be integer
A relative expression must evaluate to an integer value.
Relative expression not allowed
Relative expressions are not allowed as arguments to the Assembler built-in functions.
Relative SET must be in same section
A SET directive with a relative expression operand must be defined in the same
section as the section associated with the operand expression.
Relative terms from different sections not allowed
Relative terms defined in different sections are not allowed in expressions. This is
because the relationship between the terms is based on where the enclosing sections are located in memory.
Relocatable load origin must be in current memory, section, and counter
Relocatable runtime origin must be in current memory, section, and counter
The origin expression does not refer to the current memory space, section, or location counter number.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-35
Assembler Messages
Errors
Reserved name used for symbol name
One of the DSP register names has been used as a label, operand, or directive argument. These register names, in either upper or lower case, are reserved by the
Assembler. See Appendix F for a list of DSP register names.
Runtime space must be P
An instruction was encountered and the runtime memory space was not set to P
(Program).
SCO option must be used before any label
The SCO option sends structured control statements to the object file and thus
must be specified before any symbols are defined in the source file.
Second data move destination accumulator same as operand destination
accumulator
The destination accumulator in a double memory read instruction is the same as
the DALU accumulator specification.
Secondary opcode not allowed
The secondary opcode field is allowed only with the FMPY instruction.
Section not encountered on pass 1
The section declared in a SECTION directive was not encountered during the first
pass of the Assembler. This situation indicates an internal Assembler error and
should be reported to Motorola.
SET requires label
The SET directive must have a label in order to associate the directive argument
with a symbol name.
SET symbol names cannot be used with GLOBAL
SET symbol names cannot be used with LOCAL
SET symbol names cannot be used with XDEF
A symbol defined using the SET directive cannot be exported from a section using
GLOBAL, LOCAL, or XDEF.
Short absolute address too large
The flagged operand value is greater than the maximum short address of the target
DSP.
C-36
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Messages
Errors
Short displacement too large
The flagged operand value is greater than the maximum short displacement of the
target DSP.
Short I/O absolute address too large
Short I/O absolute address too small
The flagged operand value is outside the I/O address range of the target DSP.
Short or I/O short address expected
A short or I/O short address was expected as the second operand of a JCLR,
JSET, JSCLR, or JSSET instruction.
Short PC-relative address too large
The flagged operand value is greater than the maximum PC-relative address of the
target DSP.
SSH cannot be both source and destination register
In a MOVE instruction, the SSH register cannot be both the source and destination
operand.
Start argument greater than machine word size
The start parameter of a @FLD() function has a value larger than can fit in the target machine word.
Start position greater than source string size
The start parameter in a @POS() function is larger than the total length of the
source string argument.
Storage block size must be greater than zero
The size of a buffer allocated with the DSM, DSR, BSM, BSB, and other buffer directives was too small.
Storage block size out of range
The size of the buffer in a DSM, DSR, BSM, BSB, or other buffer directive is too
large to be allocated.
Storage block too large
The runtime location counter overflowed while the Assembler was attempting to allocate storage through a DSM or DSR directive. The Assembler automatically advances the program counter to the next valid base address given the size of the
modulo or reverse carry buffer. This error occurs when the sum of the expression
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-37
Assembler Messages
Errors
in the DSM or DSR directive and the runtime location counter value exceed available memory in the current memory space.
Structure or union tag mismatch
A matching tag name could not be found for the current source-level debug structure or union declaration.
Subroutine branch not allowed after write to SP or SC register
Subroutine jump not allowed after write to SP or SC register
A subroutine call cannot be made immediately after a move to the SP or SC registers.
Subroutine branch to loop address not allowed
A BSR, BScc, BSSET, or BSCLR instruction cannot have as its target the loop address of the current DO loop.
Subroutine jump to loop address not allowed
A JSR, JScc, JSSET, or JSCLR instruction cannot have as its target the loop address of the current DO loop.
SVO option must be used before any code or data generation
The SVO option must be given before any data allocation directive (BSC, DC, DS,
DSM, DSR) or any instruction appears in the source file.
Symbol already defined as GLOBAL
Symbol already defined as LOCAL
Symbol already defined as XDEF
Symbol already defined as XREF
The symbol used in an GLOBAL, LOCAL, XDEF, or XREF directive has already
been defined in a previous directive of the same type.
Symbol already defined as global
A symbol specified in an XDEF directive has already been defined as global outside the current section.
Symbol already defined in current section
A symbol specified in an XREF directive has already been defined as private within
the current section.
Symbol already used as SET symbol
The label has already been used in a SET directive. A symbol defined with SET
cannot be redefined except through another SET directive.
C-38
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Messages
Errors
Symbol cannot be set to new value
The label has been defined previously other than with the SET directive. Only symbols defined using the SET directive may be redefined.
Symbol defined in current section before GLOBAL directive
Symbol defined in current section before XDEF directive
The GLOBAL or XDEF directive must appear within a section prior to the definition
of any symbols in its argument list. Any symbols within a section which must be
accessible outside the section should be declared in a GLOBAL or XDEF directive
immediately following the SECTION directive.
Symbol name too long
Symbols are limited to 512 characters. The first character must be alphabetic or the
underscore character (A-Z, a-z, _). The remaining characters must be alphanumeric, including the underscore character (A-Z, a-z, 0-9, _).
Symbol not previously defined
The symbol specified in an UNDEF directive was not previously defined in a DEFINE directive.
Symbol redefined
The symbol has already been used as a label in a previous context.
Symbol tag mismatch
A matching tag reference could not be found for a tagged symbol table entry.
Symbol undefined on pass 2
The symbol used as an operand or directive argument was never defined in the
source program.
Symbols must start with alphabetic character
Symbol names must begin with an upper or lower case alphabetic character or the
underscore character (_).
SYMOBJ symbol must be a global symbol name
Arguments to the SYMOBJ directive cannot be preceded by an underscore.
Syntax error - expected '):'
In an ORG directive using numeric counter designations the parenthesis/colon pair
separating the load or runtime address from the memory space, counter, or mapping characters was not found.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-39
Assembler Messages
Errors
Syntax error - expected ':'
In an ORG directive the colon separating the load or runtime address from the
memory space, counter, or mapping characters was not found.
Syntax error - expected '>'
The closing angle bracket in a non-local INCLUDE directive argument was not
found.
Syntax error - expected comma
The comma separating operands in an instruction or directive was not found.
Syntax error - expected keyword BY
In a .FOR structured control statement something other than the optional step
clause preceded by the keyword BY was encountered.
Syntax error - expected keyword DO
In a .WHILE structured control statement something other than the optional DO
keyword was encountered at the end of the statement.
Syntax error - expected keyword TO or DOWNTO
In a .FOR structured control statement something other than the loop target clause
preceded by the keyword TO or DOWNTO was encountered.
Syntax error - expected quote
The Assembler was expecting the start of a quoted string.
Syntax error - extra characters
Extra characters were found after an instruction or directive operand.
Syntax error - invalid assignment operator
The loop assignment operator in a .FOR structured control statement is not an
equals sign (=).
Syntax error - invalid compound operator
Structured control statement compound operators are either AND or OR.
Syntax error - invalid conditional operator
The conditional operator in a structure control statement expression is not valid.
Syntax error - invalid expression format
The condition code expression in a structured control statement is malformed.
C-40
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Messages
Errors
Syntax error - invalid statement terminator
There were extra or invalid characters found at the end of a structured control
statement.
Syntax error - missing address mode specifier
An instruction operand was not specified.
Syntax error - missing operand
An operand in a structured control statement expression was missing.
Syntax error in directive name list
A character other than a comma was found separating the arguments in an RDIRECT or SYMOBJ directive name list.
Syntax error in dummy argument list
A character other than a comma was found separating the dummy arguments in a
macro definition (MACRO directive), or a dummy argument began with the underscore character (_).
Syntax error in macro argument list
A character other than a comma was found separating the arguments in a macro
call.
Syntax error in macro name list
A character other than a comma was found separating the arguments in a PMACRO directive name list.
Syntax error in symbol name list
A character other than a comma was found separating the arguments in an XDEF
or XREF directive name list.
Tag name not found
A matching tag name could not be found for the current source-level debug structure or union declaration.
Too many fields specified for instruction
An instruction field that was expected to be empty contained data other than a comment. This can happen when an instruction using only the X data transfer field encounters data other than a comment in the Y data transfer field.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-41
Assembler Messages
Errors
Two dummy arguments are the same
Two dummy arguments in a macro definition (MACRO directive) have the same
name.
UNDEF symbol must be a global symbol name
The argument to an UNDEF directive cannot be a local label, e.g. a name starting
with the underscore character (_).
Unexpected end of file - missing .ENDF
Unexpected end of file - missing .ENDI
Unexpected end of file - missing .ENDL
Unexpected end of file - missing .ENDW
Unexpected end of file - missing .UNTIL
The matching end-of-conditional or end-of-loop directive for a conditional or looping structured control statement was never found.
Unexpected end of file - missing COMMENT delimiter
The second occurrence of the delimiter character in a COMMENT directive was
never found.
Unexpected end of file - missing ENDBUF
A BUFFER directive was encountered without a closing ENDBUF directive.
Unexpected end of file - missing ENDIF
An IF directive was encountered without a closing ENDIF directive.
Unexpected end of file - missing ENDM
A macro definition was started using the MACRO directive, but the end of the
source file was encountered before a closing ENDM directive was found.
Unexpected end of file - missing ENDSEC
A SECTION directive was found without a closing ENDSEC directive.
Unknown math error
A transcendental math function returned an error that could not be classified as out
of range or outside the function domain.
Unrecognized mnemonic
A symbol in the Assembler opcode field was not a defined macro, an instruction
mnemonic, or a directive.
C-42
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Messages
Errors
Unrecognized secondary mnemonic
A symbol in the Assembler secondary opcode field was not one of the instructions
FADD, FSUB, or FADDSUB.
.UNTIL without associated .REPEAT directive
An .UNTIL directive was encountered before a matching .REPEAT structured control statement.
Value argument larger than machine word size
The value parameter of a @FLD() function has a value larger than can fit in the target machine word.
Width argument greater than machine word size
The width parameter of a @FLD() function has a value larger than can fit in the target machine word.
XDEF without preceding SECTION directive
XREF without preceding SECTION directive
An XDEF or XREF directive was encountered outside any previously defined section.
XLL option must be used before any local label
The XLL option must be activated before any local labels are encountered so that
the Assembler can make the appropriate entries in the symbol table.
XR option must be used before any label
The XR option must be activated before any labels are encountered so that the Assembler can make the appropriate entries in the symbol table.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-43
Assembler Messages
Fatal Errors
C.5
FATAL ERRORS
Attempt to store external reference data in absolute mode
An attempt was made to create an external reference entry while the Assembler
was in absolute mode. This is an internal error that should be reported to Motorola.
Attempt to write relocation entry in absolute mode
An attempt was made to write a relocation entry to the object file while the Assembler was in absolute mode. This is an internal error that should be reported to Motorola.
<mode> encoding failure
A bad address mode indicator or register number was passed to the Assembler encoding routines. <mode> represents the register set or addressing mode in question. This is a serious internal error that should be reported to Motorola.
Absolute mode select failure
The mode indicator passed to the absolute addressing mode selection logic was
not valid. This is a serious internal error that should be reported to Motorola.
Arithmetic exception
An internal floating point exception occurred while evaluating an expression. The
Assembler cannot continue.
block size select error
The word size parameter while processing a BSCB, BSCW, or BSCL directive has
been corrupted. This is a serious internal error that should be reported to Motorola
Cannot encode instruction
The correspondence between the source opcode mnemonic and the internal opcode type has been corrupted. This is an internal error that should be reported to
Motorola.
Cannot seek to start of line number entries
Cannot seek to start of object data
Cannot seek to start of object file
Cannot seek to start of relocation entries
Cannot seek to start of section headers
Cannot seek to start of string table
Cannot seek to start of symbol table
An I/O error occurred which prevented the Assembler from positioning correctly in
the output object file.
C-44
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Messages
Fatal Errors
Cannot write file header to object file
Cannot write line number entries to object file
Cannot write optional header to object file
Cannot write relocation entries to object file
Cannot write section headers to object file
Cannot write string table to object file
Cannot write symbols to object file
An I/O error occurred which prevented the Assembler from writing data to the output object file.
Cannot write control string to listing file
Cannot write left margin to listing file
Cannot write new line to listing file
Cannot write new page to listing file
Cannot write page header to listing file
Cannot write string to listing file
An I/O error occurred which prevented the Assembler from writing data to the output listing file.
chkdalu failure
chkdrd failure
An internal Assembler check routine has failed.
Compare select error
The comparison indicator passed to the evaluator selection logic was not valid.
This is a serious internal error that should be reported to Motorola.
Debug symbol type failure
The symbol type indicator passed to the debug selection logic was not valid. This
is a serious internal error that should be reported to Motorola.
Directive select error
The directive indicator passed to the directive selection logic was not valid. This is
a serious internal error that should be reported to Motorola.
DO stack out of sequence
The Assembler maintains an internal stack representing DO loop nesting levels.
The internal stack pointers have been corrupted.
do_xy memory space select failure
The memory space passed to the parallel move routines is invalid.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-45
Assembler Messages
Fatal Errors
Error in mnemonic table
The indicator passed to the instruction processing logic was not valid. This is a serious internal error that should be reported to Motorola.
Expression operator failure
Expression operator lookup has failed. This is a serious internal error that should
be reported to Motorola.
Expression stack underflow
An attempt has been made to free an expression when there are none to be freed.
This is an internal error that should be reported to Motorola.
Fatal segmentation or protection fault; contact Motorola
A program error has caused the Assembler to access an invalid host system address. This generally indicates a bug in the Assembler software.
File info out of sequence
File debug information is scrambled. This is a serious internal error that should be
reported to Motorola.
File not encountered on pass 1
The file in the source input list was never processed by the Assembler during pass
1. This is an internal error that should be reported to Motorola.
Immediate mode select error
The mode indicator passed to the immediate addressing mode selection logic was
not valid. This is a serious internal error that should be reported to Motorola.
Input mode stack out of sequence
The stack for recording whether input is from a file or a macro expansion has been
corrupted. This is an internal error that should be reported to Motorola.
Invalid DO loop range check
The value passed to the end-of-DO-loop verification logic is bad. This is an internal
error that should be reported to Motorola.
Invalid instruction class
The saved MAC-type instruction class has been corrupted. This is an internal error
that should be reported to Motorola.
C-46
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Messages
Fatal Errors
Invalid tag storage class
The saved tag storage class has been corrupted. This is an internal error that
should be reported to Motorola.
I/O error writing data word to object file
An I/O error occurred which prevented the Assembler from writing data to the output object file.
Location bounds selection failure
The logic for selecting the appropriate bounds array based on the current memory
space has returned a bad value. This is an internal error that should be reported to
Motorola.
mulreg failure
The register indicators given in a multiply instruction have been corrupted. This is
a serious internal error that should be reported to Motorola.
Option select error
The option indicator passed to the option selection logic (OPT directive) was not
valid. This is a serious internal error that should be reported to Motorola.
Out of memory - assembly aborted
There is not enough internal memory to perform dynamic storage allocation. Since
the Assembler keeps all working information in memory, including the symbol table
and macro definitions, there is the possibility that memory will be exhausted if many
symbols or macros are defined in a single assembly run.
PC-relative mode select failure
The mode indicator passed to the PC-relative addressing mode selection logic was
not valid. This is a serious internal error that should be reported to Motorola.
Register selection failure
The register number passed to the multiply mask selection logic was not valid. This
is a serious internal error that should be reported to Motorola.
Section counter sequence failure
The ordering of location counter structures has been corrupted. This is an internal
error that should be reported to Motorola.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
C-47
Assembler Messages
Fatal Errors
Section stack mode error
The Assembler expected to restore a nested section but found the section list empty. This is an internal error that should be reported to Motorola.
Too many lines in source file
An individual source file contained more than 2**31 lines of code.
Too many sections in module
There is a limit of 255 discrete sections in a given source file.
Unrecognized transformation mnemonic
The lookup of an FADD or FSUB secondary operand failed. This is an internal error
that should be reported to Motorola.
xdst_mem failure
Operands in a register to memory move have been corrupted. This is an internal
error that should be reported to Motorola.
C-48
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Appendix D
ASSEMBLER LISTING FILE FORMAT
D.1
INTRODUCTION
The Assembler always produces a source listing file unless the command line option -OIL
(inhibit listing) is specified. See Chapter 1, Running The Assembler, and the OPT directive
in Chapter 6 for more information on command line and listing options. If the -L command
line option is given, the listing goes to the file named as the option argument; if no argument is specified, the listing file takes the name of the first source file on the command
line and changes the extension to .LST (see Chapter 1). If the -L option is omitted, the
listing is routed to the standard output, which in most cases is the console or user terminal
by default. Most of the operating systems which host the Assembler support I/O redirection, so that the standard output may be redirected to an arbitrary destination (printer, file,
null device, etc.).
D.2
LISTING FILE COMMENTARY
Figure D-1 is an Assembler-generated listing of a program employing a 16-point Decimation in Time Fast Fourier Transform (FFT) routine implemented as a macro. The listing
illustrates a selection of the format features offered by the Assembler. The following section highlights some of those features.
At the top of every listing page is a banner which identifies the Assembler and lists its version number, the date and time of assembly, the current input file name, and the page
number. Following the banner on pages other than the first would appear any titles or subtitles specified using the TITLE and STITLE directives, respectively.
On line 1 of this particular program an OPT directive specifies data value expansion of
declared constants (CEX), cross-referencing of both local and global symbol names (LOC
and CRE), and generation of memory utilization reports at the end of the listing (MU). The
format of cross-reference and memory utilization reports is discussed in later sections.
On line 2 a PAGE directive specifies the page dimensions. Note that line 3 is missing. In
the source file there is a TITLE directive on line 3; TITLE and STITLE directives do not
appear in the listing file. The title itself does not appear until the next page of the listing.
A MACLIB directive declares a macro library path on line 5. The significance of this to the
appearance of the listing will be discussed shortly. The comment lines following (and all
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
D-1
Assembler Listing File Format
Listing File Commentary
lines) have been shifted right to make room for line numbers and constant or data value
displays, as for example with the group of equates beginning on line 12.
On line 19 an INCLUDE directive causes the source input to be switched to a file named
SIN16.ASM in the FFTLIB subdirectory. This usage of INCLUDE is provided for illustrative
purposes, since the previous MACLIB declaration makes it unnecessary. By line 20 the
input stream has changed to the new file; the first line of the new file is the definition line
for a macro that will initialize the FFT sine and cosine tables in X and Y memory. Notice
the lower case ‘m’ to the right of the line number on line 21 and following. This indicates
that a macro definition is in progress; the lines are not assembled but are retained for macro expansion later.
At line 41 the ENDM directive is encountered, as well as the end of the included macro
file. The source input reverts to the original file, the next line of which is an invocation of
the macro (SIN16) just defined. Since the MEX option was not specified, the macro expansion does not appear in the listing. However, on the next non-empty source line, the
OPT directive is used again to turn on printing of macro expansions and turn off the display of macro definitions (NOMD).
Line 68 of the listing contains an ORG directive which sets up the initial value of the runtime location counter to $200. The memory space and counter value are shown to the right
of the line number column. If an overlay had been defined here (see Chapter 4), the load
memory space and location counter would appear to the right of the runtime space and
counter value. The line numbers then skip to line 151 which contains a call to the macro
DITFFT. The macro was not defined in this source file but its definition was read from an
external file in a macro library directory as specified by the prior MACLIB directive. The
skipped line numbers represent that definition, which does not appear due to the previously given NOMD option.
Line 203 illustrates several listing features of the Assembler. The plus sign (+) to the right
of the line number column indicates a macro expansion in progress. The next field is the
memory space and location counter value, followed by the encoded instruction. The mnemonic and operand fields are spread out for easier reading. The ‘00000227’ by itself on
line 204 is the loop address for the DO loop; it is stored in the second instruction word and
represents one less than the address of the label _end_pass.
On page 7 there are two errors reported in the listing. Error messages contain the listing
line number, the source file name and the source line number where the error occurred,
a severity level (WARNING, ERROR, or FATAL), and the message text. In addition, the
error message may contain extra information indicating erroneous symbols or the field
(Label, Opcode, Operand, Opcode 2, Operand 2, X Move, Y Move) where the error occurred. Page 8 is the end of the source statement listing. After the END directive at line
232, the Assembler reports the total number of errors and warnings it encountered during
the assembly process.
After the source listing, the Assembler records other information encountered during assembly. On page 9 the names of the two macros used in the program are listed, along
with their definition lines in the source listing. If any sections had been declared in the pro-
D-2
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Listing File Format
Cross-reference Format
gram they would be shown here, as well as define symbols and their corresponding substitution strings. Next the symbol table is output, sorted by symbol name. The symbol table
data includes the symbol type (integer, floating point), its value, the section where it was
defined if applicable, and any attributes it may have (LOCAL, GLOBAL, SET).
Figure D-3 contains an annotated Assembler listing line showing virtually every possible
listing field. The significance of some fields may require further explanation. The macro
definition/expansion column will contain a plus sign (+) during macro expansion. It will
contain a lower case ‘m’ during macro definition, and a lower case ‘d’ during data constant
expansion (the CEX option used with the DC directive). When a nested macro is expanded, this column will contain both a lower case ‘m’ and a plus sign. A lower case ‘i’ in this
column indicates that the line has been skipped as a result of an IF-THEN-ELSE directive
sequence. A lower case ‘p’ means that the line was automatically generated by the Assembler, ordinarily to introduce pipeline delay.
D.3
CROSS-REFERENCE FORMAT
The Assembler will optionally generate a cross-reference listing of all symbols used in the
source program. This can be done by using the CEX option of the OPT directive (Chapter
6). The cross-reference listing for the above sample program is shown in Figure D-2. It
contains a sorted table of symbols, each one followed by a list of line numbers in the
source listing where a reference to the symbol occurred. Line numbers followed by an asterisk (*) indicate the line where the symbol was defined.
D.4
MEMORY UTILIZATION REPORT FORMAT
The Assembler can optionally record and report allocation and usage of the separate
memory spaces of the target DSP. This is done with the MU option of the OPT directive
(Chapter 6). A memory utilization report is a memory map showing data allocation, code
generation, and unused memory areas along with associated label, section, and overlay
information, if available.
Figure D-4 shows the memory utilization report for the Assembler source in Figure D-5.
The individual X, Y, L, and P memory spaces are reported separately. The starting and
ending addresses, length, type, and any label, section, or overlay data are display for
each reported block. The blocks are delimited by the occurrence in the source of either a
data allocation directive (BSC, DC, DS, DSM, DSR) or an ORG directive.
In the X memory report of Figure D-4 the first reported block is an uninitialized area of
1024 words. This corresponds to the first DS directive in Figure D-5, which reserves 1024
words of memory in X data space. The next block of memory in X data space is the overlay
code for the FIR filter. It begins immediately after the first block and is ten words long.
The type column shows what kind of code or data has been generated, as well as indicating that a block is unused. In the line corresponding to the first DS directive in the source,
the type is DATA to indicate that it is an uninitialized data area. There are other types for
initialized data, code, and modulo and reverse carry buffers. For example, the second
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
D-3
Assembler Listing File Format
Memory Utilization Report Format
block in the X memory report is of type CODE because it is overlay code to be executed
in P memory.
The label from the source file is included on the report under the label column, since there
was a label associated with the DS directive. If there had been no label, the label column
on the report would have been blank. The section and overlay address columns are empty because there is no current section and no overlay in progress at this point in the
source.
In the next-to-last line of the X memory report (start address $400), there is an entry of
type CODE with an overlay address. This is the corresponding load entry for the first line
in the P memory report, and indicates that this is an overlay block. Separate report records
are generated as a result of the ORG directive in the source which has the form ORG
P:,X:$400, signifying an overlay. In the X memory report, the overlay address is P:0 and
the R in parentheses means that the overlay address is the runtime address. Conversely,
the first line in the P memory report shows an overlay address of X:400; the L in parentheses means that the overlay address is the load time address.
D-4
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Listing File Format
Assembler Listing Format
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
D-5
Assembler Listing File Format
Assembler Listing Format
D-6
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Listing File Format
Assembler Listing Format
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
D-7
Assembler Listing File Format
Assembler Listing Format
D-8
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Listing File Format
Assembler Listing Format
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
D-9
Assembler Listing File Format
Assembler Listing Format
D-10
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Listing File Format
Assembler Listing Format
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
D-11
Assembler Listing File Format
Assembler Listing Format
D-12
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Listing File Format
Assembler Listing Format
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
D-13
Assembler Listing File Format
Assembler Listing Format
D-14
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Listing File Format
Assembler Listing Format
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
D-15
Assembler Listing File Format
Assembler Listing Format
D-16
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Assembler Listing File Format
Assembler Listing Format
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
D-17
Assembler Listing File Format
Assembler Listing Format
D-18
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Appendix E
MOTOROLA DSP OBJECT FILE FORMAT (COFF)
E.1
INTRODUCTION
The Motorola DSP Assembler and Linker produce a binary object file in a modified form
of the AT&T Common Object File Format (COFF). COFF is a formal definition for the
structure of machine code files. It originated with Unix System V but has sufficient flexibility and generality to be useful in non-hosted environments. In particular, COFF supports
user-defined sections and contains extensive information for symbolic software testing
and debugging.
Later sections describe the COFF implementation for the Motorola family of digital signal
processors. The DSP COFF format has been altered to support multiple memory spaces
and normalized to promote transportability of object files among host processors. See
section E.4 for a list of differences between the Motorola DSP object file format and standard COFF. For a more general discussion of COFF the following reference may be useful:
Gintaras R. Gircys, Understanding and Using COFF, O’Reilly & Associates,
1988 (ISBN 0-937175-31-5).
E.2
OBJECT FILE STRUCTURE
A DSP COFF object file consists of up to eight groups of object file information. Some of
these groups are optional, depending on the type of object file generated, and others may
have repeating occurrences. The basic object file components are:
•
File header
•
Optional header
•
Section headers
•
Section data
•
Relocation information
•
Line numbers
•
Symbol table
•
String table
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
E-1
Motorola DSP Object File Format (COFF)
Object File Structure
The general layout of the object file is illustrated in Figure E-1.
FILE HEADER
OPTIONAL HEADER
Section 1 Header
•
•
Section n Header
Section 1 Contents
•
•
Section n Contents
Section 1 Relocation Info
•
•
Section n Relocation Info
Section 1 Line Numbers
•
•
Section n Line Numbers
SYMBOL TABLE
STRING TABLE
Figure E-1 COFF File Basic Structure
The file header contains object file information such as timestamp, number of sections,
pointer to the symbol table, and file status flags. Depending on how the object file was
generated the optional header holds link or run time information. The optional header is
followed by a list of section headers. Each section header contains pointers to section data, relocation information, and line number entries. After the section headers comes the
raw data for all sections. If the object file is relocatable the raw data may be followed by a
block of relocation entries for all sections. If the original source file was compiled or assembled with the -G debug option, the relocation information is followed by source line
number address entries. The symbol table contains information on program symbols useful by both the Linker and the debugger. The string table may contain very long symbolic
names, comment text, or relocation expressions. Note that the last four groups (relocation
info, line number entries, symbol table, and string table) may not appear if the Linker -S
option is used to strip symbols from the object file.
E-2
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Motorola DSP Object File Format (COFF)
Object File Components
E.3
OBJECT FILE COMPONENTS
Following are detailed descriptions of each of the DSP COFF object file components. The
descriptions include the purpose of the component, its structure in the object file, and
meanings of individual fields within the component.
E.3.1
File Header
The file header is the first component in a COFF object file. It contains information about
the object file itself and is used for negotiating other components within the file. There is
only one file header per object file. Figure E-2 shows the structure of the COFF file header.
Bytes
Declaration
Name
Description
0-3
unsigned long
f_magic
Magic number
4-7
unsigned long
f_nscns
Number of sections
8-11
long int
f_timdat
Time and date when file was
created
12-15
long int
f_symptr
File pointer to the start of the
symbol table
16-19
long int
f_nsyms
Number of symbol table
entries
20-23
unsigned long
f_opthdr
Number of bytes in the optional
header
24-27
unsigned long
f_flags
Flags (see Figure E-3)
Figure E-2 File Header Format
The magic number is a special code indicating the target machine for the object file
(DSP56000, DSP96000, etc.). The number of sections is useful for scanning the list of
section headers. The date and time stamp is kept in binary form and may contain a hostdependent time value. The f_symptr field contains a file byte offset to the beginning of
the symbol table. The number of symbol table entries provides an upper bound for looping through the symbol table and an indirect means for accessing the start of the string
table. The size of the optional header allows for jumping to the start of the section header
list.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
E-3
Motorola DSP Object File Format (COFF)
Object File Components
The flags field is a set of bit flags which convey status information about the object file. It
is used primarily by Linkers, debuggers, and other loader software to determine whether
the file is valid for a particular requested operation. The individual bit flags are shown in
Figure E-3.
Mnemonic
Flag
Meaning
F_RELFLG
0000001
Relocation information stripped from file
F_EXEC
0000002
File is executable (no unresolved external
references)
F_LNNO
0000004
Line numbers stripped from file
F_LSYMS
0000010
Local symbols stripped from file
F_CC
0010000
File produced by C compiler (Motorola
DSP only)
Figure E-3 File Header Flags
E.3.2
Optional Header
The COFF optional header ordinarily is used to hold system-dependent or runtime information. This allows different operating environments to store data that only that environment uses without forcing all COFF files to save space for that information. General utility
programs can be made to work properly with any common object file. This is done by
seeking past the optional header using the f_opthdr size field in the file header record.
The optional header in a Motorola DSP object file may contain two distinct types of information, depending upon how the file was generated. If the file is a relocatable object file
it will have an optional header containing Linker information. If the file is an absolute object
file it will have an optional header containing runtime information. The runtime header is
similar to standard COFF a.out optional header formats.
Figure E-4 shows the Linker optional header. The module size field gives the size of the
entire object module. The data size field reflects the size of the entire raw data block within
the module. The endstr field points to an expression in the string table which originated
with the Assembler END directive (see Chapter 6); it indicates the starting address of the
module. If this field is negative or zero there is no end expression. The logical section
count is the count of sections in the object module created via the Assembler SECTION
directive (see Chapter 6). The counter count represents the number of COFF sections in
the file (analogous to the file header f_nscns field). The relocation entry and line number
counts hold the number of all relocation entries and line number records in the file. The
E-4
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Motorola DSP Object File Format (COFF)
Object File Components
buffer and overlay counts give counts for each instance of a buffer or overlay in the module. The major version, minor version, and revision number fields reflect the Assembler
and Linker versions to insure Linker backward compatibility. The optional header flags
hold special mode flags for the Linker.
Bytes
Declaration
Name
Description
0-3
long int
modsize
Object module size
4-7
long int
datasize
Module raw data size
8-11
long int
endstr
End directive expression string
12-15
long int
secnt
Logical section count
16-19
long int
ctrcnt
Counter count
20-23
long int
relocnt
Relocation entry count
24-27
long int
lnocnt
LIne number entry count
28-31
long int
bufcnt
Buffer count
32-35
long int
ovlcnt
Overlay count
36-39
long int
majver
Major version number
40-43
long int
minver
Minor version number
44-47
long int
revno
Revision number
48-51
long int
optflags
Optional header flags
Figure E-4 Motorola DSP Optional Link Header Format
Figure E-5 illustrates the runtime optional header. This header is similar to the standard
COFF a.out header but there are differences. The magic number in this header is not the
same as the magic number in the file header; this magic number is used indicate the file
type to a host operating system. The magic number and version stamp fields currently are
not used by the Motorola DSP tools and are set to zero. The text size field gives the size
of all text-type data (executable code) in the object file. The data size field holds a count
of all initialized data (apart from code) in the file. The uninitialized data size field is not
used and is set to zero.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
E-5
Motorola DSP Object File Format (COFF)
Object File Components
The program entry field represents the address given in the Assembler END directive.
The text start and data start values contain the low addresses for text and data segments,
respectively. The text and data end values contain the high addresses for text and data
segments, respectively. Note that addresses are expressed in terms of the C language
typedef CORE_ADDR. A CORE_ADDR is a structure containing a long (4 byte) address
and an enumeration type which classifies the address according to memory space (X, Y,
L, P) and memory mapping (internal, external, etc.). See section E.4.1 for more information on the CORE_ADDR structure.
Bytes
Declaration
Name
Description
0-3
long int
magic
Magic number
4-7
long int
vstamp
Version stamp
8-11
long int
tsize
Size of text in words
12-15
long int
dsize
Size of data in words
16-19
long int
bsize
Size of uninitialized data in words
20-27
CORE_ADDR
entry
Program entry point
28-35
CORE_ADDR
text_start
Base address of text
36-43
CORE_ADDR
data_start
Base address of data
44-51
CORE_ADDR
text_end
End address of text
52-59
CORE_ADDR
data_end
End address of data
Figure E-5 Motorola DSP Optional Runtime Header Format
E.3.3
Sections
A section is the smallest portion of an object file that is treated as one separate and distinct
entity. Sections can accommodate program text, initialized and uninitialized data, and
block data. COFF sections in DSP object files may be grouped under a logical section defined by the Assembler SECTION directive (see Chapter 6).
It is a mistake to assume that every COFF file will have a specific number of sections, or
to assume characteristics of sections such as their order, their location in the object file,
or the address at which they are to be loaded. This information is available only after the
E-6
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Motorola DSP Object File Format (COFF)
Object File Components
object file has been created. Programs manipulating COFF files should obtain it from file
and section headers in the file.
E.3.3.1 Section Headers
Every object file has a table of section headers to specify the layout of data within the file.
The section header table consists of one entry for every section in the file. The information
in the section header is described in Figure E-6.
Bytes
0-7
Declaration
Name
Description
char
s_name
Section name (null padded)
8-15
CORE_ADDR
s_paddr
Physical address
16-23
CORE_ADDR
s_vaddr
Virtual address
24-27
long int
s_size
Section size in words
28-31
long int
s_scnptr
File pointer to raw data
32-35
long int
s_relptr
File pointer to relocation entries
36-39
long int
s_lnnoptr
File pointer to line number entries
40-43
unsigned long
s_nreloc
Number of relocation entries
44-47
unsigned long
s_nlnno
Number of line number entries
48-51
long int
s_flags
Section flags (see Figure E-7)
Figure E-6 Section Header Format
The section name is an 8-byte character array padded with null (zero) bytes if required. In
Motorola relocatable object files section names may be longer than eight characters. In
this case the convention used for long symbol names is followed where if the least significant four bytes of the section name field contain zeroes, the name is in the symbol table
at the offset given by the most significant four bytes of the name field. See section E.3.4.1
for more information on the handling of long symbol names.
The physical address is the address where the section text or data will reside in memory.
The address value depends upon whether the section is absolute or relocatable. If the
section is absolute then the physical address is the actual address where the section will
be loaded into memory. If the section is relocatable then the physical address is an offset
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
E-7
Motorola DSP Object File Format (COFF)
Object File Components
from the start of the logical section (implicit or defined by the SECTION directive) in which
the section is defined.
In most cases the virtual address is the same as the physical address. However, for block
data sections in Motorola DSP object files the virtual address field holds the repeat count
for the single raw data value associated with this section. For example, if the assembly
language source file included a directive of the form BSC $400,$FFFF the s_vaddr field
would contain the value $400, the s_size field would be 1 (or 2 if in L memory), and the
single raw data word associated with the section would be $FFFF.
The section size is the count of raw data words associated with the section. This is in contrast to standard COFF section sizes which usually are given in bytes. Raw data words
currently are stored in the object file as long (4-byte) integers independent of the target
processor word size.
The file pointer fields are file byte offsets into the object file to the start of the current section raw data, relocation entries, and line number information. The counts of relocation
and line number entries provide an upper bound for scanning these tables. The section
flags comprise the section attributes and are described in Figure E-7.
E-8
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Motorola DSP Object File Format (COFF)
Object File Components
Mnemonic
Flag
Meaning
STYP_REG
$0000
Regular section
STYP_DSECT
$0001
Dummy section
STYP_NOLOAD
$0002
Noload section
STYP_GROUP
$0004
Grouped section
STYP_PAD
$0008
Padding section
STYP_COPY
$0010
Copy section
STYP_TEXT
$0020
Executable text section
STYP_DATA
$0040
Initialized data section
STYP_BSS
$0080
Uninitialized data section
STYP_BLOCK
$0400
Block data section
STYP_OVERLAY
$0800
Overlay section
STYP_MACRO
$1000
Macro section
Figure E-7 Section Header Flags
Text sections are reserved for code to be loaded into program memory (P space). Data
sections hold initialized data, generated by Assembler DC directives for example, bound
for data (X, Y, L) memory. Bss sections are used for uninitialized blocks resulting from Assembler DS and similar directives. Padding sections are generated to provide alignment
when a modulo or reverse-carry buffer is declared. The block section attribute flags a
block data section, described above. The overlay flag indicates the section is part of an
overlay. Macro sections represent code and data generated during a macro expansion.
Dummy sections are used internally by the Assembler to mark empty sections after the
first assembly pass. Empty sections may still appear in the object file if a symbol is associated with a section which contains no data. The noload, group, and copy attributes are
not used at present.
E.3.3.2 Relocation Information
Object files have one relocation entry for each relocatable reference in the text or data.
The relocation information consists of entries with the format described in Figure E-8.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
E-9
Motorola DSP Object File Format (COFF)
Object File Components
Bytes
Declaration
Name
Description
0-3
long
r_vaddr
Address of reference
4-7
long
r_symndx
String table index
unsigned long
r_type
Relocation type
8-11
Figure E-8 Relocation Entry Format
The address field represents the relocatable address within the section raw data where a
modification is needed. In standard COFF the r_symndx field points to an entry in the
symbol table corresponding to the reference requiring modification. The relocation type
encodes how the raw data is to be changed to reflect the resolved symbol value.
In Motorola DSP COFF r_symndx is an offset into the string table which points to a relocation expression. The Linker interprets this expression and updates the word at r_vaddr
with the result of the expression evaluation. The relocation type is always zero. See section E.5, Object File Data Expression Format for more information on relocation expressions.
E.3.3.3 Line Numbers
When the compiler or Assembler is invoked with the -G debug option an entry is made in
the object for every source line where a breakpoint can be inserted. It is then possible to
reference source line numbers when using a debugger. The structure of an object file line
entry is shown in Figure E-9.
Bytes
Declaration
Name
Description
0-3
long
l_symndx
Function name symbol table index
0-7
CORE_ADDR
l_paddr
Line number physical address
8-11
unsigned long
l_lnno
Source file line number
Figure E-9 Line Number Entry Format
All line numbers in a section are grouped by function as shown in Figure E-10. The first
entry in a function grouping has line number 0 and has, in place of the physical address,
E-10
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Motorola DSP Object File Format (COFF)
Object File Components
an index into the symbol table for the entry containing the function name. Subsequent entries have actual line numbers and addresses of the program text corresponding to the
line numbers. The line number entries are relative to the beginning of the function, and
appear in increasing order of address.
Symbol index
0
Physical address
Line number
Physical address
Line number
.
.
.
.
.
.
Symbol index
0
Physical address
Line number
Physical address
Line number
Figure E-10 Line Number Grouping
E.3.4
Symbol Table
The COFF symbol table serves a dual purpose: it provides resolution for symbolic references in relocation expressions during linking, and it establishes a framework for the handling of symbolic debug information. The symbol table consists of at least one fixedlength entry per symbol with some symbols followed by auxiliary entries of the same size.
Because of symbolic debugging requirements the order of symbols in the symbol table is
very important. Whereas an individual symbol table entry can completely describe a single
debugging entity, the entities exist within the framework of the source language that produced them. For example, symbol scoping and function blocks in C are represented by
the appropriate ordering of begin-end block entries in the symbol table. Symbols in the
symbol table appear in the sequence shown in Figure E-11.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
E-11
Motorola DSP Object File Format (COFF)
Object File Components
Filename 1
Function 1
Local symbols for function 1
Function 2
Local symbols for function 2
...
Statics
...
Filename 2
Function 1
Local symbols for function 1
...
Statics
...
Defined global symbols
Undefined global symbols
Figure E-11 COFF Symbol Table Ordering
The entry for each symbol is a structure that holds the symbol value, its type, and other
information. There are symbol table entries used for relocation and linking and there are
special symbols used only for debugging. The two kinds of entries are distinguished by
combinations of field values in the symbol record. The structure of a symbol table entry is
illustrated in Figure E-12.
E-12
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Motorola DSP Object File Format (COFF)
Object File Components
Bytes
Declaration
Name
Description
0-7
char
n_name
Symbol name (null padded)
0-3
long int
n_zeroes
Zero in this field indicates name
is in string table
4-7
long int
n_offset
Offset of name in string table
8-15
CORE_ADDR
n_address
Symbol address value
8-15
unsigned long
n_val[2]
Symbol value
16-19
long int
n_scnum
Symbol section number
20-23
unsigned long
n_type
Symbol basic and derived type
24-27
long int
n_sclass
Symbol storage class
28-31
long int
n_numaux
Number of auxiliary entries
Figure E-12 Symbol Table Entry Format
E.3.4.1 Symbol Name
The first eight bytes in the symbol table entry are a union of a character array and two
longs. If the symbol name is seven characters or less, the null-padded symbol name is
stored there. If the symbol name is longer than seven characters, then the entire symbol
name is stored in the string table. In this case, the eight bytes contain two long integers:
the first is zero and the second is the offset (relative to the beginning of the string table)
of the name in the string table. Since there can be no symbols with a null name, the zeroes on the first four bytes serve to distinguish a symbol table entry with an offset from
one with a name in the first eight bytes.
E.3.4.2 Symbol Value
The symbol value is a union of a CORE_ADDR typedef and an array of two longs. If the
symbol value is an address the contents will be stored as a CORE_ADDR structure with
memory and mapping attributes. Otherwise the contents are stored in the n_val field.
Whether the symbol value is an address or not depends on the storage class of the symbol. See section E.3.4.5 for more information on the relationship of symbol value and storage class.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
E-13
Motorola DSP Object File Format (COFF)
Object File Components
E.3.4.3 Section Number
The section number maps a symbol to its corresponding section in the object file (e.g. the
section in which the symbol is defined). A special section number (-2) marks symbolic
debugging symbols, including structure/union/enumeration tag names, typedefs, and the
name of the file. A section number of -1 indicates that the symbol has a value but is not
relocatable. Examples of absolute-valued symbols include automatic and register variables, function arguments, and end-of-structure symbols. A section number of 0 flags a
relocatable external symbol that is not defined in the current file. Section numbers greater
than zero correlate to the ordinal sequence of sections in the object file.
E.3.4.4 Symbol Type
The type field in the symbol table entry contains information about the basic and derived
type for the symbol. This information is generated by the compiler and Assembler only if
the -G debug option is used. Each symbol has exactly one basic or fundamental type but
can have more than one derived type. The type information is encoded as sets of bits in
the field. Bits 0 through 3 hold one of the fundamental type values given in Figure E-13.
E-14
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Motorola DSP Object File Format (COFF)
Object File Components
Mnemonic
Value
Type
T_NULL
0
Type not assigned
T_VOID
1
Void
T_CHAR
2
Character
T_SHORT
3
Short integer
T_INT
4
Integer
T_LONG
5
Long integer
T_FLOAT
6
Floating point
T_DOUBLE
7
Double word floating point
T_STRUCT
8
Structure
T_UNION
9
Union
T_ENUM
10
Enumeration
T_MOE
11
Member of enumeration
T_UCHAR
12
Unsigned character
T_USHORT
13
Unsigned short
T_UINT
14
Unsigned integer
T_ULONG
15
Unsigned long
Figure E-13 Fundamental Types
Bits 4 through 15 are arranged as six 2-bit subfields. These subfields represent levels of
the derived types given in Figure E-14.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
E-15
Motorola DSP Object File Format (COFF)
Object File Components
Mnemonic
Value
Type
DT_NON
0
No derived type
DT_PTR
1
Pointer
DT_FCN
2
Function
DT_ARY
3
Array
Figure E-14 Derived Types
As an example of encoding fundamental and derived types, consider a function returning
a pointer to a character. The fundamental type is character, giving bits 0-3 of the symbol
type field the value 2. Bits 4-5 would hold a 2 for the derived type of function and bits 6-7
would contain a 1 for the pointer derived type. The value in the symbol entry type field
would result in %01100010 binary, or $62 hexadecimal.
E.3.4.5 Symbol Storage Class
The symbol storage class indicates how a symbol will be used during execution or debugging. Some storage classes actually reflect how a symbol will be stored, e.g. as a register
parameter. Other storage classes provide information for special symbols used in debugging, such as the beginning of blocks or the end of functions. Storage classes are outlined
in Figure E-15.
E-16
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Motorola DSP Object File Format (COFF)
Object File Components
Mnemonic
Value
Type
C_EFCN
-1
Physical end of function
C_NULL
0
No storage class
C_AUTO
1
Automatic variable
C_EXT
2
External symbol
C_STAT
3
Static symbol
C_REG
4
Register variable
C_EXTDEF
5
External definition
C_LABEL
6
Label
C_ULABEL
7
Undefined label
C_MOS
8
Member of structure
C_ARG
9
Function argument
C_STRTAG
10
Structure tag
C_MOU
11
Member of union
C_UNTAG
12
Union tag
C_TPDEF
13
Type definition
C_USTATIC
14
Uninitialized static
C_ENTAG
15
Enumeration tag
C_MOE
16
Member of enumeration
C_REGPARAM
17
Register parameter
C_FIELD
18
Bit field
Figure E-15 Storage Classes
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
E-17
Motorola DSP Object File Format (COFF)
Object File Components
Mnemonic
Value
Type
C_BLOCK
100
Beginning and end of block
C_FCN
101
Beginning and end of function
C_EOS
102
End of structure
C_FILE
103
C language source filename
C_LINE
104
-
C_ALIAS
105
Duplicated tag
C_HIDDEN
106
-
A_FILE
200
Assembly source filename
A_SECT
201
Beginning and end of section
A_BLOCK
202
Beginning/end of COFF section
A_MACRO
203
Macro expansion
A_GLOBAL
210
Global assembly language symbol
A_XDEF
211
XDEFed symbol
A_XREF
212
XREFed symbol
A_SLOCAL
213
Section local label
A_ULOCAL
214
Underscore local label
A_MLOCAL
215
Macro local label
Figure E-15 Storage Classes (continued)
The value of a symbol depends on its storage class. This relationship is summarized in
Figure E-16.
E-18
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Motorola DSP Object File Format (COFF)
Object File Components
Storage Class
Value
C_AUTO
Stack offset in words
C_EXT
Relocatable address
C_STAT
Relocatable address
C_REG
Register number
C_LABEL
Relocatable address
C_MOS
Offset in words
C_ARG
Stack offset in words
C_STRTAG
0
C_MOU
0
C_UNTAG
0
C_TPDEF
0
C_ENTAG
0
C_MOE
Enumeration value
C_REGPARAM
Register number
C_FIELD
Bit displacement
C_BLOCK
Relocatable address
C_FCN
Relocatable address
C_EOS
Size of structure in words
C_FILE
(see below)
C_ALIAS
Tag index
C_HIDDEN
Relocatable address
Figure E-16 Storage Class and Value
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
E-19
Motorola DSP Object File Format (COFF)
Object File Components
Storage Class
Value
A_FILE
(see below)
A_SECT
String table offset to section name
A_BLOCK
Relocatable address
A_MACRO
String table offset to macro name
A_GLOBAL
Relocatable address
A_XDEF
Relocatable address
A_XREF
String table offset to symbol name
A_SLOCAL
Relocatable address
A_ULOCAL
Relocatable address
A_MLOCAL
Relocatable address
Figure E-16 Storage Class and Value (continued)
If a symbol has storage class C_FILE or A_FILE, the value of that symbol equals the symbol table entry index of the next C_FILE or A_FILE symbol. That is, the C_FILE and
A_FILE entries form a one-way linked list in the symbol table. If there are no more C_FILE
or A_FILE entries in the symbol table, the value of the symbol is the index of the first global
symbol.
Relocatable symbols have a value equal to the relocatable address of that symbol. When
the section is relocated by the Linker, the value of these symbols changes.
E.3.4.6 Auxiliary Entries
Every symbol table entry may have zero, one, or more auxiliary entries. These auxiliary
entries are used to hold additional information about the primary symbol. The number of
auxiliary entries associated with a given symbol can be determined by examining the
n_numaux field of the main symbol entry.
An auxiliary symbol table entry contains the same number of bytes as its associated symbol table entry and is contiguous with the primary entry in the object file. Unlike primary
symbol table entries, however, the format of an auxiliary entry depends on the type and
storage class of the main symbol.
E-20
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Motorola DSP Object File Format (COFF)
Object File Components
E.3.4.6.1 Filenames
The auxiliary table entry for a filename contains a 14-character array followed by an unsigned long integer. If the integer is zero then the filename is in the array. Otherwise it is
in the string table at the offset given by the integer value. The x_ftype field indicates the
memory space used for the stack in compiled modules.
Bytes
Declaration
Name
Description
0-13
char
x_fname
Source file name
14-17
unsigned long
x_foff
String table offset to file name
18-21
unsigned long
x_ftype
Memory space used by stack
Figure E-17 Filename Symbol Auxiliary Entry
E.3.4.6.2 Sections
Section auxiliary entries have the format shown in Figure E-18. This information is analogous to selected fields in the corresponding section header. If the object file is relocatable
a section symbol entry will have a second auxiliary entry with the format shown in Figure
E-19.
Bytes
Declaration
Name
Description
0-3
long int
x_scnlen
Section length
4-7
unsigned long
x_nreloc
Number of relocation entries
8-11
unsigned long
x_nlinno
Number of line numbers
-
-
Unused (zero filled)
12-31
Figure E-18 Section Symbol Auxiliary Entry
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
E-21
Motorola DSP Object File Format (COFF)
Object File Components
Bytes
Declaration
Name
Description
0-3
long int
secno
Logical section number
4-7
long int
rsecno
Logical relocation section number
8-11
long int
flags
Section type flags
12-27
struct mematt
mem
Section memory attributes
28-31
-
-
Unused (zero filled)
Figure E-19 Relocatable Section Auxiliary Entry
The logical section number is the ordinal related to a SECTION directive in the Assembler
source file. The relocation section number usually is the same as the logical section number, but may be different if the logical section is static within an enclosing section. The
memory mapping is an alternate encoding of the CORE_ADDR information in the section
header. Section type flags indicate whether this COFF section represents a buffer or overlay block. If the current COFF section is a buffer or overlay block a third auxiliary entry is
produced. The layout of that entry is shown in Figure E-19.
Bytes
Declaration
Name
Description
0-3
long int
bufcnt
Buffer section number
4-7
long int
buftyp
Buffer type
8-11
long int
buflim
Buffer limit
0-15
struct mematt
ovlmem
Overlay memory attributes
16-19
long int
ovlcnt
Overlay section number
20-23
long int
ovlstr
Overlay origin expression
24-31
-
-
Unused (zero filled)
Figure E-20 Relocatable Buffer/Overlay Auxiliary Entry
Buffers and overlays are generally mutually exclusive so their respective fields share storage space in the record definition. In the case where a buffer appears in an overlay, an-
E-22
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Motorola DSP Object File Format (COFF)
Object File Components
other auxiliary entry is generated for the buffer. The buffer section number is really the
buffer instance count in this file. Buffer type is either modulo or reverse carry. The buffer
limit gives the upper bound for the buffer size even though the block may contain less initialized data than this limit suggests. The overlay memory structure gives the runtime
memory attributes for this block. The overlay section number is really the overlay instance
count in this file. The overlay origin expression is the expression given for the runtime
counter in the Assembler ORG directive (see Chapter 6).
E.3.4.6.3 Tag Names
Auxiliary entries for C language structure and union tag names have the format described
in Figure E-21. Note that in Motorola DSP COFF the size of the associated structure or
union is in words as opposed to bytes as in standard COFF. The x_endndx field is used
to create a linked list of tag name entries through the symbol table.
Bytes
0-7
Declaration
Name
Description
-
-
Unused (zero filled)
unsigned long
x_size
Size of structure, union, or
enumeration in words
12-15
-
-
Unused (zero filled)
16-19
long int
x_endndx
Index of next structure, union, or
enumeration entry
20-31
-
-
Unused (zero filled)
8-11
Figure E-21 Tag Name Symbol Auxiliary Entry
E.3.4.6.4 End of Structures
The format for C language end-of-structure auxiliary entries is given in Figure E-22. Note
that the size of the structure, union, or enumeration is given in words rather than bytes.
The tag index holds the symbol table index for the tag record associated with this structure.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
E-23
Motorola DSP Object File Format (COFF)
Object File Components
Bytes
Declaration
Name
Description
0-3
long int
x_tagndx
Tag index
4-7
-
-
Unused (zero filled)
unsigned long
x_size
Size of structure, union, or
enumeration in words
-
-
Unused (zero filled)
8-11
12-31
Figure E-22 End of Structure Auxiliary Entry
E.3.4.6.5 Functions
Function auxiliary entries have the format shown in Figure E-23. Note that the size of the
function is given in words rather than bytes. The function tag index holds the symbol table
index to the begin-function symbol for this function. The x_endndx field points to the next
function symbol table entry. The x_lnnoptr field contains a byte offset pointer within the
object file to the line number entry that signals the start of this function (see section
E.3.3.3, Line Numbers, for more information).
Bytes
Declaration
Name
Description
0-3
long int
x_tagndx
Tag index
4-7
long int
x_fsize
Size of function in words
-
-
Unused (zero filled)
12-15
long int
x_lnnoptr
File pointer to line number entry
16-19
long int
x_endndx
Index of next function entry
20-31
-
-
Unused (zero filled)
8-11
Figure E-23 Function Symbol Auxiliary Entry
E-24
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Motorola DSP Object File Format (COFF)
Object File Components
E.3.4.6.6 Arrays
The format for C language array auxiliary entries is given in Figure E-24. The tag index
contains the offset to the next array symbol in the symbol table. The line number field
gives the source file line number for the array declaration.
Bytes
Declaration
Name
Description
0-3
long int
x_tagndx
Tag index
4-7
unsigned long
x_lnno
Line number of array declaration
8-11
unsigned long
x_size
Size of array
12-15
unsigned long
x_dimen[0]
First array dimension
16-19
unsigned long
x_dimen[1]
Second array dimension
20-23
unsigned long
x_dimen[2]
Third array dimension
24-27
unsigned long
x_dimen[3]
Fourth array dimension
28-31
-
-
Unused (zero filled)
Figure E-24 Array Symbol Auxiliary Entry
E.3.4.6.7 End of Blocks and Functions
The format for C language symbol entries for the end of blocks and functions is given in
Figure E-25. Only the source file line number for the end of the block or function is stored.
Bytes
Declaration
Name
Description
0-3
-
-
Unused (zero filled)
4-7
unsigned long
x_lnno
Source file line number
-
-
Unused (zero filled)
8-31
Figure E-25 End of Block or Function Auxiliary Entry
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
E-25
Motorola DSP Object File Format (COFF)
Object File Components
E.3.4.6.8 Beginning of Blocks and Functions
The format for C language symbol entries for the beginning of blocks and functions is described in Figure E-26. The source file line number is retained. The x_endndx provides a
link to the next beginning of block or function symbol in the symbol table.
Bytes
Declaration
Name
Description
0-3
-
-
Unused (zero filled)
4-7
unsigned long
x_lnno
Source file line number
-
-
Unused (zero filled)
16-19
long int
x_endndx
Index of next beginning of
block or function
20-23
unsigned long
x_type
Function prologue/epilogue index
24-31
-
-
Unused (zero filled)
8-15
Figure E-26 Beginning of Block or Function Auxiliary Entry
E.3.4.6.9 Structure, Union, and Enumeration Names
The format for auxiliary entries related to structure, union, and enumeration names is given in Figure E-27. The tag index is used to access the tag symbol record that describes
this structure. Note that in Motorola DSP COFF the size of the associated structure or
union is in words as opposed to bytes as in standard COFF.
E-26
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Motorola DSP Object File Format (COFF)
Differences In DSP Object Format And Standard COFF
Bytes
Declaration
Name
Description
0-3
long int
x_tagndx
Tag index
4-7
-
-
Unused (zero filled)
unsigned long
x_size
Size of structure, union, or
enumeration in words
-
-
Unused (zero filled)
8-11
12-31
Figure E-27 Structure, Union, or Enumeration Name Auxiliary Entry
E.3.4.7 Object File Comments
Object file comments are stored in a single COFF symbol table entry. The symbol name
field contains the special comment string .cmt. The n_address field points to the comment text as an offset into the string table. Comments generated automatically by the Assembler or via the IDENT directive have an n_scnum field with value of -1. Comments
produced with the COBJ directive generally have the section number of the COFF section
in which they reside. The type and storage class fields are both zero.
E.3.5
String Table
Symbol and section names longer than seven characters and comment text are stored
contiguously in the string table with each string delimited by a zero byte. The first four
bytes represent the size of the string table in bytes; offsets into the string table, therefore,
are always greater than or equal to 4. An empty string table has a length field with value
zero.
E.4
DIFFERENCES IN DSP OBJECT FORMAT AND STANDARD COFF
Motorola DSP COFF is substantially the same as generic COFF and usage of format elements is similar. However, the original COFF specification did not envision aspects of
machine architecture which the Motorola DSP family possesses. Moreover, standard
COFF encompasses a file format which is quite adaptable among host processors, but is
not necessarily portable among those hosts. It is straightforward enough to adapt COFF
to a new host machine, but the intent is that the derived host format will be recognized and
executed only on that target host. For Motorola DSP COFF the format had to be extended
for cross-development such that a given object file would be usable on all targeted host
systems. The following sections outline the differences and changes between standard
COFF and Motorola DSP COFF.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
E-27
Motorola DSP Object File Format (COFF)
Differences In DSP Object Format And Standard COFF
E.4.1
Multiple Memory Spaces
Standard COFF has no built-in mechanism for accommodating multiple memory spaces.
It does handle the notion of separate text and data sections, and a possible extension
would have been to define section types for the new memory areas. This quickly becomes unwieldy when mapping information (internal, external, port A/B) is considered as
well.
The solution was to extend addressing information to include the memory and mapping
with the address value itself. This is done by defining a C language typedef called
CORE_ADDR which holds both the memory and mapping data along with the memory address. For any address context in the COFF file a CORE_ADDR is used rather than, for
example, an unsigned long. A description of the CORE_ADDR format is shown in Figure
E-28.
Bytes
Declaration
Name
Description
0-3
long
w0.l
Memory address
4-7
enum
w1.mape
Memory mapping
Figure E-28 CORE_ADDR Format
The enumeration values for the memory mapping field are shown in order in Figure E-29.
E-28
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Motorola DSP Object File Format (COFF)
Differences In DSP Object Format And Standard COFF
Mnemonic
Value
Mnemonic
Value
memory_map_p
0
memory_map_xa
16
memory_map_x
1
memory_map_xb
17
memory_map_y
2
memory_map_xe
18
memory_map_l
3
memory_map_xi
19
memory_map_none
4
memory_map_xr
20
memory_map_laa
5
memory_map_ya
21
memory_map_lab
6
memory_map_yb
22
memory_map_lba
7
memory_map_ye
23
memory_map_lbb
8
memory_map_yi
24
memory_map_le
9
memory_map_yr
25
memory_map_li
10
memory_map_pt
26
memory_map_pa
11
memory_map_pf
27
memory_map_pb
12
memory_map_emi
28
memory_map_pe
13
memory_map_e0-63
29-92
memory_map_pi
14
memory_map_error
666666
memory_map_pr
15
Figure E-29 Memory Mapping Enumerations
E.4.2
Object File Transportability
There are many different structure definitions in the COFF specification. These definitions
consist of fields comprised of varying C data types. These data types are recognized by
any reasonable C compiler, but their characteristics and sizes may change from machine
to machine. This is acceptable if the COFF files are to be used only on a particular machine architecture. But if COFF files are produced on one machine to be used on another
several problems may arise. One is that since the data fields can vary in size there could
be alignment problems when accessing structures or individual fields. Another issue is
byte ordering between machines. Given an arbitrary byte stream, some machines store
the bytes in a word starting at the least significant bit (LSB) end of the word, while others
store bytes starting at the most significant bit (MSB) end of the word.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
E-29
Motorola DSP Object File Format (COFF)
Differences In DSP Object Format And Standard COFF
The Motorola DSP version of COFF addresses these potential problems by normalizing
the object file. Normalization occurs in a number of ways. All structure and union elements are converted to long values, and raw data is stored in 4-byte quantities independent of the word size of the target processor. In some cases this wastes space in the
object file and in memory but it was considered worth the price for transportability among
supported hosts. Also it is not a completely portable solution by any means (e.g. for machines with larger than 4-byte word sizes).
The byte ordering issue was dealt with by establishing a baseline ordering, providing compliance for foreign hosts with conversion code. This introduces overhead logic on machines that do not support the baseline word order but again it was seen as a reasonable
trade-off to insure transportability of object files among development environments. Note
that byte swapping logic only comes into play for fields that are not byte-atomic, such as
integer fields. Character arrays in structures, for example, should not have their bytes exchanged.
The byte ordering for Motorola DSP COFF is shown in Figure E-30. It adheres to what
sometimes is called the big-endian approach to byte and word ordering.
Addr n
MSB
Addr n+1
Addr n+2
Addr n+3
MSB - 1
LSB + 1
LSB
Figure E-30 Motorola DSP COFF Byte Ordering
E.4.3
Structure Size Fields
In some of the COFF data structures there is a size field which gives the size of a block
in the target processor environment. For example, there are several symbol table auxiliary entries that specify the size of a structure or union for debug purposes. In standard
COFF these sizes ordinarily are in bytes but in Motorola DSP COFF they are given in
words unless otherwise indicated. The use of word sizes for debug entities should be distinguished from file pointer offset values in the object file. File pointers are indeed byte
offsets within the object file that are used by utilities to process information in the object
file itself.
E.4.4
Relocation Information
In standard COFF the r_symndx field of any given relocation record points to an entry in
the symbol table corresponding to a symbol reference requiring modification. When the
standard COFF Linker performs symbol resolution, pairing symbol definitions with matching references, it updates the relocation entry to point to the symbol definition and dis-
E-30
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Motorola DSP Object File Format (COFF)
Object File Data Expression Format
cards the reference symbol. When the relocation entries are processed, the resolved
symbol value is used to modify the raw data indicated by the relocation entry at r_vaddr.
In Motorola DSP COFF r_symndx is an offset into the string table which points to a relocation expression. The Linker interprets this expression and updates the entire word at
r_vaddr with the result of the expression evaluation. The relocation type is always zero.
See section E.5, Object File Data Expression Format for more information on relocation
expressions.
E.4.5
Block Data Sections
Generic COFF does not make allowance for a block data section. A block data section
results from use of the Assembler BSC directive, where a large block of memory is initialized with a single value. Block data sections are handled in Motorola DSP COFF by making special use of the section s_vaddr field and adding an informative flag.
In most cases the section virtual address is the same as the physical address. However,
for block data sections in Motorola DSP object files the virtual address field holds the repeat count for the single raw data value associated with the section. For example, if the
assembly language source file included a directive of the form BSC $400,$FFFF the
s_vaddr field would contain the value $400, the s_size field would be 1 (or 2 if in L memory), and the single raw data word associated with the section would be $FFFF. In addition, the STYP_BLOCK flag is set in the section s_flags field.
E.4.6
Other Extensions
If the object file is relocatable there are extra structures which the Assembler and Linker
generate to support special constructs such as logical sections, buffers, and overlays. The
optional link file header contains information which the Linker requires; it is described in
section E.3.2. Every symbol table entry for a section in a relocatable file has an extra auxiliary entry described in section E.3.4.6.2.
One special DSP COFF structure not documented elsewhere is the comment symbol. A
comment symbol table entry is emitted either indirectly via the Assembler IDENT directive
or directly with the COBJ directive (see Chapter 6). A comment symbol table entry may
be identified by a symbol name of .cmt and a type and storage class of zero. The value
field of a comment symbol holds the offset into the string table of the comment text. The
section number for a comment symbol produced with the IDENT directive is always -1.
Comment symbols generated with the COBJ directive have the section number of the
section where the COBJ directive appears in the source file. Comment symbols have no
auxiliary entry.
E.5
OBJECT FILE DATA EXPRESSION FORMAT
Object file data expressions are used in data relocation records to represent values to be
loaded into memory. An expression is a combination of symbols, constants, operators,
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
E-31
Motorola DSP Object File Format (COFF)
Object File Data Expression Format
and parentheses. Expressions may contain user-defined labels, integers, floating point
numbers, or literal strings. An object file data expression generally follows the guidelines
of Assembler expressions, except that functions are not supported (e.g. they must be
evaluated at assembly time), and operators are provided for Linker-specific operations.
Also, floating point terms found in these expressions are converted to binary values.
E.5.1
Data Expression Generation
Link file data expressions are generated when external or relocatable operands are encountered during assembly or incremental link processing. In most cases the operand expression is copied verbatim from the source and embellished with link evaluation control
constructs. For example, consider the source line below:
MOVE #FOO,R0
The DSP96000 Assembler produces the following encoding for this line in the object file:
$3A8D2000 {FOO}@0#0
Since the symbol FOO is not known to the Assembler it generates a two-word instruction
and places a relocation reference to the expression in the position of the second instruction word. The braces ({ }) indicate that this is a user expression that should adhere to
certain integrity constraints such as those governing absolute and relative terms. Otherwise the braces are treated much like parentheses. The at sign (@) is a binary operator
indicating the memory space of the left operand by the right. The pound sign (#) is a binary
operator signifying the size in bits of the left operand by the right. More information on
these special operators and their operands is given below.
Here is another example of data expression generation:
JCLR
#1,X:LOC,LABEL
For this conditional jump the Assembler produces the following object file code:
(($02A00481&~(~(~0<<8)<<12))I(({LOC}@1#8&~(~0<<8))<<12)) {LABEL}@0#0
The first expression is evaluated such that the relative address LOC, resolved at link time,
is shifted and masked into the middle eight bits of the base instruction word ($02A00481).
The expression could have been more complex if the bit number was an external reference. The relative value of the symbol LABEL occupies the second instruction word.
E.5.2
Data Expression Interpretation
Object file data expressions are similar to standard Assembler expressions which generally follow the rules of algebra and boolean arithmetic. They are written using infix notation
in conjunction with unary and binary operators and parentheses. There are also extensions to the usual set of Assembler arithmetic and grouping operators. These are control
constructs that assist the Linker in determining the size, type, and characteristics of an
expression operand.
E-32
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Motorola DSP Object File Format (COFF)
Object File Data Expression Format
E.5.2.1 User Expression - { ... }
The curly braces ({ }) delimit a user expression within a data expression. A user expression is that part of a data expression that was written by the programmer and not generated by the Assembler or Linker as part of its control requirements. It is useful to isolate
the user expression in order to check for relationships among absolute and relative terms.
In all other respects the curly braces behave like parentheses.
E.5.2.2 Relocatable Expression - [ ... ]
The square brackets ([ ]) are used to enclose a relocatable expression. The value contained in the square brackets is an offset from the base of the current section. Usually this
grouping operator is placed around the value of an Assembler local label (underscore label) since these symbols do not migrate to the link file.
E.5.2.3 Memory Space Operator - @
The at sign (@) is a binary operator that checks the memory space compatibility of the left
operand based on the value of the right operand. The right operand can have the following values:
0
1
2
3
4
5
6
=
=
=
=
=
=
=
None
X space
Y space
L space
P space
E space
D space
The compatibility check is made based on the matrix outlined in section 3.3, Expression
Memory Space Attribute.
E.5.2.4 Bit Size Operator - #
The pound sign (#) is a binary operator used to verify the size in bits of the left operand
given the value of the right operand. The following bit sizes and operand type correspondences are defined:
-1515
-88
-77
-55
-19
-16
-15
MOTOROLA
-
15-bit signed short offset
8-bit signed short offset
7-bit signed short offset
5-bit signed short offset
19-bit page address
16-bit signed short immediate
15-bit signed short immediate or offset
DSP ASSEMBLER REFERENCE MANUAL
E-33
Motorola DSP Object File Format (COFF)
Object File Data Expression Format
-7
-6
-5
-2
-1
0
1
2
5
6
7
8
12
13
19
67,69 76
85,86,87 100 102 105 106 -
7-bit signed short immediate or offset
6-bit signed short PC-relative address
5-bit signed short offset
6-bit non-zero positive value
Negated immediate shift
DSP word size immediate or absolute
Immediate shift
Even value
5-bit short absolute
6-bit short immediate or absolute
7-bit short immediate, absolute, or offset
8-bit short immediate or absolute
12-bit short immediate or absolute
13-bit short immediate or absolute
19-bit short immediate or absolute
7,9-bit masked I/O short absolute
6-bit alternate I/O short absolute
5,6,7-bit I/O short absolute
Nonzero value
Limited I/O short absolute
5-bit non-zero immediate
6-bit non-zero immediate
E.5.2.5 Memory Attribute Operator - :
The colon (:) is used to assign a memory space and counter encoded in the right operand
to the left operand. The low sixteen bits of the right operand contain the counter designator for the left operand. The high sixteen bits contain the memory space designator for
the left operand. The value here corresponds to the memory space values given for the
memory space operator (@) described above.
E.5.2.6 Line Number Operator - !
The exclamation point (!) is a binary operator that associates the source file line number
of the left operand to the value of the right operand. The left operand is a decimal value
representing the source file line number. The right operand is an arbitrary relocation expression. The line number operator assists the Linker in correlating source line numbers
to expression terms which could be evaluated erroneously at link time, e.g. forced operands which do not fit into the instruction word after relocation.
E-34
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Motorola DSP Object File Format (COFF)
Object File Data Expression Format
E.5.2.7 BFxxx Instruction Mask Function - @FBF()
The @FBF() function is generated by the Assembler when the mask operand for a bitfield
instruction is external. The Assembler passes a relocation expression to the function as
an argument. The Linker evaluates the expression in parentheses and adjusts the associated instruction accordingly.
E.5.2.8 Local Relocatable Reference Function - @LRF()
The @LRF() function attempts to encapsulate more detail about a relocatable expression
than is generated with other operators such as @ and :. Its main purpose is to provide
sufficient information for evaluating local relocatable expressions that are referenced outside a defining context. For example, the Assembler might produce an @LRF() function
for a reference to an underscore label that is outside its defining section. The function arguments consist of the original relocatable expression, the memory space/mapping value,
the location counter designation, the defining and relocation section numbers, and any
buffer or overlay sequence numbers associated with the expression.
E.5.2.9 Alternate Encoding Function - @ENC()
The @ENC() provides two encoding expressions for the same instruction. This is useful
in cases where the unknown value of an external operand can affect which expression is
used for the final encoding. The function takes four arguments. The first argument to the
function is the external operand expression. The second argument is the absolute value
beyond which the second encoding expression is used over the first. The third argument
is the first encoding expression and the last argument is the second encoding expression.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
E-35
Appendix F
DEVICE-DEPENDENT INFORMATION
F.1
INTRODUCTION
The Motorola DSP Assemblers are quite similar in terms of functional capabilities. Virtually every Assembler feature is available across all Motorola DSP processor families. The
devices for which the Assemblers generate code, however, differ architecturally. For example, the DSP56000 is a binary fractional machine with a suitably-oriented register and
instruction set. The DSP96000 is a floating point processor with floating point instructions
and an alternatively-named register set. The following sections describe characteristics
that vary among Motorola DSPs and how these differences relate to Assembler use and
operation.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
F-1
Device-dependent Information
DSP56000 Information
F.2
DSP56000 INFORMATION
The Motorola DSP56000 refers to a family of high-speed, low power programmable
CMOS processors. The DSP56000 supports 24-bit signed fixed-point fractional arithmetic.
F.2.1
Instruction Set Summary
DSP56000 instructions can be grouped by function into six types:
1.
2.
3.
4.
5.
6.
F-2
Arithmetic instructions
Logical instructions
Bit manipulation instructions
Loop instructions
Move instructions
Program control instructions
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Device-dependent Information
DSP56000 Information
F.2.1.1
Arithmetic Instructions
The DSP56000 instructions used for arithmetic operations are:
ABS
ADC
ADD
ADDL
ADDR
ASL
ASR
CLR
CMP
CMPM
DEC
DIV
INC
MAC
MACR
MPY
MPYR
NEG
NORM
RND
SBC
SUB
SUBL
SUBR
Tcc
TFR
TST
— Absolute value*
— Add long with carry*
— Add*
— Shift left then add*
— Shift right then add*
— Arithmetic shift accumulator left*
— Arithmetic shift accumulator right*
— Clear accumulator*
— Compare*
— Compare magnitude*
— Decrement accumulator
— Divide iteration
— Increment accumulator
— Signed multiply-accumulate*
— Signed multiply-accumulate and round*
— Signed multiply*
— Signed multiply and round*
— Negate accumulator*
— Normalize accumulator iteration
— Round accumulator*
— Subtract long with carry*
— Subtract*
— Shift left then subtract*
— Shift right then subtract*
— Transfer conditionally
— Transfer data ALU register*
— Test*
*Instruction allows parallel data move.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
F-3
Device-dependent Information
DSP56000 Information
F.2.1.2
Logical Instructions
The DSP56000 instructions used for logical operations are:
AND
ANDI
EOR
LSL
LSR
NOT
OR
ORI
ROL
ROR
F.2.1.3
— Logical AND*
— AND Immediate with control register
— Logical exclusive OR*
— Logical shift accumulator left*
— Logical shift accumulator right*
— Logical complement on accumulator*
— Logical inclusive OR*
— OR immediate with control register
— Rotate accumulator left*
— Rotate accumulator right*
Bit Manipulation Instructions
The DSP56000 instructions used for bit manipulation are:
BCHG
BCLR
BSET
BTST
F.2.1.4
— Bit test and change
— Bit test and clear
— Bit test and set
— Bit test on memory
Loop Instructions
The DSP56000 instructions used for loop operations are:
DO
ENDDO
F.2.1.5
— Start hardware loop
— Exit from hardware loop
Move Instructions
The DSP56000 instructions used for move operations are:
LUA
MOVE
MOVEC
MOVEM
MOVEP
— Load updated address
— Move data*
— Move control register
— Move program memory
— Move peripheral data
*Instruction allows parallel data move.
*Instruction allows parallel data move.
F-4
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Device-dependent Information
DSP56000 Information
F.2.1.6
Program Control Instructions
The DSP56000 instructions used for program control are:
DEBUG
DEBUGcc
ILLEGAL
Jcc
JCLR
JMP
JScc
JSCLR
JSET
JSSET
JSR
NOP
REP
RESET
RTI
RTS
STOP
SWI
WAIT
MOTOROLA
— Enter debug mode
— Enter debug mode conditionally
— Illegal instruction interrupt
— Jump conditionally
— Jump if bit clear
— Jump
— Jump to subroutine conditionally
— Jump to subroutine if bit clear
— Jump if bit set
— Jump to subroutine if bit set
— Jump to subroutine
— No operation
— Repeat next instruction
— Reset on-chip peripheral devices
— Return from interrupt
— Return from subroutine
— Stop processing (low power standby)
— Software interrupt
— Wait for interrupt (low power standby)
DSP ASSEMBLER REFERENCE MANUAL
F-5
Device-dependent Information
DSP56000 Information
F.2.2
Register Names and Usage
The following DSP56000 register names, in either upper or lower case, cannot be used
as symbol names in an assembly language source file:
X
X0
X1
Y
Y0
Y1
A
A0
A1
B
B0
B1
AB
BA
A10
B10
A2
B2
R0
R1
R2
R3
R4
R5
R6
R7
N0
N1
N2
N3
N4
N5
N6
N7
M0
M1
M2
M3
M4
M5
M6
M7
MR
CCR
SR
LC
LA
SSH
SSL
OMR
The following DSP56000 registers are used by the Assembler in structured control statement processing (Chapter 7):
A
F-6
X0
Y0
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Device-dependent Information
DSP56000 Information
F.2.3
Condition Code Mnemonics
Following are the DSP56000 condition code mnemonics which correspond to the conditional instructions based on the CCR condition codes. These tests may be used in an operand comparison expression within a structured control statement (Chapter 7).
<CC>
<CS>
<EC>
<EQ>
<ES>
<GE>
<GT>
<HS>
<LC>
<LE>
<LO>
<LS>
<LT>
<MI>
<NE>
<NN>
<NR>
<PL>
MOTOROLA
— carry clear
— carry set
— extension clear
— equal
— extension set
— greater or equal
— greater than
— higher or same
— limit clear
— less or equal
— lower
— limit set
— less than
— minus
— not equal
— not normalized
— normalized
— plus
DSP ASSEMBLER REFERENCE MANUAL
F-7
Device-dependent Information
DSP96000 Information
F.3
DSP96000 INFORMATION
The Motorola DSP96000 refers to a family of dual-port IEEE floating point programmable
CMOS processors. The DSP960002 supports IEEE 754 single precision and single extended precision floating point and 32-bit signed and unsigned fixed point arithmetic.
F.3.1
Instruction Set Summary
DSP96000 instructions can be grouped by function into six types:
1.
2.
3.
4.
5.
6.
F.3.1.1
Arithmetic instructions
Logical instructions
Bit manipulation instructions
Loop instructions
Move instructions
Program control instructions
Arithmetic Instructions
The DSP96000 instructions used for arithmetic operations are:
ABS
ADD
ADDC
ASL
ASR
BFIND
CLR
CMP
CMPG
DEC
EXT
EXTB
FABS
FADD
FADDSUB
FCLR
FCMP
FCMPG
FCMPM
FCOPYS
— Absolute value*
— Add*
— Add with carry*
— Arithmetic shift left*
— Arithmetic shift right*
— Find leading one*
— Clear register*
— Compare*
— Graphics compare*
— Decrement by one*
— Sign extend half word*
— Sign extend byte*
— Floating point absolute value*
— Floating point add*
— Floating point add and subtract*
— Clear floating point register*
— Floating point compare*
— Floating point graphics compare*
— Floating point magnitude compare*
— Floating point copy sign*
*Instruction allows parallel data move.
F-8
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Device-dependent Information
DSP96000 Information
FGETMAN
FINT
FLOAT
FLOATU
FLOOR
FMPY
FMPY/FADD
FMPY/FSUB
FMPY/FADDSUB
FNEG
FSCALE
FSEEDD
FSEEDR
FSUB
FTST
GETEXP
INC
INT
INTRZ
INTU
INTURZ
JOIN
JOINB
MPYS
MPYU
NEG
NEGC
RND
SETW
SPLIT
SPLITB
SUB
SUBC
TST
— Extract mantissa*
— Extract integer*
— Convert integer to floating point*
— Unsigned integer to floating point*
— Extract integer*
— Floating point multiply*
— Floating point multiply and add*
— Floating point multiply and subtract*
— Floating point multiply and add/subtract*
— Floating point negate*
— Scale floating point operand*
— Reciprocal approximation
— Square root reciprocal approximation
— Floating point subtract*
— Test floating point operand*
— Extract exponent*
— Increment by one*
— Convert floating point to integer*
— Convert floating point to integer with round to zero*
— Convert floating point to unsigned integer*
— Convert floating point to unsigned integer with round to zero*
— Join two 16-bit integers*
— Join two 8-bit integers*
— Signed multiply*
— Unsigned multiply*
— Negate*
— Negate with carry*
— Round accumulator*
— Set operand*
— Extract 16-bit integer*
— Extract 8-bit integer*
— Subtract*
— Subtract with carry*
— Test*
*Instruction allows parallel data move.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
F-9
Device-dependent Information
DSP96000 Information
F.3.1.2
Logical Instructions
The DSP96000 instructions used for logical operations are:
AND
ANDC
ANDI
EOR
LSL
LSR
NOT
OR
ORC
ORI
ROL
ROR
F.3.1.3
— Logical AND*
— Logical AND with complement*
— AND Immediate to control register
— Logical exclusive OR*
— Logical shift left*
— Logical shift right*
— Logical complement*
— Logical inclusive OR*
— Logical inclusive OR with complement*
— OR immediate with control register
— Rotate left*
— Rotate right*
Bit Manipulation Instructions
The DSP96000 instructions used for bit manipulation are:
BCHG
BCLR
BSET
BTST
F.3.1.4
— Bit test and change
— Bit test and clear
— Bit test and set
— Bit test on memory
Loop Instructions
The DSP96000 instructions used for loop operations are:
DO
DOR
ENDDO
— Start hardware loop
— Start PC-relative hardware loop
— Exit from hardware loop
*Instruction allows parallel data move.
F-10
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Device-dependent Information
DSP96000 Information
F.3.1.5
Move Instructions
The DSP96000 instructions used for move operations are:
FTFR
LEA
LRA
MOVE
MOVEC
MOVEI
MOVEM
MOVEP
MOVES
MOVETA
TFR
— Transfer floating point data ALU register
— Load effective address
— Load PC-relative address
— Move data*
— Move control register
— Move immediate short
— Move program memory
— Move peripheral data
— Move absolute short
— Move data registers and test address*
— Transfer data ALU register*
*Instruction allows parallel data move.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
F-11
Device-dependent Information
DSP96000 Information
F.3.1.6
Program Control Instructions
The DSP96000 instructions used for program control are:
Bcc
BRA
BRCLR
BRSET
BScc
BSCLR
BSR
BSSET
DEBUGcc
FBcc
FBScc
FDEBUGcc
FJcc
FJScc
FTRAPcc
ILLEGAL
Jcc
JCLR
JMP
JScc
JSCLR
JSET
JSR
JSSET
NOP
PFLUSH
PFREE
PLOCK
PLOCKR
PUNLOCK
PUNLOCKR
REP
RESET
RTI
RTR
RTS
STOP
F-12
— Branch conditionally
— Branch always
— Branch if bit clear
— Branch if bit set
— Branch to subroutine conditionally
— Branch to subroutine if bit clear
— Branch to subroutine
— Branch to subroutine if bit set
— Enter debug mode conditionally
— Floating point branch conditionally
— Floating point branch to subroutine conditionally
— Enter debug mode conditionally
— Floating point jump conditionally
— Floating point jump to subroutine conditionally
— Floating point conditional software interrupt
— Illegal instruction interrupt
— Jump conditionally
— Jump if bit clear
— Jump
— Jump to subroutine conditionally
— Jump to subroutine if bit clear
— Jump if bit set
— Jump to subroutine
— Jump to subroutine if bit set
— No operation
— Flush program cache
— Free program cache
— Program cache sector lock
— Program cache relative sector lock
— Program cache sector unlock
— Program cache relative sector unlock
— Repeat next instruction
— Reset on-chip peripheral devices
— Return from interrupt
— Return from subroutine with restore
— Return from subroutine
— Stop processing (low power standby)
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Device-dependent Information
DSP96000 Information
WAIT
F.3.2
— Wait for interrupt (low power standby)
Register Names and Usage
The following DSP96000 register names, in either upper or lower case, cannot be used
as symbol names in an assembly language source file:
D0
D1
D2
D3
D4
D5
D6
D7
D8
D9
D0.L
D1.L
D2.L
D3.L
D4.L
D5.L
D6.L
D7.L
D8.L
D9.L
D0.M
D1.M
D2.M
D3.M
D4.M
D5.M
D6.M
D7.M
D8.M
D9.M
D0.H
D1.H
D2.H
D3.H
D4.H
D5.H
D6.H
D7.H
D8.H
D9.H
R0
R1
R2
R3
R4
R5
R6
R7
N0
N1
N2
N3
N4
N5
N6
N7
M0
M1
M2
M3
M4
M5
M6
M7
MR
CCR
SR
LC
LA
SSH
SSL
OMR
The following DSP96000 registers are used by the Assembler in structured control statement processing (Chapter 7):
D0.L D0.M D4.L D6.L
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
F-13
Device-dependent Information
DSP96000 Information
F.3.3
Condition Code Mnemonics
Following are the DSP96000 condition code mnemonics which correspond to the conditional instructions based on the CCR condition codes. These tests may be used in an operand comparison expression within a structured control statement (Chapter 7).
<CC>
<CS>
<EQ>
<FEQ>
<FERR>
<FGE>
<FGL>
<FGLE>
<FGT>
<FINF>
<FLE>
<FLT>
<FMI>
<FNE>
<FNGE>
<FNGL>
<FNGLE>
<FNGT>
<FNLT>
<FOR>
<FPL>
<FUN>
<GE>
<GT>
<HI>
<HS>
<LE>
<LO>
<LS>
<LT>
<MI>
<NE>
<PL>
<VC>
<VS>
F-14
— carry clear
— carry set
— equal
— float equal
— float error
— float greater or equal
— float greater or less than
— float greater, less, or equal
— float greater than
— float infinity
— float less or equal
— float less than
— float minus
— float not equal
— float not greater or equal
— float not greater or less than
— float not greater, less, or equal
— float not greater than
— float not less than
— float ordered
— float plus
— float unordered
— greater or equal
— greater than
— higher
— higher or same
— less or equal
— lower
— lower or same
— less than
— minus
— not equal
— plus
— overflow clear
— overflow set
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Device-dependent Information
DSP56100 Information
F.4
DSP56100 INFORMATION
The Motorola DSP56100 refers to a family of high-speed, low power programmable
CMOS processors. The DSP56100 supports16-bit signed fixed-point fractional and
signed and unsigned integer arithmetic.
F.4.1
Instruction Set Summary
DSP56100 instructions can be grouped by function into six types:
1. Arithmetic instructions
2. Logical instructions
3. Bit manipulation instructions
4. Loop instructions
5. Move instructions
6. Program control instructions
F.4.1.1
Arithmetic Instructions
The DSP56100 instructions used for arithmetic operations are:
ABS
ADC
ADD
ASL
ASL4
ASR
ASR4
ASR16
CLR
CLR24
CMP
CMPM
DEC
DEC24
DIV
DMAC
EXT
IMAC
IMPY
INC
— Absolute value*
— Add long with carry
— Add*
— Arithmetic shift accumulator left*
— 4-bit arithmetic shift accumulator left
— Arithmetic shift accumulator right*
— 4-bit arithmetic shift accumulator right
— 16-bit arithmetic shift accumulator right
— Clear accumulator*
— Clear 24 MS bits of accumulator*
— Compare*
— Compare magnitude*
— Decrement accumulator*
— Decrement 24 MS bits of accumulator*
— Divide iteration
— Multiply-accumulate with 16-bit right shift
— Sign extend accumulator
— Integer multiply-accumulate
— Integer multiply
— Increment accumulator*
*Instruction allows parallel data move.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
F-15
Device-dependent Information
DSP56100 Information
INC24
MAC
MACR
MACSU
MACUU
MPY
MPYR
MPYSU
MPYUU
NEG
NEGC
NORM
RND
SBC
SUB
SUBL
SWAP
Tcc
TFR
TFR2
TFR3
TST
TST2
ZERO
F.4.1.2
— Increment 24 MS bits of accumulator*
— Signed multiply-accumulate*
— Signed multiply-accumulate and round*
— Signed/unsigned multiply-accumulate
— Unsigned multiply-accumulate
— Signed multiply*
— Signed multiply and round*
— Signed/unsigned multiply
— Unsigned multiply
— Negate accumulator
— Negate accumulator with carry*
— Normalize accumulator iteration
— Round accumulator*
— Subtract long with carry*
— Subtract*
— Shift left then subtract*
— Swap accumulator words
— Transfer conditionally
— Transfer data ALU register*
— Transfer data ALU register
— Transfer data ALU register
— Test accumulator*
— Test data ALU register*
— Zero extend accumulator
Logical Instructions
The DSP56100 instructions used for logical operations are:
AND
ANDI
EOR
LSL
LSR
NOT
OR
ORI
ROL
ROR
— Logical AND*
— AND Immediate with control register
— Logical exclusive OR*
— Logical shift accumulator left*
— Logical shift accumulator right*
— Logical complement on accumulator*
— Logical inclusive OR*
— OR immediate with control register
— Rotate accumulator left*
— Rotate accumulator right*
*Instruction allows parallel data move.
F-16
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Device-dependent Information
DSP56100 Information
F.4.1.3
Bit Manipulation Instructions
The DSP56100 instructions used for bit manipulation are:
BFCHG
BFCLR
BFSET
BFTSTH
BFTSTL
F.4.1.4
— Test bit field and change
— Clear bit field
— Set bit field
— Test bit field high
— Test bit field low
Loop Instructions
The DSP56100 instructions used for loop operations are:
BRKcc
DO
DO FOREVER
ENDDO
F.4.1.5
— Exit hardware loop conditionally
— Start hardware loop
— Start infinite loop
— Exit from hardware loop
Move Instructions
The DSP56100 instructions used for move operations are:
LEA
MOVE
MOVEC
MOVEI
MOVEM
MOVEP
MOVES
— Load effective address
— Move data*
— Move control register
— Move immediate short
— Move program memory
— Move peripheral data
— Move absolute short
*Instruction allows parallel data move.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
F-17
Device-dependent Information
DSP56100 Information
F.4.1.6
Program Control Instructions
The DSP56100 instructions used for program control are:
Bcc
BRA
BScc
BSR
DEBUG
DEBUGcc
Jcc
JMP
JScc
JSR
NOP
REP
REPcc
RESET
RTI
RTS
STOP
SWI
WAIT
F.4.2
— Branch conditionally
— Branch always
— Branch to subroutine conditionally
— Branch to subroutine
— Enter debug mode
— Enter debug mode conditionally
— Jump conditionally
— Jump
— Jump to subroutine conditionally
— Jump to subroutine
— No operation
— Repeat next instruction
— Repeat next instruction conditionally
— Reset on-chip peripheral devices
— Return from interrupt
— Return from subroutine
— Stop processing (low power standby)
— Software interrupt
— Wait for interrupt (low power standby)
Register Names and Usage
The following DSP56100 register names, in either upper or lower case, cannot be used
as symbol names in an assembly language source file:
F-18
X
X0
X1
Y
Y0
Y1
A
A0
A1
B
B0
B1
A2
R0
R1
R2
R3
MR
LA
N0
N1
N2
N3
CCR
SSH
M0
M1
M2
M3
SR
SSL
B2
LC
OMR
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Device-dependent Information
DSP56100 Information
The following DSP56100 registers are used by the Assembler in structured control statement processing (Chapter 7):
A
F.4.3
X0
Y0
R0
Condition Code Mnemonics
Following are the DSP56100 condition code mnemonics which correspond to the conditional instructions based on the CCR condition codes. These tests may be used in an operand comparison expression within a structured control statement (Chapter 7).
<CC>
<CS>
<EC>
<EQ>
<ES>
<GE>
<GT>
<HS>
<LC>
<LE>
<LO>
<LS>
<LT>
<MI>
<NE>
<NN>
<NR>
<PL>
MOTOROLA
— carry clear
— carry set
— extension clear
— equal
— extension set
— greater or equal
— greater than
— higher or same
— limit clear
— less or equal
— lower
— limit set
— less than
— minus
— not equal
— not normalized
— normalized
— plus
DSP ASSEMBLER REFERENCE MANUAL
F-19
Device-dependent Information
DSP56300 Information
F.5
DSP56300 INFORMATION
The Motorola DSP56300 refers to a family of high-speed, low power programmable
CMOS processors. The DSP56300 supports 24-bit signed fixed-point fractional arithmetic.
F.5.1
Instruction Set Summary
DSP56300 instructions can be grouped by function into six types:
1. Arithmetic instructions
2. Logical instructions
3. Bit manipulation instructions
4. Loop instructions
5. Move instructions
6. Program control instructions
F-20
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Device-dependent Information
DSP56300 Information
F.5.1.1
Arithmetic Instructions
The DSP56300 instructions used for arithmetic operations are:
ABS
ADC
ADD
ADDL
ADDR
ASL
ASR
CLR
CMP
CMPM
CMPU
DEC
DIV
DMAC
INC
MAC
MACI
MACR
MACRI
MACSU
MACUU
MPY
MPYI
MPYR
MPYRI
MPYSU
MPYUU
NEG
NORM
NORMF
RND
SBC
SUB
SUBL
SUBR
— Absolute value*
— Add long with carry*
— Add*
— Shift left then add*
— Shift right then add*
— Arithmetic shift accumulator left*
— Arithmetic shift accumulator right*
— Clear accumulator*
— Compare*
— Compare magnitude*
— Compare unsigned
— Decrement accumulator
— Divide iteration
— Double precision multiply-accumulate
— Increment accumulator
— Signed multiply-accumulate*
— Immediate signed multiply-accumulate
— Signed multiply-accumulate and round*
— Immediate signed multiply-accumulate and round
— Signed/unsigned multiply-accumulate
— Unsigned multiply-accumulate
— Signed multiply*
— Immediate signed multiply
— Signed multiply and round*
— Immediate signed multiply and round
— Signed/unsigned multiply
— Unsigned multiply
— Negate accumulator*
— Normalize accumulator iteration
— Fast normalize accumulator
— Round accumulator*
— Subtract long with carry*
— Subtract*
— Shift left then subtract*
— Shift right then subtract*
*Instruction allows parallel data move.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
F-21
Device-dependent Information
DSP56300 Information
Tcc
TFR
TST
F.5.1.2
— Transfer conditionally
— Transfer data ALU register*
— Test*
Logical Instructions
The DSP56300 instructions used for logical operations are:
AND
ANDI
CLB
EOR
EXTRACT
EXTRACTU
INSERT
LSL
LSR
MERGE
NOT
OR
ORI
ROL
ROR
F.5.1.3
— Logical AND*
— AND Immediate with control register
— Count leading bits
— Logical exclusive OR*
— Extract bit field
— Extract unsigned bit field
— INsert bit field
— Logical shift accumulator left*
— Logical shift accumulator right*
— Merge two half words
— Logical complement on accumulator*
— Logical inclusive OR*
— OR immediate with control register
— Rotate accumulator left*
— Rotate accumulator right*
Bit Manipulation Instructions
The DSP56300 instructions used for bit manipulation are:
BCHG
BCLR
BSET
BTST
— Bit test and change
— Bit test and clear
— Bit test and set
— Bit test on memory
*Instruction allows parallel data move.
F-22
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Device-dependent Information
DSP56300 Information
F.5.1.4
Loop Instructions
The DSP56300 instructions used for loop operations are:
BRKcc
DO
DO FOREVER
DOR
DOR FOREVER
ENDDO
F.5.1.5
— Conditionally exit from hardware loop
— Start hardware loop
— Start infinite hardware loop
— Start PC-relative hardware loop
— Start infinite PC-relative hardware loop
— Exit from hardware loop
Move Instructions
The DSP56300 instructions used for move operations are:
LRA
LUA
MOVE
MOVEC
MOVEM
MOVEP
— Load PC-relative address
— Load updated address
— Move data*
— Move control register
— Move program memory
— Move peripheral data
*Instruction allows parallel data move.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
F-23
Device-dependent Information
DSP56300 Information
F.5.1.6
Program Control Instructions
The DSP56300 instructions used for program control are:
Bcc
BRA
BRCLR
BRSET
BScc
BSCLR
BSR
BSSET
DEBUG
DEBUGcc
IFcc
IFcc.U
Jcc
JCLR
JMP
JScc
JSCLR
JSET
JSSET
JSR
NOP
PFLUSH
PFLUSHUN
PFREE
PLOCK
PLOCKR
PUNLOCK
PUNLOCKR
REP
RESET
RTI
RTS
STOP
TRAP
TRAPcc
WAIT
F-24
— Branch conditionally
— Branch
— Branch if bit clear
— Branch if bet set
— Branch to subroutine conditionally
— Branch to subroutine if bit clear
— Branch to subroutine
— Branch to subroutine if bit set
— Enter debug mode
— Enter debug mode conditionally
— Execute conditionally
— Execute conditionally and update CCR
— Jump conditionally
— Jump if bit clear
— Jump
— Jump to subroutine conditionally
— Jump to subroutine if bit clear
— Jump if bit set
— Jump to subroutine if bit set
— Jump to subroutine
— No operation
— Flush program cache
— Flush program cache unlocked
— Free program cache
— Program cache sector lock
— Program cache relative sector lock
— Program cache sector unlock
— Program cache relative sector unlock
— Repeat next instruction
— Reset on-chip peripheral devices
— Return from interrupt
— Return from subroutine
— Stop processing (low power standby)
— Software trap
— Trap conditionally
— Wait for interrupt (low power standby)
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Device-dependent Information
DSP56300 Information
F.5.2
Register Names and Usage
The following DSP56300 register names, in either upper or lower case, cannot be used
as symbol names in an assembly language source file:
X
X0
X1
Y
Y0
Y1
A
A0
A1
B
B0
B1
AB
BA
A10
B10
A2
B2
R0
R1
R2
R3
R4
R5
R6
R7
N0
N1
N2
N3
N4
N5
N6
N7
M0
M1
M2
M3
M4
M5
M6
M7
MR
CCR
SR
LC
LA
SSH
SSL
OMR
EP
VBA
SC
SZ
COM
EOM
The following DSP56300 registers are used by the assembler in structured control statement processing (Chapter 7):
A
MOTOROLA
X0
Y0
DSP ASSEMBLER REFERENCE MANUAL
F-25
Device-dependent Information
DSP56300 Information
F.5.3
Condition Code Mnemonics
Following are the DSP56300 condition code mnemonics which correspond to the conditional instructions based on the CCR condition codes. These tests may be used in an operand comparison expression within a structured control statement (Chapter 7).
<CC>
<CS>
<EC>
<EQ>
<ES>
<GE>
<GT>
<HS>
<LC>
<LE>
<LO>
<LS>
<LT>
<MI>
<NE>
<NN>
<NR>
<PL>
F-26
— carry clear
— carry set
— extension clear
— equal
— extension set
— greater or equal
— greater than
— higher or same
— limit clear
— less or equal
— lower
— limit set
— less than
— minus
— not equal
— not normalized
— normalized
— plus
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Device-dependent Information
DSP56800 Information
F.6
DSP56800 INFORMATION
The Motorola DSP56800 refers to a family of high-speed, low power programmable
CMOS processors. The DSP56800 supports16-bit signed fixed-point fractional and
signed and unsigned integer arithmetic.
F.6.1
Instruction Set Summary
DSP56800 instructions can be grouped by function into six types:
1. Arithmetic instructions
2. Logical instructions
3. Bit manipulation instructions
4. Loop instructions
5. Move instructions
6. Program control instructions
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
F-27
Device-dependent Information
DSP56800 Information
F.6.1.1
Arithmetic Instructions
The DSP56800 instructions used for arithmetic operations are:
ABS
ADC
ADD
ASL
ASLL
ASR
ASRAC
ASRR
CLR
CMP
DEC(W)
DIV
IMPY(16)
INC(W)
MAC
MACR
MACSU
MPY
MPYR
MPYSU
NEG
NORM
RND
SBC
SUB
Tcc
TFR
TST
TSTW
— Absolute value*
— Add long with carry
— Add*
— Arithmetic shift accumulator left*
— Multi-bit arithmetic left shift
— Arithmetic shift accumulator right*
— Arithmetic right shift with accumulate
— Multi-bit arithmetic right shift
— Clear accumulator*
— Compare*
— Decrement word*
— Divide iteration
— Integer multiply
— Increment word*
— Multiply-accumulate*
— Multiply-accumulate and round*
— Signed/unsigned multiply-accumulate
— Signed multiply*
— Signed multiply and round*
— Signed/unsigned multiply
— Negate accumulator*
— Normalize accumulator iteration
— Round accumulator*
— Subtract long with carry
— Subtract*
— Transfer conditionally
— Transfer data ALU register*
— Test accumulator*
— Test register or memory
*Instruction allows parallel data move.
F-28
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Device-dependent Information
DSP56800 Information
F.6.1.2
Logical Instructions
The DSP56800 instructions used for logical operations are:
AND
ANDC
EOR
EORC
LSL
LSLL
LSR
LSRAC
LSRR
NOT
NOTC
OR
ORC
ROL
ROR
F.6.1.3
— Logical AND
— AND Immediate with control register
— Logical exclusive OR
— Logical exclusive OR immediate
— Logical shift left
— Multi-bit logical shift left
— Logical shift right
— Logical shift right with accumulate
— Multi-bit logical shift right
— Logical complement on accumulator
— Logical complement on accumulator with carry
— Logical inclusive OR
— OR immediate with control register
— Rotate accumulator left*
— Rotate accumulator right*
Bit Manipulation Instructions
The DSP56800 instructions used for bit manipulation are:
BFCHG
BFCLR
BFSET
BFTSTH
BFTSTL
F.6.1.4
— Test bit field and change
— Test bit field and clear
— Test bit field and set
— Test bit field high
— Test bit field low
Loop Instructions
The DSP56800 instructions used for loop operations are:
DO
ENDDO
— Start hardware DO loop
— End current DO loop
*Instruction allows parallel data move.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
F-29
Device-dependent Information
DSP56800 Information
F.6.1.5
Move Instructions
The DSP56800 instructions used for move operations are:
LEA
MOVE
MOVEC
MOVEI
MOVEM
MOVEP
MOVES
POP
F.6.1.6
— Load effective address
— Move data*
— Move control register
— Move immediate
— Move program memory
— Move peripheral data
— Move absolute short
— Pop from stack
Program Control Instructions
The DSP56800 instructions used for program control are:
Bcc
BRA
BRCLR
BRSET
DEBUG
ILLEGAL
Jcc
JMP
JSR
NOP
REP
RTI
RTS
STOP
SWI
WAIT
— Branch conditionally
— Branch always
— Branch if bits clear
— Branch if bits set
— Enter debug mode
— Illegal instruction interrupt
— Jump conditionally
— Jump
— Jump to subroutine
— No operation
— Repeat next instruction
— Return from interrupt
— Return from subroutine
— Stop instruction processing (low power standby)
— Software interrupt
— Wait for interrupt (low power standby)
*Instruction allows parallel data move.
F-30
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Device-dependent Information
DSP56800 Information
F.6.2
Macro Instructions
The DSP56800 Macros are defined in the file 56800mac, provided with the CLAS packages in the asm/ directory. These files are made available by including asm/56800mac.
For more details on including a file refer to Chapter 6.
BVC
BVS
BPL
BMI
BR1CLR
BR1SET
BEC
BES
BLMC
BLMS
JVC
JVS
JPL
JMI
JRCLR
JRSET
JR1SET
JR1CLR
JEC
JES
JLMC
JLMS
PUSH
MOTOROLA
— Branch if overflow cleared
— Branch if overflow bit set.
— Branch if plus
— Branch if minus
— Branch if at least one selected bit is cleared
— Branch if at least one selected bit is set
— Branch if extension cleared
— Branch if extension set
— Branch if limit cleared
— Branch if limit set
— Jump if overflow cleared
— Jump if overflow bit set.
— Jump if plus
— Jump if minus
— Jump if all selected bits are cleared
— Jump if all selected bits are set
— Jump if at least one selected bit is set
— Jump if at least one selected bit is cleared
— Jump if extension bit is cleared
— Jump if extension bit is set
— Jump if limit cleared
— Jump if limit set
— Push onto stack
DSP ASSEMBLER REFERENCE MANUAL
F-31
Device-dependent Information
DSP56800 Information
F.6.3
Register Names and Usage
The following DSP56800 register names, in either upper or lower case, cannot be used
as symbol names in an assembly language source file:
X0
Y
A
B
R0
SP
PC
HWS
F.6.4
Y0
A0
B0
R1
N
MR
OMR
Y1
A1
B1
R2
M01
CCR
LA
A2
B2
R3
SR
LC
Condition Code Mnemonics
Following are the DSP56800 condition code mnemonics which correspond to the conditional instructions based on the CCR condition codes. These tests may be used in an operand comparison expression within a structured control statement (Chapter 7).
<CC>
<CS>
<EQ>
<GE>
<GT>
<HI>*
<HS>*
<LE>
<LO>*
<LS>*
<LT>
<NE>
<NN>
<NR>
— carry clear
— carry set
— equal
— greater than or equal
— greater than
— higher than
— higher than or same
— less than or equal
— lower than
— lower than or same
— less than
— not equal
— not normalized
— normalized
*Only available when CC bit set in OMR
F-32
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Appendix G
HOST-DEPENDENT INFORMATION
G.1
INTRODUCTION
The Motorola DSP development software runs on several host machine and operating
system platforms. The following sections give information on hardware requirements, installation, and other topics relating to specific host environments. The descriptions below
refer directly to the DSP Assembler, but the sections on hardware requirements and installation apply similarly to the DSP linker and librarian as well. See the appropriate chapters in the DSP Linker/Librarian Reference Manual for more information on invocation
options and processing of these utilities.
G.2
DOS/386 ENVIRONMENT
The Motorola DSP Assembler is delivered as an executable file on a CD rom. It may be
run from either a floppy drive or a hard disk, although a hard disk is recommended. The
Assembler will make use of extended memory if it is present, and will utilize available disk
space if physical memory is exhausted.
G.2.1
Hardware Requirements
The minimum hardware requirements for the Assembler in the DOS/386 environment include:
386-based PC or compatible with 80386 (or higher) CPU, 4MB of RAM, and a CDrom drive.
MS-DOS v3.0 or later.
Since the Assembler uses all of available memory for storage of symbols and macros, the
optimal system configuration would have at least 4 megabytes of extended memory. The
Assembler will make use of extended memory beyond 640K and may even use a virtual
memory disk file if necessary. A utility called PMINFO is supplied to provide memory region tuning and virtual file sizing for systems running under Microsoft Windows or other
DOS extended memory managers.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
G-1
Host-dependent Information
DOS/386 Environment
G.2.2
Installation
The Assembler is installed from the distribution CD-rom as part of the CLAS package. A
directory on the CD-rom is provided for each supported platform, containing a README
file containig the installation instructions
G.2.3
Source File Text
Input to the Assembler should be in a standard ASCII text file with carriage return/line feed
character pairs as line terminators. This type of file is created by most standard text editing
programs used on 386 PCs, such as the DOS-supplied editor EDIT.
Using word processing packages for creating Assembler input source files is a little more
involved, but can certainly be done. Word processing packages use special character encodings to indicate format and font settings, margins, indentation, and so forth. In some
cases these special encodings violate the input requirements of the Assembler, and must
be removed or changed.
Most word processing programs have a facility for converting internal-format documents
to standard ASCII text files. See Chapter 2, Input File Format, for more information on the
form and content of Assembler input files.
G.2.4
Invoking the Assembler
The Assembler is invoked from the DOS command line by entering the name of the Assembler executable without the extension, followed by any desired options, and finally the
names of the source files to be assembled. See Chapter 1, Running The Assembler, for
a list of options which can be included on the command line.
As an example, if the Assembler diskette was loaded in drive A, and the source file was
located on the disk in drive B, the following command at the DOS prompt would assemble
the file MYFILE.ASM, putting the object file MYFILE.CLN and the listing file OUTFILE.LST onto the disk in drive B as output:
A:ASM56000 -Bb:myfile.cln -Lb:outfile.lst b:myfile
Since DOS supports standard input and output channels, in the example above any warning or error messages would appear both in the listing file and on the standard output (by
default the console screen).
DOS also supports I/O redirection, so that the Assembler listing can be sent to a file or
directly to an output device. Given a hard disk environment where the Assembler executable has been loaded into a directory BIN that is in the program search path, the following
command will assemble the source file FFT.ASM and send the listing output directly to the
Line Printer 1 device:
ASM56000 fft.dsp >LPT1:
G-2
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Host-dependent Information
SunOS/SOLARIS ENVIRONMENT
In this example no object file is created and all errors and warnings are sent to LPT1: (e.g.
they do not appear on the console screen). The input file is assumed to be in the current
directory. See the IBM or Microsoft DOS manual for more information on directory structure, I/O redirection, and command paths.
G.3
SUNOS/SOLARIS ENVIRONMENT
The Motorola DSP Assembler is delivered on the Development Tools distribution CD-rom
written in SunOS tar format.
G.3.1
Hardware Requirements
The Assembler will run on any SparcStation 2 or higher running SunOS version 4.0 or later or SOLARIS 2.5 or later. A CR-rom drive is required for installation.
G.3.2
Installation
See the readme file in the SunOS and SOLARIS directories on the CD-rom for installation
instructions.
The Assembler may be placed in any generally accessible area, usually /usr/bin or /usr/
local/bin. Be sure that it is located in a directory listing in the PATH environment variable
of those who need to use it. Also, insure that the execute access bits for the file are set
when it is copied to disk; this can be done with the chmod utility (see your User Manual
for information on chmod).
G.3.3
Source File Text
Input to the Assembler should be a standard ASCII text file with newline characters (ASCII
LF, 0AH) as line terminators. This type of file is created by the standard Unix text editors
such as vi, and by other editors which run in the SunOS environment such as Emacs.
Assembler source code imported from other environments may need to be converted, depending on the level of filtering done on the code when it was transferred to the Sun system. Binary text files sent from, for example, a PC or compatible machine will need to have
carriage return characters (ASCII CR, 0DH) and possibly end-of-file markers (ASCII SUB,
1AH) stripped before being processed by the Assembler.
G.3.4
Invoking the Assembler
The Assembler is invoked from the shell (usually csh in SunOS) by entering the name of
the Assembler executable, followed by any desired options, and finally the names of the
source files to be assembled. See Chapter 1, Running The Assembler, for a list of options
which can be included on the command line.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
G-3
Host-dependent Information
HP 700 Environment
As an example, if the Assembler executable was located in a directory listed in the user
PATH environment variable, the following command would assemble the file myfile.asm
in the current working directory, putting the object file myfile in the objects subdirectory
and the listing file outfile into the listings subdirectory:
asm96000 -bobjects/myfile.cln -llistings/outfile.lst myfile
Since SunOS supports standard input and output channels, in the example above any
warning or error messages would appear both in the listing file and on the standard output
(by default the terminal screen).
SunOS also supports I/O redirection, so that the Assembler listing can be sent to a file or
arbitrary output device. Assume a user wanted a list of errors from the assembly, but a full
source code listing was not required. This can be accomplished with the following Assembler command line:
asm96000 -l/dev/null test >test.err
In this example no object file is created and all errors and warnings are routed to the file
test.err. The input file test.asm is assumed to be in the current working directory. Note
that the -L option is used to send the full Assembler listing to the null device.
G.4
HP 700 ENVIRONMENT
The Motorola DSP Assembler is delivered a CD-rom written in tar format.
G.4.1
Hardware Requirements
The Assembler will run on any HP 700 series workstation running HP-UX.
G.4.2
Installation
See the file readme in directory hp on the installation CD-rom for installation instructions.
The Assembler may be placed in any generally accessible area, usually /usr/bin or /usr/
local/bin. Be sure that it is located in a directory listing in the PATH environment variable
of those who need to use it. Also, insure that the execute access bits for the file are set
when it is copied to disk; this can be done with the chmod utility (see your User Manual
for information on chmod).
G.4.3
Source File Text
Input to the Assembler should be a standard ASCII text file with newline characters (ASCII
LF, 0AH) as line terminators. This type of file is created by the standard Unix text editors
such as vi, and by other editors which run in the HP-UX environment such as Emacs.
G-4
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Host-dependent Information
HP 700 Environment
Assembler source code imported from other environments may need to be converted, depending on the level of filtering done on the code when it was transferred to the HP system. Binary text files sent from, for example, a PC or compatible machine will need to have
carriage return characters (ASCII CR, 0DH) and possibly end-of-file markers (ASCII SUB,
1AH) stripped before being processed by the Assembler.
G.4.4
Invoking the Assembler
The Assembler is invoked from the shell (usually ksh in HP-UX) by entering the name of
the Assembler executable, followed by any desired options, and finally the names of the
source files to be assembled. See Chapter 1, Running The Assembler, for a list of options
which can be included on the command line.
As an example, if the Assembler executable was located in a directory listed in the user
PATH environment variable, the following command would assemble the file myfile.asm
in the current working directory, putting the object file myfile in the objects subdirectory
and the listing file outfile into the listings subdirectory:
asm96000 -bobjects/myfile.cln -llistings/outfile.lst myfile
Since HP-UX supports standard input and output channels, in the example above any
warning or error messages would appear both in the listing file and on the standard output
(by default the terminal screen).
HP-UX also supports I/O redirection, so that the Assembler listing can be sent to a file or
arbitrary output device. Assume a user wanted a list of errors from the assembly, but a full
source code listing was not required. This can be accomplished with the following Assembler command line:
asm96000 -l/dev/null test >test.err
In this example no object file is created and all errors and warnings are routed to the file
test.err. The input file test.asm is assumed to be in the current working directory. Note
that the -L option is used to send the full Assembler listing to the null device.
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
G-5
Index
INDEX
Symbols
! ......................................................... 3-4
- ................................................. 3-4, 3-5
!= ...................................................... 3-6
" ............................................... 6-1, 6-13
# ............................................... 6-1, 6-22
#< ............................................ 6-2, 6-23
#> ............................................ 6-2, 6-24
% ......................................3-5, 6-1, 6-11
& ....................................................... 3-6
&& ..................................................... 3-7
* ........................................3-5, 6-1, 6-16
+ ................................................ 3-4, 3-5
++ ...................................6-1, 6-17, 6-18
/ ......................................................... 3-5
; .................................................. 6-1, 6-6
;; ................................................. 6-1, 6-7
< .......................................3-6, 6-1, 6-20
<< .....................................3-5, 6-1, 6-19
<= ..................................................... 3-6
== ..................................................... 3-6
> .......................................3-6, 6-1, 6-21
>= ..................................................... 3-6
>> ..................................................... 3-5
? ............................................... 6-1, 6-10
@ ............................................. 6-1, 6-15
\ .................................................. 6-1, 6-8
^ ........................................3-6, 6-1, 6-12
| ......................................................... 3-6
|| ........................................................ 3-7
~ ....................................................... 3-4
MOTOROLA
—A—
Absolute expression ......................... 3-1
Absolute mode ........................ 1-3, 1-10
Address assignment ......................... 4-6
Addressing
I/O short .................................... 6-19
immediate ................................. 6-22
long ........................................... 6-21
long immediate ......................... 6-24
short ................................. 6-20, 6-76
short immediate ........................ 6-23
ASCII codes ..................................... A-1
Assembler
command line ............................. 1-1
device ......................................... F-1
error ..........................................C-13
fatal error ..................................C-44
hardware .............G-1, G-3, G-4, G-6
host .............................................G-1
installation ... 1-1, G-2, G-3, G-5, G-6
mode ......................................... 6-66
operation 1-1, 1-3, G-2, G-4, G-5, G-7
option ................................. 1-6, 6-69
output .......................................... 2-6
processing .................................. 1-9
verbose ....................................... 1-8
warning ..............................6-77, C-4
Assembly language .......................... 1-1
—B—
Bootstrap mode .............................. 4-20
DSP ASSEMBLER REFERENCE MANUAL
I-1
Index
Buffer .............................................. 1-10
address ..................................... 6-25
circular ...................................... 4-11
end ............................................ 6-46
Byte-wide ........................................ 6-73
—C—
Checksum ...................................... 6-72
COFF ...................................... E-1, E-27
Command line .................................. 1-1
input ............................................ 1-4
Command line option ....................... 1-2
-A ................................................ 1-3
-B ................................................ 1-3
-D ................................................ 1-3
-EA .............................................. 1-4
-EW ............................................. 1-4
-F ................................................. 1-4
-G ................................................ 1-5
-I .................................................. 1-5
-L ................................................. 1-5
-M ................................................ 1-6
-O ................................................ 1-6
-P ................................................ 1-6
-Q ................................................ 1-7
-R ................................................ 1-7
-V ................................................ 1-8
-Z ................................................. 1-8
Comment ........................................ 6-31
delimiter ...................................... 6-6
object file ................ 6-30, E-27, E-31
unreported ................................... 6-7
Comment field .................................. 2-6
Conditional assembly 5-1, 5-9, 6-58, 6-72
Constant ........................................... 3-3
binary .......................................... 3-3
decimal ........................................ 3-3
define ............................... 6-32, 6-33
hexadecimal ................................ 3-3
storage ...................................... 6-27
string ........................................... 3-4
I-2
Cycle count .....................................6-72
—D—
Data
block ......................................... E-31
Data hiding ........................................4-2
Data transfer field ..............................2-5
Debug ...............................................1-5
Directive ............................................6-1
.BREAK ........................6-4, 7-2, B-3
.CONTINUE ..................6-4, 7-3, B-3
.ELSE .................................. 6-4, B-3
.ENDF .................................. 6-4, B-3
.ENDI ................................... 6-4, B-3
.ENDL .................................. 6-4, B-3
.ENDW ................................. 6-4, B-3
.FOR .............................6-4, 7-4, B-3
.IF .................................6-4, 7-5, B-3
.LOOP ...........................6-4, 7-6, B-3
.REPEAT ......................6-4, 7-7, B-3
.UNTIL ................................. 6-4, B-3
.WHILE .........................6-4, 7-7, B-3
assembly control .................. 6-2, B-1
BADDR .......................6-3, 6-25, B-2
BSB ............................6-3, 6-26, B-2
BSC ............................6-3, 6-27, B-2
BSM ............................6-3, 6-28, B-2
BUFFER .....................6-3, 6-29, B-2
COBJ ..........................6-4, 6-30, B-3
COMMENT .................6-2, 6-31, B-1
data definition ...................... 6-3, B-2
DC ..............................6-3, 6-32, B-2
DCB ............................6-3, 6-33, B-2
DEFINE 1-3, 6-2, 6-13, 6-34, 6-72, B-1
DS ...............................6-3, 6-35, B-2
DSM ............................6-3, 6-36, B-2
DSR ............................6-3, 6-37, B-2
DUP .....................5-9, 6-4, 6-38, B-3
DUPA ...................5-9, 6-4, 6-40, B-3
DUPC ..................5-9, 6-4, 6-42, B-3
DUPF ...................5-9, 6-4, 6-43, B-3
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Index
END ............................ 6-2, 6-45, B-1
ENDBUF .................... 6-3, 6-46, B-2
ENDIF ........................ 6-4, 6-47, B-3
ENDM .................. 5-2, 6-4, 6-48, B-3
ENDSEC .................... 6-3, 6-49, B-2
EQU ........................... 6-3, 6-50, B-2
EXITM ........................ 6-4, 6-51, B-3
FAIL ............................ 6-2, 6-52, B-1
FORCE ....................... 6-2, 6-53, B-1
GLOBAL ..................... 6-3, 6-54, B-2
GSET ......................... 6-3, 6-55, B-2
HIMEM ....................... 6-2, 6-56, B-1
IDENT ........................ 6-4, 6-57, B-3
IF ......................... 5-9, 6-4, 6-58, B-3
in loop ........................................ 6-72
INCLUDE ................... 6-2, 6-59, B-1
LIST ............................ 6-3, 6-60, B-2
listing control ....................... 6-3, B-2
LOCAL ....................... 6-3, 6-61, B-2
LOMEM ...................... 6-2, 6-62, B-1
LSTCOL ..................... 6-3, 6-63, B-2
MACLIB ........ 1-6, 5-2, 6-4, 6-64, B-3
MACRO ............... 5-2, 6-4, 6-65, B-3
macro .................................. 6-4, B-3
MODE ................. 4-5, 6-2, 6-66, B-1
MSG ........................... 6-2, 6-67, B-1
NOLIST ...................... 6-3, 6-68, B-2
object file ............................. 6-4, B-3
OPT ..................... 1-6, 6-3, 6-69, B-2
ORG .................... 4-7, 6-2, 6-79, B-1
PAGE ......................... 6-3, 6-83, B-2
PMACRO ................... 6-4, 6-85, B-3
PRCTL ....................... 6-3, 6-86, B-2
RADIX ........................ 6-2, 6-87, B-1
RDIRECT ............ 5-1, 6-2, 6-88, B-1
SCSJMP ..................... 6-2, 6-89, B-1
SCSREG .................... 6-2, 6-90, B-1
SECTION ................... 6-3, 6-91, B-2
SET ..................... 4-3, 6-3, 6-94, B-2
STITLE ....................... 6-3, 6-95, B-2
structured control ................ 6-4, B-3
symbol definition ................. 6-3, B-2
MOTOROLA
SYMOBJ .....................6-4, 6-96, B-3
TABS ..........................6-3, 6-97, B-2
TITLE ..........................6-3, 6-98, B-2
UNDEF .......................6-2, 6-99, B-1
WARN .......................6-2, 6-100, B-1
XDEF ................ 4-2, 6-3, 6-101, B-2
XREF ................ 4-2, 6-3, 6-102, B-2
DSP56000 ........................................ F-2
condition code ............................. F-7
instruction set .............................. F-2
register ........................................ F-6
DSP5616 ...............................F-15, F-27
condition code ..................F-19, F-32
instruction set ...................F-15, F-27
register ................... F-18, F-31, F-32
DSP56300 ...................................... F-20
condition code ........................... F-26
instruction set ............................ F-20
register ...................................... F-25
DSP96000 ........................................ F-8
condition code ........................... F-14
instruction set .............................. F-8
register ...................................... F-13
DSPASMOPT ................................... 1-2
Dual read ........................................ 6-72
—E—
Environment variable ....................... 1-2
Error
command line .............................C-2
fatal ...........................................C-44
output .......................................... 1-4
Expression ....................................... 3-1
absolute ...................................... 3-1
address ..................................... 6-72
compound ................................. 7-10
condition code ............................. 7-8
constant ...................................... 3-3
formatting .................................. 7-10
function ....................................... 3-7
internal representation ................ 3-3
DSP ASSEMBLER REFERENCE MANUAL
I-3
Index
object file ................................... E-31
operand comparison ................... 7-9
operator ....................................... 3-4
radix .......................................... 6-87
relative ........................................ 3-1
simple .......................................... 7-8
—F—
File
command line .............................. 1-4
include ................................ 1-5, 6-59
input ............................................ 2-1
listing ........................... 1-5, 2-6, 6-73
macro .......................................... 1-6
object ...................................1-3, E-1
output .......................................... 1-8
source .................................. 1-8, 2-1
Function ................................... 3-7, 6-15
ABS .................................... 3-8, 3-10
ACS .................................... 3-8, 3-10
ARG ................................... 3-9, 3-10
ASN .................................... 3-8, 3-11
AT2 .................................... 3-8, 3-11
ATN .................................... 3-8, 3-11
CCC ................................. 3-10, 3-11
CEL .................................... 3-8, 3-11
CHK .......................................... 3-10
CNT .................................... 3-9, 3-12
COH ................................... 3-8, 3-12
conversion ................................... 3-9
COS ................................... 3-8, 3-12
CTR .................................. 3-10, 3-12
CVF .................................... 3-9, 3-13
CVI ..................................... 3-9, 3-13
CVS .................................... 3-9, 3-13
DEF .................................. 3-10, 3-13
EXP .................................. 3-10, 3-13
FLD .................................... 3-9, 3-14
FLR .................................... 3-8, 3-14
FRC .................................... 3-9, 3-14
INT ................................... 3-10, 3-14
I-4
L10 ..................................... 3-8, 3-14
LCV .................................. 3-10, 3-15
LEN .................................... 3-9, 3-15
LFR .................................... 3-9, 3-15
LNG ................................... 3-9, 3-16
LOG ................................... 3-8, 3-16
LST .................................. 3-10, 3-16
LUN ................................... 3-9, 3-16
MAC ................................... 3-9, 3-16
macro ...........................................3-9
mathematical ...............................3-8
MAX ................................... 3-8, 3-17
MIN .................................... 3-8, 3-17
miscellaneous ............................3-10
MSP ................................. 3-10, 3-17
MXP ................................... 3-9, 3-17
POS .............................................3-9
POW ......................... 3-8, 3-17, 3-18
REL .................................. 3-10, 3-18
RND ................................... 3-8, 3-18
RVB ................................... 3-9, 3-18
SCP ................................... 3-9, 3-19
SGN ................................... 3-8, 3-19
SIN ..................................... 3-8, 3-19
SNH ................................... 3-8, 3-19
SQT ................................... 3-8, 3-19
string ............................................3-9
TAN ................................... 3-8, 3-20
TNH ................................... 3-8, 3-20
UNF ................................... 3-9, 3-20
XPN ................................... 3-8, 3-20
—I—
Include file ............................... 1-5, 6-59
—L—
Label .................................................2-3
local ............2-3, 5-3, 5-8, 6-74, 6-77
Label field ..........................................2-3
Line continuation ...............................6-8
Line number ................................... E-10
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Index
Listing file ..........................1-5, 2-6, 6-73
commentary ............................... D-1
cross-reference .......................... D-3
format 6-63, 6-73, 6-76, 6-83, 6-97, D-1
sub-title ...................................... 6-95
title ............................................. 6-98
Load address .................................... 1-9
Load counter
alignment .......................... 6-72, 6-74
Load location counter ..................... 1-10
Load memory space ................ 1-9, 1-10
Local label ........................................ 2-3
macro .......................................... 2-4
Location counter .................... 6-16, 6-79
—M—
Macro ................................................ 5-1
call ...................................... 5-4, 6-74
comment ................................... 6-72
definition ....................5-2, 6-65, 6-74
directive ..................................... 6-65
end ............................................ 6-48
exit ............................................. 6-51
expansion ........................... 5-4, 6-74
file ................................................ 1-6
library ........................5-2, 6-64, 6-74
purge ......................................... 6-85
Macro argument
concatenation operator ........ 5-5, 6-8
local label override ...................... 5-8
local label override operator ...... 6-12
return hex value operator ... 5-7, 6-11
return value operator .......... 5-6, 6-10
string operator ............................. 5-7
Memory
limit ................................... 6-56, 6-62
reserve ...................................... 6-76
utilization ............ 2-6, 6-74, D-3, D-5
Memory space ................1-9, 6-74, 6-79
attribute ....................................... 3-1
MOTOROLA
—O—
Object file ......................................... 1-3
auxiliary entry ............................ E-20
comment ................ 6-30, E-27, E-31
data expression ........................ E-31
differences ................................ E-27
file header ................................... E-3
format .......................................... E-1
identification .............................. 6-57
line number ............................... E-10
optional header ........................... E-4
relocation .......................... E-9, E-30
section ........................................ E-6
section number ......................... E-14
storage class ............................. E-16
structure ...................................... E-1
structure size ............................ E-30
symbol ............................. 6-77, 6-96
symbol name ............................ E-13
symbol table .............................. E-11
symbol type ............................... E-14
symbol value ............................. E-13
transportability .......................... E-29
Operand 2 field ................................. 2-5
Operand field .................................... 2-5
Operation 2 field ............................... 2-5
Operation field .................................. 2-4
Operator ........................................... 3-4
arithmetic .................................... 3-5
bitwise ......................................... 3-6
logical .......................................... 3-7
precedence ................................. 3-7
relational ..................................... 3-6
shift ............................................. 3-5
unary ........................................... 3-4
Option
AE .................................... 6-70, 6-72
AL .................................... 6-71, 6-72
assembler operation ................. 6-71
CC .................................... 6-70, 6-72
CEX ................................. 6-70, 6-72
DSP ASSEMBLER REFERENCE MANUAL
I-5
Index
CK .................................... 6-71, 6-72
CL .................................... 6-70, 6-72
CM ................................... 6-70, 6-72
CONST ................... 6-71, 6-72, 6-74
CONTC ............................ 6-70, 6-72
CONTCK .......................... 6-71, 6-72
CRE ................................. 6-70, 6-72
DBL .................................. 6-71, 6-72
DEX .................................. 6-71, 6-72
DLD .................................. 6-71, 6-72
DXL .................................. 6-70, 6-72
EM .................................... 6-71, 6-73
FC .................................... 6-69, 6-73
FF ..................................... 6-69, 6-73
FM .................................... 6-69, 6-73
GL .................................... 6-71, 6-73
GS .................................... 6-71, 6-73
HDR ................................. 6-70, 6-73
IC ..................................... 6-71, 6-73
IDW .................................. 6-70, 6-73
IL ...................................... 6-70, 6-73
INTR ................................. 6-71, 6-73
LB ..................................... 6-71, 6-73
LBX .................................. 6-71, 6-73
LDB .................................. 6-71, 6-73
listing format .............................. 6-69
LOC .................................. 6-70, 6-74
MC ................................... 6-70, 6-74
MD ................................... 6-70, 6-74
message ................................... 6-70
MEX ................................. 6-70, 6-74
MI ..................................... 6-71, 6-74
MSW ................................ 6-70, 6-74
MU ................................... 6-70, 6-74
NDE ................................. 6-70, 6-74
NL .................................... 6-70, 6-74
NOAE ........................................ 6-74
NOAL ........................................ 6-74
NOCC ....................................... 6-74
NOCEX ..................................... 6-74
NOCK ........................................ 6-74
NOCL ........................................ 6-74
I-6
NOCM ........................................6-74
NOCONST .................................6-74
NODBL ......................................6-74
NODEX ......................................6-74
NODLD ......................................6-74
NODXL ......................................6-74
NOFC ........................................6-75
NOFF .........................................6-75
NOFM ........................................6-75
NOGS ........................................6-75
NOHDR .....................................6-75
NOIDW ......................................6-75
NOINTR .....................................6-75
NOMC ........................................6-75
NOMD ........................................6-75
NOMEX .....................................6-75
NOMI .........................................6-75
NOMSW ....................................6-75
NONDE ......................................6-75
NONL .........................................6-75
NONS ........................................6-75
NOPP ........................................6-75
NOPS ........................................6-75
NOPSB ......................................6-75
NOPSM .....................................6-75
NORC ........................................6-75
NORP ........................................6-75
NORSV ......................................6-75
NOSCL ......................................6-75
NOSI ..........................................6-76
NOSMS .....................................6-76
NOU ...........................................6-76
NOUR ........................................6-76
NOW ..........................................6-76
NS .................................... 6-71, 6-76
PP .................................... 6-69, 6-76
PS .................................... 6-71, 6-76
PSB ................................. 6-71, 6-76
PSM ................................. 6-71, 6-76
RC ................................... 6-69, 6-76
reporting ....................................6-70
RP .................................... 6-71, 6-76
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
Index
RSV .................................. 6-71, 6-76
S ....................................... 6-70, 6-76
SBM ................................. 6-71, 6-76
SCL .................................. 6-71, 6-77
SCO ................................. 6-71, 6-77
SI ...................................... 6-71, 6-77
SMS ................................. 6-71, 6-77
SO .................................... 6-71, 6-77
SVO ........................................... 6-71
symbol ....................................... 6-71
U ....................................... 6-70, 6-77
UR .................................... 6-70, 6-77
W ...................................... 6-70, 6-77
WEX .......................................... 6-77
XLL ................................... 6-71, 6-77
XR .................................... 6-71, 6-78
Overlay .............................1-9, 4-9, 4-16
bootstrap ................................... 4-20
—P—
Pipeline stall .......................... 6-73, 6-75
Processor
revision ................................. 1-6, 1-7
Program counter .................... 6-16, 6-79
—R—
Relative expression .......................... 3-1
Relative mode ................................. 1-10
Relocation ............................... E-9, E-30
Runtime address ............................ 1-10
Runtime location counter ................ 1-10
Runtime memory space .................. 1-10
header ......................................... E-7
local .......................... 4-3, 6-61, 6-91
macro .......................................... 4-4
nested ................................ 4-4, 6-76
relocation .................................... 4-5
static ......................... 4-6, 6-73, 6-91
symbol ........................................ 4-2
Source file ................................. 1-8, 2-1
end ............................................ 6-45
format .......... 2-2, G-2, G-4, G-5, G-6
Stall
pipeline ............................ 6-73, 6-75
String ................................................ 2-2
concatenation ........... 2-2, 6-17, 6-18
delimiter .................................... 6-13
packed ...................................... 6-76
position ..................................... 3-17
substring ..................................... 2-2
Symbol ............................................. 2-1
case .......................................... 6-73
cross-reference ......................... 6-72
equate ..................... 6-50, 6-72, 6-74
global ........................................ 6-73
listing ......................................... 6-76
set ..................6-55, 6-76, 6-77, 6-94
strip ............................................. 1-8
undefined .................................. 6-77
—W—
Warning ...................................6-77, C-4
—S—
Section ..................................... 4-1, 6-91
block data ..................................E-31
data hiding ................................... 4-2
end ............................................ 6-49
fragmented .................................. 4-4
global ............... 4-3, 6-54, 6-73, 6-91
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
I-7