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.
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.
Preface <> The element names are printed in lower case and contained in angle brackets. Some common elements used to describe directives are:
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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
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 . . . . . . . .
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 . . . . . . . . . . . . . . . . . . . . .
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 .
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 . . . . .
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.
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 . . . . . . . . . . . . . . . . . . . .
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 . . . . . . . . . . . . . . . . . . . . .
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 . . . . . . . . . . . . .
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 . . . . . . . . . . . . .
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.
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.
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[] This option specifies that an object file is to be created for Assembler output.
Motorola DSP Assembler Assembler Options -D 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 -EW These options allow the standard error output file to be reassigned on hosts that do not support error output redirection from the command line.
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.
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.
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.
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.
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.
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.
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).
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.
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.
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.
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).
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.
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.
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.
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 ill
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.
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.
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.
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.
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.
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.
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.
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.
Expressions Functions @ASN() Returns the arc sine of as a floating point value in the range -pi/2 to pi/2. The result of 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() Returns the arc tangent of / 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.
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.
Expressions Functions @CVF() Converts the result of to a floating point value. The memory space attribute of the result will be None. Example: FLOAT SET @CVF(5) ; FLOAT = 5.0 @CVI() Converts the result of 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.
Expressions Functions @FLD(,,[,]) Shift and mask into for bits beginning at bit . If 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.
Expressions Functions @LCV({L | R}[,{L | H | }]) 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.
Expressions Functions @LNG(,) Concatenates the single word and into a double word value such that is the high word and is the low word. The memory space attribute of the result will be None. Example: LWORD DC @LNG(HI,LO) ; build long word @LOG() Returns the natural logarithm of as a floating point value. must be greater than zero. The memory space attribute of the result will be None. Example: LOG EQU @LOG(100.
Expressions Functions @MAX([,...,]) Returns the greatest of ,..., 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([,...,]) Returns the least of ,..., 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.
Expressions Functions 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(,) Returns raised to the power as a floating point value. and must be separated by a comma. The memory space attribute of the result will be None. Example: BUF EQU @CVI(@POW(2.0,3.
Expressions Functions @SCP(,) 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() Returns the sign of 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 may be relative or absolute.
Expressions Functions @TAN() Returns the tangent of 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() Returns the hyperbolic tangent of as a floating point value. The memory space attribute of the result will be None. Example: HTAN = @TNH(VAL) ; hyperbolic tangent @UNF() Converts to a floating point value.
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.
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).
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.
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.
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.
Software Project Management Address Assignment spersed among relocatable blocks. The MODE directive has no effect when the command line -A option is active.
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.
Software Project Management Address Assignment or alternatively: ORG [][()]:[][,[][()]:[]] 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.
Software Project Management Address Assignment Which load counter, H, L, or default (if neither H or L is specified), that is associated with the will be used as the load location counter. 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. Non-negative absolute integer expression representing the counter number to be used as the load location counter.
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.
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.
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.
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.
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 . . ORG YLE:$0000 . . ORG YH:$FFC0 . . ORG XH:$FFC0 . .
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 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.
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.
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 . .
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.
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.
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.
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.
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.
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.
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.
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: [[,,...,]] 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.
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.
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.
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 ? sequence is converted to a character string representing the decimal value of the .
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 % sequence is converted to a character string representing the hexadecimal value of the .
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.
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.
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.
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.
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.
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.
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.
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.
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).
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.
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.
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.
Assembler Significant Characters And Directives Assembler Directives ? Return Value of Symbol Character The ? sequence, when used in macro definitions, will be replaced by an ASCII string representing the value of . This operator may be used in association with the backslash (\) operator. The value of 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.
Assembler Significant Characters And Directives Assembler Directives % Return Hex Value of Symbol Character The % sequence, when used in macro definitions, will be replaced by an ASCII string representing the hexadecimal value of . This operator may be used in association with the backslash (\) operator. The value of must be an integer (not floating point).
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.
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.
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.
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.
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.
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.
Assembler Significant Characters And Directives Assembler Directives [] Substring Delimiter [,] Square brackets delimit a substring operation. The argument is the source string. is the substring starting position within . is the length of the desired substring. may be any legal string combination, including another substring. An error is issued if either or exceed the length of .
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.
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.
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.
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.
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.
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.
Assembler Significant Characters And Directives Assembler Directives BADDR Set Buffer Address BADDR , 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 . The buffer type may be either Modulo or Reverse-carry.
Assembler Significant Characters And Directives Assembler Directives BSB Block Storage Bit-Reverse [
Assembler Significant Characters And Directives Assembler Directives BSC Block Storage of Constant [
Assembler Significant Characters And Directives Assembler Directives BSM Block Storage Modulo [
Assembler Significant Characters And Directives Assembler Directives BUFFER Start Buffer BUFFER , 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.
Assembler Significant Characters And Directives Assembler Directives COBJ Comment Object File COBJ The COBJ directive is used to place a comment in the object code file. The 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.
Assembler Significant Characters And Directives Assembler Directives COMMENT Start Comment Lines COMMENT . . 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.
Assembler Significant Characters And Directives Assembler Directives DC Define Constant [
Assembler Significant Characters And Directives Assembler Directives DCB Define Constant Byte [
Assembler Significant Characters And Directives Assembler Directives DEFINE Define Substitution String DEFINE 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 , which will be replaced by . This directive is useful for providing better documentation in the source program. must adhere to the restrictions for non-local labels.
Assembler Significant Characters And Directives Assembler Directives DS Define Storage [
Assembler Significant Characters And Directives Assembler Directives DSM Define Modulo Storage [
Assembler Significant Characters And Directives Assembler Directives DSR Define Reverse Carry Storage [
Assembler Significant Characters And Directives Assembler Directives DUP Duplicate Sequence of Source Lines [
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.
Assembler Significant Characters And Directives Assembler Directives DUPA Duplicate Sequence With Arguments [
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.
Assembler Significant Characters And Directives Assembler Directives DUPC Duplicate Sequence With Characters [
Assembler Significant Characters And Directives Assembler Directives DUPF Duplicate Sequence In Loop [
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.
Assembler Significant Characters And Directives Assembler Directives END End of Source Program END [] 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. may be absolute or relocatable, but must have a memory space attribute of Program or None.
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.
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.
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.
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.
Assembler Significant Characters And Directives Assembler Directives EQU Equate Symbol to a Value
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 . . .
Assembler Significant Characters And Directives Assembler Directives FAIL Programmer Generated Error FAIL [{|}[,{|},...,{|}]] 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.
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.
Assembler Significant Characters And Directives Assembler Directives GLOBAL Global Section Symbol Declaration GLOBAL [,,...,] 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.
Assembler Significant Characters And Directives Assembler Directives GSET Set Global Symbol to a Value GSET GSET 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).
Assembler Significant Characters And Directives Assembler Directives HIMEM Set High Memory Bounds HIMEM []:[,...] The HIMEM directive establishes an absolute high memory bound for code and data generation. corresponds to one of the DSP memory spaces (X, Y, L, P, E). is one of the letters R for runtime counter or L for load counter. The is an absolute integer value within the address range of the machine.
Assembler Significant Characters And Directives Assembler Directives IDENT Object Code Identification Record [] IDENT , The IDENT directive is used to create an identification record for the object module. If is specified, it will be used as the module name. If is not specified, then the filename of the source input file is used as the module name. is the version number; is the revision number.
Assembler Significant Characters And Directives Assembler Directives IF Conditional Assembly Directive IF . . [ELSE] . . ENDIF (the ELSE directive is optional) Part of a program that is to be conditionally assembled must be bounded by an IF-ENDIF directive pair.
Assembler Significant Characters And Directives Assembler Directives INCLUDE Include Secondary File INCLUDE | <> 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.
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.
Assembler Significant Characters And Directives Assembler Directives LOCAL Local Section Symbol Declaration LOCAL [,,...,] 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.
Assembler Significant Characters And Directives Assembler Directives LOMEM Set Low Memory Bounds LOMEM []:[,...] The LOMEM directive establishes an absolute low memory bound for code and data generation. corresponds to one of the DSP memory spaces (X, Y, L, P, E). is one of the letters R for runtime counter or L for load counter. The is an absolute integer value within the address range of the machine.
Assembler Significant Characters And Directives Assembler Directives LSTCOL Set Listing Field Widths LSTCOL [[,[,[,[,[,[,]]]]]]] 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.
Assembler Significant Characters And Directives Assembler Directives MACLIB Macro Library MACLIB This directive is used to specify the (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.
Assembler Significant Characters And Directives Assembler Directives MACRO Macro Definition MACRO [] . . . . ENDM The dummy argument list has the form: [[,,...,]] 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.
Assembler Significant Characters And Directives Assembler Directives MODE Change Relocation Mode MODE 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.
Assembler Significant Characters And Directives Assembler Directives MSG Programmer Generated Message MSG [{|}[,{|},...,{|}]] 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.
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.
Assembler Significant Characters And Directives Assembler Directives OPT Assembler Options OPT
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-r
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 l
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.
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.
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.
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.
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.
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.
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.
Assembler Significant Characters And Directives Assembler Directives ORG Initialize Memory Space and Location Counters ORG [][]:[][,[][]:[]] ORG [][()]:[][,[][()]:[]] 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.
Assembler Significant Characters And Directives Assembler Directives 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.
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.
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.
Assembler Significant Characters And Directives Assembler Directives PAGE Top of Page/Size Page PAGE [[,...,]] 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.
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 [,,...,] 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.
Assembler Significant Characters And Directives Assembler Directives PRCTL Send Control String to Printer PRCTL I,...,I PRCTL simply concatenates its arguments and ships them to the listing file (the directive line itself is not printed unless there is an error). is a byte expression and is an Assembler string. A byte expression would be used to encode non-printing control characters, such as ESC.
Assembler Significant Characters And Directives Assembler Directives RADIX Change Input Radix for Constants RADIX Changes the input base of constants to the result of . 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 (`).
Assembler Significant Characters And Directives Assembler Directives RDIRECT Remove Directive or Mnemonic from Table RDIRECT [,,...,] 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.
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.
Assembler Significant Characters And Directives Assembler Directives SCSREG Reassign Structured Control Statement Registers SCSREG [[,[,[,]]]] 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. is ordinarily the source register for SCS data moves.
Assembler Significant Characters And Directives Assembler Directives SECTION Start Section SECTION [GLOBAL | STATIC | LOCAL] . . . . ENDSEC The SECTION directive defines the start of a section. All symbols that are defined within a section have the associated with them as their section name. This serves to protect them from like-named symbols elsewhere in the program.
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.
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.
Assembler Significant Characters And Directives Assembler Directives SET Set Symbol to a Value SET SET 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).
Assembler Significant Characters And Directives Assembler Directives STITLE Initialize Program Sub-Title STITLE [] 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.
Assembler Significant Characters And Directives Assembler Directives SYMOBJ Write Symbol Information to Object File SYMOBJ [,,...,] The SYMOBJ directive causes information for each 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.
Assembler Significant Characters And Directives Assembler Directives TABS Set Listing Tab Stops TABS The TABS directive allows resetting the listing file tab stops from the default value of 8. A label is not allowed with this directive.
Assembler Significant Characters And Directives Assembler Directives TITLE Initialize Program Title TITLE [] 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.
Assembler Significant Characters And Directives Assembler Directives UNDEF Undefine DEFINE Symbol UNDEF [] The UNDEF directive causes the substitution string associated with to be released, and will no longer represent a valid DEFINE substitution. See the DEFINE directive for more information. A label is not allowed with this directive.
Assembler Significant Characters And Directives Assembler Directives WARN Programmer Generated Warning WARN [{|}[,{|},...,{|}]] 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.
Assembler Significant Characters And Directives Assembler Directives XDEF External Section Symbol Definition XDEF [,,...,] 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.
Assembler Significant Characters And Directives Assembler Directives XREF External Section Symbol Reference XREF [,,...,] 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.
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.
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: A simple or compound expression (section 7.4). Zero or more Assembler directives, structured control statements, or executable instructions.
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 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.
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 .CONTINUE .ENDI . . . .UNTIL x:(r1)+ #0 7.3.3 ;causes immediate jump to .
Structured Control Statements Syntax NOTES: 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 .
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 ; zero bit set? .LOOP Statement SYNAX: .LOOP [] .ENDL FUNCTION: Execute times. This is similar to the .FOR loop construct, except that the initial counter and step value are implied to be #1.
Structured Control Statements Syntax 7.3.6 .REPEAT Statement SYNTAX: .REPEAT .UNTIL FUNCTION: is executed repeatedly until is true. When expression becomes true, advance to the next instruction following .UNTIL. NOTES: The is executed at least once, even if is true upon entry to the .REPEAT loop. EXAMPLE: .REPEAT . . . .UNTIL x:(r1)+ #0 7.3.7 ; loop until zero is found .WHILE Statement SYNTAX: .
Structured Control Statements Simple And Compound Expressions The DO keyword is optional. EXAMPLE: .WHILE . . . .ENDW 7.4 x:(r1)+ #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.
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 Z_L00002 D1 D7,D0 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.
Structured Control Statements Statement Formatting Note that values in the and 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.
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).
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, 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.
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
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 ! " # $ % & ’ ( ) * + , .
Appendix B DIRECTIVE SUMMARY Assembler directives can be grouped by function into seven types: 1. 2. 3. 4. 5. 6. 7. B.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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).
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.
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.
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).
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.
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.
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.
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.
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 .
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.
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.
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.
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.
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.
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.
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).
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.
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.
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.
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.
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.
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.
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 .
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).
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.
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.
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.
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).
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.
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.
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.
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 .
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.
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 .
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Motorola DSP Object File Format (COFF) Object File Structure The general layout of the object file is illustrated in Figure E-1.
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.
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.
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.
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.
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.
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.
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_MACR
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.
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 . . . . . .
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.
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_scla
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.
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
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.
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 defi
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
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 word
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_
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.
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.
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.
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.
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.
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.
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.
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.
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 1
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.
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.
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.
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.
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 sho
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.
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.
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.
Device-dependent Information DSP56000 Information F.2.1.
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.
Device-dependent Information DSP56000 Information F.2.1.
Device-dependent Information DSP56000 Information F.2.
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).
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.
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 multi
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.
Device-dependent Information DSP96000 Information F.3.1.
Device-dependent Information DSP96000 Information F.3.1.
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.
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).
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.
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.
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.
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.
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).
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.
Device-dependent Information DSP56300 Information F.5.1.
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.
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.
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.
Device-dependent Information DSP56300 Information F.5.
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).
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.
Device-dependent Information DSP56800 Information F.6.1.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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 & ...........
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 ............................................
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 .........................
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 .......................
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 ................
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 .................
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 .......................................