Motorola dsp assembler Reference Manual



Yüklə 4,8 Kb.
Pdf görüntüsü
səhifə25/91
tarix08.10.2017
ölçüsü4,8 Kb.
#3546
1   ...   21   22   23   24   25   26   27   28   ...   91

Software Project Management
Example 3: Bootstrap Overlay
4-22
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
similar command is used to assemble the SECT2 module. The two files are linked as fol-
lows:
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 exter-
nal memory. The quotes around the -O options are necessary to avoid interpretation of
parentheses by some host command interpreters. Here the P counter number 1 is set to
hex 100 and mapped to internal memory; likewise the P counter number 2 is set to hex
C000 and mapped to external memory. Base addresses can also be established with the
linker memory control file. Since no explicit overlay base addresses were encountered in
the source files, both load and runtime addresses for the sections will be adjacent and
non-overlapping. Assuming a code size of 2 for each section and a 16 bit word size, the
value for label START1 will be hex 100 and the value for START2 will be hex 102; the
corresponding load addresses will be C000 hex and C004 hex, respectively. The execut-
able output will be written to the file BOOTPROJ.CLD.


MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
5-1
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 in-
struction group.  In either case, macros provide a shorthand notation for handling these
instruction patterns.  Having determined the iterated pattern, the programmer can, within
the macro, designate selected fields of any statement as variable.  Thereafter by invoking
a macro the programmer can use the entire pattern as many times as needed, substituting
different parameters for the designated variable portions of the statements.
When the pattern is defined it is given a name.  This name becomes the mnemonic by
which the macro is subsequently invoked  (called).  If the name of the macro is the same
as an existing Assembler directive or mnemonic opcode, the macro will replace the direc-
tive or mnemonic opcode, and a warning will be issued.  The warning can be avoided by
the use of the RDIRECT directive, which is used to remove entries from the Assembler’s
directive and mnemonic tables.  If directives or mnemonics are removed from the Assem-
bler’s tables, then no warning will be issued when the Assembler processes macros
whose names are the same as the removed directive or mnemonic entries.  However, if
a macro is defined through the MACLIB directive which has the same name as an existing
directive or opcode, it will not automatically replace that directive or opcode as previously
described.  In this case, the RDIRECT directive must be used to force the replacement.
See the description of the MACLIB directive below.
The macro call causes source statements to be generated.  The generated statements
may contain substitutable arguments.  The statements produced by a macro call are rel-
atively unrestricted as to type.  They can be any processor instruction, almost any Assem-
bler directive, or any previously-defined macro.  Source statements resulting from a
macro call are subject to the same conditions and restrictions that are applied to state-
ments written by the programmer.
To invoke a macro, the macro name must appear in the operation code field of a source
statement.  Any arguments are placed in the operand field.  By suitably selecting the ar-
guments in relation to their use as indicated by the macro definition, the programmer
causes the Assembler to produce in-line coding variations of the macro definition.


Macro Operations And Conditional Assembly
Macro Libraries
5-2
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
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 defini-
tion.  The Assembler processes such nested macro calls at expansion time only.  The
nesting of one macro definition within another definition is permitted.  However, the nested
macro definition will not be processed until the primary macro is expanded.  The macro
must be defined before its appearance in a source statement operation field.
5.2
  MACRO LIBRARIES
The Motorola DSP Assembler allows for the maintenance of macro libraries with the MA-
CLIB directive.  This directive is used to specify the pathname (as defined by the host op-
erating system) of a directory that contains macro definitions.  Each macro definition must
be in a separate file, and the file must be named the same as the macro with the extension
.ASM added.  For example, BLOCKMV.ASM would be a file that contained the definition
of the macro called BLOCKMV.
If a MACLIB directive has been specified in the source code and the Assembler encoun-
ters a name in the operation field that is not a previously defined macro or is not contained
in the directive or mnemonic tables, the directory specified in the MACLIB directive will be
searched for a file of that name (with the .ASM extension added).  If such a file is found,
the current source line will be saved, and the file will be opened for input as an INCLUDE
file.  When the end of the file is encountered, the source line is restored and processing
is resumed.
Because the source line is restored, the processed file must have a macro definition of the
unknown name, or an error will result when the source line is restored and processed.
However, the processed file is not limited to macro definitions, and can include any legal
source code statements.  Multiple MACLIB directives may be given, in which case the As-
sembler will search each directory in the order in which they were specified.
5.3
  MACRO DEFINITION
The definition of a macro consists of three parts: the header, which assigns a name to the
macro and defines the dummy arguments; the body, which consists of prototype or skel-
eton source statements; and the terminator.  The header is the MACRO directive, its label,
and the dummy argument list.  The body contains the pattern of standard source state-
ments.  The terminator is the ENDM directive.
The header of a macro definition has the form:


Yüklə 4,8 Kb.

Dostları ilə paylaş:
1   ...   21   22   23   24   25   26   27   28   ...   91




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə