Analog Devices, Inc. reserves the right to change this product without
prior notice. Information furnished by Analog Devices is believed to be
accurate and reliable. However, no responsibility is assumed by Analog
Devices for its use; nor for any infringement of patents or other rights of
third parties which may result from its use. No license is granted by implication or otherwise under the patent rights of Analog Devices, Inc.
Trademark and Service Mark Notice
The Analog Devices logo, VisualDSP++, and the VisualDSP++ logo are
registered trademarks of Analog Devices, Inc.
All other brand and product names are trademarks or service marks of
their respective owners.
CONTENTS
PREFACE
Purpose ........................................................................................... ix
Intended Audience .......................................................................... ix
Manual Contents ............................................................................. x
What’s New in this Manual .............................................................. x
Technical or Customer Support ....................................................... xi
Supported Processors ....................................................................... xi
Product Information ...................................................................... xii
MyAnalog.com ......................................................................... xii
DSP Product Information ......................................................... xii
Related Documents ................................................................. xiii
Online Technical Documentation ............................................. xiv
From VisualDSP++ .............................................................. xiv
From Windows ..................................................................... xv
From the Web ....................................................................... xv
Printed Manuals ....................................................................... xvi
VisualDSP++ Documentation Set ......................................... xvi
Hardware Manuals ............................................................... xvi
Data Sheets .......................................................................... xvi
VisualDSP++ 3.5 Assembler and Preprocessor Manualiii
for ADSP-218x and ADSP-219x DSPs
CONTENTS
Contacting DSP Publications .................................................. xvii
Notation Conventions .................................................................. xvii
xVisualDSP++ 3.5 Assembler and Preprocessor Manual
for ADSP-218x and ADSP-219x DSPs
PREFACE
Thank you for purchasing Analog Devices development software for digital signal processors (DSPs).
Purpose
The VisualDSP++ 3.5 Assembler and Preprocessor Manual for ADSP-218x
and ADSP-219x DSPs contains information about the assembler program
for ADSP-218x and ADSP-219x DSPs. These are 16-bit, fixed-point processors from Analog Devices for use in computing, communications, and
consumer applications.
The manual provides information on how to write assembly programs for
ADSP-218x and ADSP-219x DSPs and reference information about
related development software. It also provides information on new and
legacy syntax for assembler and preprocessor directives and comments, as
well as command-line switches.
Intended Audience
The primary audience for this manual is a programmers who are familiar
with Analog Devices DSPs. This manual assumes that the audience has a
working knowledge of the appropriate DSP architecture and instruction
set. Programmers who are unfamiliar with Analog Devices DSPs can use
this manual but should supplement it with other texts (such as Hardware
Reference and Instruction Set Reference manuals that describe your target
architecture).
VisualDSP++ 3.5 Assembler and Preprocessor Manualix
for ADSP-218x and ADSP-219x DSPs
Manual Contents
Manual Contents
The manual consists of:
•Chapter 1, “Assembler”
Provides an overview of the process of writing and building assembly programs. It also provides information about the assembler’s
switches, expressions, keywords, and directives.
•Chapter 2, “Preprocessor”
Provides procedures for using preprocessor commands within
assembly source files as well as the preprocessor’s command-line
interface options and command sets.
•Chapter 3, “Assembler Enhancements and Legacy Support”
Compares Release 6.1 assembler and preprocessor features to new
features added in latest VisualDSP++ releases.
•Appendix A, “Utilities”
Describes the comment conversion utility that runs from a command line only. This utility provides support for converting legacy
code developed under Release 6.1.
What’s New in this Manual
This edition of the manual supports ADSP-218x and ADSP-219x
processors.
Refer to VisualDSP++ 3.5 Product Bulletin for 16-Bit Processors for information on all new and updated features and other release information.
xVisualDSP++ 3.5 Assembler and Preprocessor Manual
for ADSP-218x and ADSP-219x DSPs
Technical or Customer Support
You can reach DSP Tools Support in the following ways:
•Contact your ADI local sales office or authorized distributor
•Send questions by mail to:
Analog Devices, Inc.
One Technology Way
P.O. Box 9106
Norwood, MA 02062-9106
USA
Preface
Supported Processors
The names “ADSP-218x” and “ADSP-219x” refer to a family of Analog
Devices 16-bit, fixed-point processors. VisualDSP++ currently supports
the following ADSP-218x and ADSP-219x processors:
•ADSP-2191, ADSP-2192-12, ADSP-2195, ADSP-2196,
ADSP-21990, ADSP-21991, and ADSP-21992 DSPs
•ADSP-2181, ADSP-2183, ADSP-2184/84L/84N,
ADSP-2185/85L/85M/85N, ADSP-2186/86L/86M/86N,
ADSP-2187L/84L/87N, ADSP-2188L/88N, and
ADSP-2189M/89N DSPs
VisualDSP++ 3.5 Assembler and Preprocessor Manualxi
for ADSP-218x and ADSP-219x DSPs
Product Information
Product Information
You can obtain product information from the Analog Devices website,
from the product CD-ROM, or from the printed publications (manuals).
Analog Devices is online atwww.analog.com. Our website provides information about a broad range of products—analog integrated circuits,
amplifiers, converters, and digital signal processors.
MyAnalog.com
MyAnalog.com is a free feature of the Analog Devices website that allows
customization of a webpage to display only the latest information on
products you are interested in. You can also choose to receive weekly email
notification containing updates to the webpages that meet your interests.
MyAnalog.com provides access to books, application notes, data sheets,
code examples, and more.
Registration:
Visit www.myanalog.com to sign up. Click Register to use MyAnalog.com.
Registration takes about five minutes and serves as means for you to select
the information you want to receive.
If you are already a registered user, just log on. Your user name is your
email address.
DSP Product Information
For information on digital signal processors, visit our website at
www.analog.com/dsp, which provides access to technical publications,
datasheets, application notes, product overviews, and product
announcements.
xiiVisualDSP++ 3.5 Assembler and Preprocessor Manual
for ADSP-218x and ADSP-219x DSPs
Preface
You may also obtain additional information about Analog Devices and its
products in any of the following ways.
•Email questions or requests for information to
dsp.support@analog.com
•Fax questions or requests for information to
1-781-461-3010 (North America)
089/76 903-557 (Europe)
•Access the Digital Signal Processing Division’s FTP website at
ftp ftp.analog.com or ftp 137.71.23.21
ftp://ftp.analog.com
Related Documents
For information on product related development software, see the following publications:
VisualDSP++ 3.5 Getting Started Guide for 16-Bit Processors
VisualDSP++ 3.5 User’s Guide for 16-Bit Processors
VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-218x DSPs
VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs
VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit DSPs
VisualDSP++ 3.5 Loader Manual for 16-Bit Processors
VisualDSP++ 3.5 Product Bulletin for 16-Bit Processors
VisualDSP++ 3.5 Assembler and Preprocessor Manualxiii
for ADSP-218x and ADSP-219x DSPs
Product Information
Online Technical Documentation
Online documentation comprises VisualDSP++ Help system and tools
manuals, Dinkum Abridged C++ library and FlexLM network license
manager software documentation. You can easily search across the entire
VisualDSP++ documentation set for any topic of interest. For easy printing, supplementary
A description of each documentation file type is as follows.
File Description
.CHMHelp system files and VisualDSP++ tools manuals.
.PDF files for the tools manuals are also provided.
.HTM or
.HTML
.PDFVisualDSP++ tools manuals in Portable Documentation Format, one .PDF file for
Dinkum Abridged C++ library and FlexLM network license manager software documentation. Viewing and printing the
net Explorer 4.0 (or higher).
each manual. Viewing and printing the
Adobe Acrobat Reader (4.0 or higher).
.HTML files require a browser, such as Inter-
.PDF files require a PDF reader, such as
If documentation is not installed on your system as part of the software
installation, you can add it from the VisualDSP++ CD-ROM at any time.
Access the online documentation from the VisualDSP++ environment,
Windows Explorer, or Analog Devices website.
From VisualDSP++
•Access VisualDSP++ online Help from the Help menu’s Contents,
Search, and Index commands.
•Open online Help from context-sensitive user interface items (toolbar buttons, menu commands, and windows).
xivVisualDSP++ 3.5 Assembler and Preprocessor Manual
for ADSP-218x and ADSP-219x DSPs
Preface
From Windows
In addition to any shortcuts you may have constructed, there are many
ways to open VisualDSP++ online Help or the supplementary documentation from Windows.
Help system files (
.CHM files) are located in the Help folder, and .PDF files
are located in the Docs folder of your VisualDSP++ installation. The Docs
folder also contains the FlexLM network license manager software
documentation.
Using Windows Explorer
•Double-click any file that is part of the VisualDSP++ documentation set.
•Double-click the vdsp-help.chm file, which is the master Help system, to access all the other .CHM files.
Using the Windows Start Button
•Access the VisualDSP++ online Help by clicking the Start button
and choosing Programs, Analog Devices, VisualDSP++, and
VisualDSP++ Documentation.
•Access the .PDF files by clicking the Start button and choosing
Programs, Analog Devices, VisualDSP++, Documentation for
Printing, and the name of the book.
From the Web
To download the tools manuals, point your browser at
Select a DSP family and book title. Download archive (.ZIP) files, one for
each manual. Use any archive management software, such as WinZip, to
decompress downloaded files.
VisualDSP++ 3.5 Assembler and Preprocessor Manualxv
for ADSP-218x and ADSP-219x DSPs
Product Information
Printed Manuals
For general questions regarding literature ordering, call the Literature
Center at 1-800-ANALOGD (1-800-262-5643) and follow the prompts.
VisualDSP++ Documentation Set
VisualDSP++ manuals may be purchased through Analog Devices Customer Service at 1-781-329-4700; ask for a Customer Service
representative. The manuals can be purchased only as a kit. For additional
information, call 1-603-883-2430.
If you do not have an account with Analog Devices, you will be referred to
Analog Devices distributors. To get information on our distributors, log
onto
http://www.analog.com/salesdir/continent.asp.
Hardware Manuals
Hardware reference and instruction set reference manuals can be ordered
through the Literature Center or downloaded from the Analog Devices
website. The phone number is 1-800-ANALOGD (1-800-262-5643).
The manuals can be ordered by a title or by product number located on
the back cover of each manual.
Data Sheets
All data sheets can be downloaded from the Analog Devices website. As a
general rule, any data sheet with a letter suffix (L, M, N) can be obtained
from the Literature Center at 1-800-ANALOGD (1-800-262-5643) or
downloaded from the website. data sheets without the suffix can be downloaded from the website only—no hard copies are available. You can ask
for the data sheet by a part name or by product number.
xviVisualDSP++ 3.5 Assembler and Preprocessor Manual
for ADSP-218x and ADSP-219x DSPs
Preface
If you want to have a data sheet faxed to you, the fax number for that
service is 1-800-446-6212. Follow the prompts and a list of data sheet
code numbers will be faxed to you. Call the Literature Center first to find
out if requested data sheets are available.
Contacting DSP Publications
Please send your comments and recommendation on how to improve our
manuals and online Help. You can contact us @
dsp.techpubs@analog.com
Notation Conventions
The following table identifies and describes text conventions used in this
manual.
.
ExampleDescription
Close command
(File menu)
{this | that}Alternative required items in syntax descriptions appear within curly
[this | that]Optional items in syntax descriptions appear within brackets and sepa-
[this,…]Optional item lists in syntax descriptions appear within brackets
.SECTIONCommands, directives, keywords, and feature names are in text with
filenameNon-keyword placeholders appear in text with italic style format.
appear throughout this document.
Tex t in bold style indicates the location of an item within the
VisualDSP++ environment’s menu system. For example, the Close
command appears on the File menu.
brackets and separated by vertical bars; read the example as
that.
rated by vertical bars; read the example as an optional
delimited by commas and terminated with an ellipsis; read the example
as an optional comma-separated list of
letter gothic font.
this or
this or that.
this.
Additional conventions, which apply only to specific chapters, may
VisualDSP++ 3.5 Assembler and Preprocessor Manualxvii
for ADSP-218x and ADSP-219x DSPs
Notation Conventions
ExampleDescription
A note, providing information of special interest or identifying a
related topic. In the online version of this book, the word Note appears
instead of this symbol.
A caution, providing information about critical design or programming issues that influence operation of a product. In the online version
of this book, the word Caution appears instead of this symbol.
xviiiVisualDSP++ 3.5 Assembler and Preprocessor Manual
for ADSP-218x and ADSP-219x DSPs
1ASSEMBLER
This chapter provides information on how to use the assembler for developing and assembling programs with ADSP-218x and ADSP-219x DSPs.
The chapter contains:
•“Assembler Guide” on page 1-2
Describes the process of developing new programs in the
ADSP-218x and ADSP-219x DSP assembly language.
•“Assembler Syntax Reference” on page 1-19
Provides the assembler rules and conventions of syntax which is
used to define symbols (identifiers), expressions, and to describe
different numeric and comment formats.
•“Assembler Command-Line Reference” on page 1-82
Provides reference information on the assembler’s switches and
conventions.
VisualDSP++ 3.5 Assembler and Preprocessor Manual 1-1
for ADSP-218x and ADSP-219x DSPs
Assembler Guide
Assembler Guide
The easm218x.exe and easm219x.exe assemblers run from the
VisualDSP++ Integrated Debugging and Development Environment
(IDDE) or from an operating system command line. Each assembler processes assembly source, data, header files, and produces an object file.
Assembler operations depend on two types of controls: assembler directives and assembler switches.
This section describes the process of developing new programs in the
ADSP-218x and ADSP-219x DSPs assembly language. It provides information on how assemble your programs from the operating system’s
command line.
Software developers using the assembler should be familiar with:
•“Writing Assembly Programs” on page 1-3
•“Using Assembler Support for C Structs” on page 1-13
•“Preprocessing a Program” on page 1-14
•“Reading a Listing File” on page 1-18
•“Make Dependencies” on page 1-17
•“Specifying Assembler Options in VisualDSP++” on page 1-99
For information about the DSP architecture, including the DSP instruction set used when writing the assembly programs, see the Hardware Reference Manual and Instruction Set Manual for an appropriate DSP.
1-2VisualDSP++ 3.5 Assembler and Preprocessor Manual
for ADSP-218x and ADSP-219x DSPs
Assembler
Assembler Overview
The assembler processes data from assembly source (.ASM), data (.DAT),
and include header (
Linkable Format (ELF), an industry-standard format for binary object
files. The object file name has a.DOJ extension.
In addition to the object file, the assembler can produce a listing file,
which shows the correspondence between the binary code and the source.
Assembler switches are specified from the VisualDSP++ or in the command used to invoke the assembler. These switches allow you to control
the assembly process of source, data, and header files. Use these switches
to enable and configure assembly features, such as search paths, output file
names, and macro preprocessing. See “Assembler Command-Line Refer-
ence” on page 1-82.
You can also set assembler options via the Assemble tab of the
VisualDSP++ Project Options dialog box (see “Specifying Assembler
Options in VisualDSP++” on page 1-99).
.H) files to generate object files in Executable and
Writing Assembly Programs
Assembler directives are coded in your assembly source file. The directives
allow you to define variables, set up some hardware features, and identify
program’s sections for placement within DSP memory. The assembler uses
directives for guidance as it translates a source program into object code.
Write assembly language programs using the VisualDSP++ editor or any
editor that produces text files. Do not use a word processor that embeds
special control codes in the text. Use an
names to identify them as assembly source files.
VisualDSP++ 3.5 Assembler and Preprocessor Manual 1-3
for ADSP-218x and ADSP-219x DSPs
.ASM extension to source file
Assembler Guide
Assemble your source files from the VisualDSP++ environment or using
any mechanism, such as a batch file or makefile, that will support invoking the assembler driver
command-line command. By default, the assembler processes an input file
to produce a binary object file (.DOJ) and an optional listing file (.LST).
Figure 1-1 shows a graphical overview of the assembly process. The figure
shows the preprocessor processing the assembly source (.ASM) and initialization data (.DAT) files.
Object files produced by the ADSP-218x and ADSP-219x DSP assemblers
may be used as input to the linker and archiver. You can archive the output of an assembly process into a library file (.DLB), which can then be
linked with other objects into an executable. Use the linker to combine
separately assembled object files and objects from library files to produce
an executable file.
For more information on the linker and archiver, see the VisualDSP++ 3.5 Linker and Utilities Manual for ADSP-218x and ADSP-219x DSPs.
easm218x.exe and easm219x.exe with a specified
A binary object file (.DOJ) and an optional listing (.LST) file are final
results of the successful assembly.
The assembler listing files are text files read for information on the results
of the assembly process. The listing file also provides information about
the imported C data structures. It tells which imports were used within
the program, followed by a more detailed section (see .
on page 1-51). It shows the name, total size and layout with offset for the
members. The information appears at the end of the listing. You must
specify the -l listname.lst option (on page 1-92) to get the
information.
1-4VisualDSP++ 3.5 Assembler and Preprocessor Manual
VisualDSP++ 3.5 assembler can process your source programs
developed previous VDSP releases including Release 6.1. The
assembly of these programs requires an additional processing steps
described in Chapter 3, “Assembler Enhancements and Legacy
Support” .
for ADSP-218x and ADSP-219x DSPs
IMPORT directive
Assembler
Data initialization file
(.DAT)
Object file
(.DOJ)
Assembly source file
(.ASM, .DSP)
Preprocessor
Intermediate
preprocessed file (.IS)
Assembler
Listing file
Header file
(.H)
(.LST)
Figure 1-1. Assembler Input and Output Files
The assembly source file may contain preprocessor commands, such as
#include
, that cause the preprocessor to include header files (.H) into the
source program. The preprocessor’s only output, an intermediate source
.IS), is the assembler’s primary input.
file (
VisualDSP++ 3.5 Assembler and Preprocessor Manual 1-5
for ADSP-218x and ADSP-219x DSPs
Assembler Guide
Program Content
Assembly source file statements include assembly instructions, assembler
directives, and preprocessor commands.
Assembly Instructions
Instructions adhere to the DSP’s instruction set syntax documented in the
DSP’s Instruction Set manual. Terminate each instruction with a semicolon (
;). Figure 1-2 on page 1-9 shows an example assembly source file.
To mark the location of an instruction, place an address label at the beginning of an instruction line or on the preceding line. End the label with a
colon (:) before beginning the instruction. Your program then refer to this
memory location using the label instead of an absolute address. The
assembler places no restriction on the number of characters in a label.
Labels are case sensitive. The assembler treats “outer” and “Outer” as
unique labels. For example,
outer: AR = AR-1;
Outer: I1 = AR;
jump outer; //jumps back 2 instructions
Assembler Directives
Directives begin with a period (.) and end with a semicolon (;). The
assembler does not differentiate between directives in lowercase or
uppercase.
For a complete description of the easm218x.exe and easm219x.exe assembler’s directive set, see “Assembler Directives” on page 1-40.
1-6VisualDSP++ 3.5 Assembler and Preprocessor Manual
This manual prints directives in uppercase to distinguish them
from other assembly statements.
for ADSP-218x and ADSP-219x DSPs
Assembler
Preprocessor Commands
Preprocessor commands begin with a pound sign (
#) and end with a car-
riage return. The pound sign must be the first non-white space character
on the line containing the command. If the command is longer than one
line, use a backslash (\) and a carriage return to continue the command
onto the next line.
Do not put any characters between the backslash and the carriage return.
Unlike assembler directives, preprocessor commands are case sensitive and
must be lowercase. For example,
#include "string.h"#define MAXIMUM 100
For more information, see “Writing Preprocessor Commands” on
page 2-3. For a list of the preprocessor commands, see “Preprocessor
Command Reference” on page 2-11.
Program Structure
An assembly source file defines code (instructions) and data, and organizes
the instructions and data to allow use of the Linker Description File
(LDF) to describe how code and data are mapped into the memory on
your target DSP. The way you structure your code and data into memory
should follow the memory architecture of the target DSP.
Use the
source files. The
.SECTION directive to organize the code and data in assembly
.SECTION directive defines a grouping of instructions and
data that will occupy contiguous memory addresses in the DSP. The name
given in a section directive corresponds to an input section name in the
Linker Description File.
Suggested input section names that you could use in your assembly source
appear in Table 1-1 on page 1-8. Using these predefined names in your
sources makes it easier to take advantage of the default .
LDF file included
in your DSP system.
VisualDSP++ 3.5 Assembler and Preprocessor Manual 1-7
for ADSP-218x and ADSP-219x DSPs
Assembler Guide
For more information on the .
LDF files, see the VisualDSP++ 3.5 Linker
and Utilities Manual for 16-Bit Processors.
Table 1-1. Suggested Input Section Names
.SECTION NameDescription
data1A section that holds data.
programA section that holds code.
You can use sections in a program to group elements to meet hardware
constraints.
To group the code that reside in off-chip memory, declare a section for
that code and place that section in the selected memory with the linker.
Figure 1-2 on page 1-9 shows how a program divides into sections that
match the memory segmentation of a DSP system.
The example assembly program defines four sections; each section begins
with a .SECTION directive and ends with the occurrence of the next
.SECTION directive or end-of-file. The source program contains two data
and two program sections:
•Data Sections—data1 and constdata. Variables and buffers are
declared and can be initialized.
•Program Sections—
seg_rth and program. Data, instructions, and
statements for conditional assembly are coded.
Looking at Figure 1-2, notice that an assembly source may contain pre-
processor commands, such as #include to include other files in your
source code, #ifdef for conditional assembly, or #define to define
macros.
Assembler directives, such as .VAR, appear within sections to declare and
initialize variables.
1-8VisualDSP++ 3.5 Assembler and Preprocessor Manual