Motorola dsp assembler Reference Manual



Yüklə 4,8 Kb.
Pdf görüntüsü
səhifə10/91
tarix08.10.2017
ölçüsü4,8 Kb.
#3546
1   ...   6   7   8   9   10   11   12   13   ...   91

Writing Assembly Language Programs
Strings
2-2
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
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 apostro-
phes must appear where the single apostrophe is intended.  Strings are used as operands
for some Assembler directives and also can be used to a limited extent in expressions.
A string may also be enclosed in double quotes (") in which case any DEFINE directive
symbols contained in the string would be expanded. The double quote should be used
with care inside macros since it is used as a dummy argument string operator (see Chap-
ter 5). In that case the macro concatenation operator can be used to escape the double-
quoted string if desired.
Two strings separated by the string concatenation operator (++) will be recognized by the
Assembler as equivalent to the concatenation of the two strings.  For example, these two
strings are equivalent:
'ABC'++'DEF'  =  'ABCDEF'
The Assembler has a substring extraction capability using the square brackets ([ ]). Here
is an example:
['DSP56000',3,5]  =  '56000'
Substrings may be used wherever strings are valid and can be nested. There are also
functions for determining the length of a string and the position of one string within anoth-
er. See Chapter 3 for more information on string functions.
2.4
  SOURCE STATEMENT FORMAT
Each source statement may include up to six fields (eight for the DSP96000) separated
by one or more spaces or tabs: a label field, an operation field, an operand field, an addi-
tional opcode and operand field for the DSP96000, up to two data transfer fields, and a
comment field.  Only fields preceding the comment field are considered significant to the


Writing Assembly Language Programs
Source Statement Format
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
2-3
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
In general, the contents of each field other than the comment field cannot contain embed-
ded whitespace characters, since these characters are used as field delimiters. Two ex-
ceptions are blanks and tabs in quoted strings and the syntax of structured control
statements (see Chapter 7).
2.4.1
  Label Field
The label field occurs as the first field of a source statement, and can take one of the fol-
lowing forms:
1. A space or tab as the first character on a line ordinarily indicates that the label 
field is empty, and that the line has no label.
2. An alphabetic character as the first character indicates that the line contains a 
symbol called a label.
3. An underscore (_) as the first character indicates that the label is a  local label.
Labels may be indented if the label symbol is immediately followed by a colon (:).  If the
first non-blank field on a line complies with either forms 2 or 3 above and the field ends
with a colon, the Assembler regards this as the label field, even if it does not start with the
first character on the line.  However, all characters preceding the label on the source line
must be whitespace characters (spaces or tab characters).  There should be no interven-
ing blanks or tabs between the end of the label symbol and the appended colon character.
Local labels are any normal symbol name preceded (with no intervening blanks) by an
underscore (_).  Except for the special case of macros (described below), local labels
have a limited scope bounded by any two non-local labels.  The local label can be referred
to or defined only in source statements that are between two source lines containing non-
local labels.  Local labels are useful in defining program locations where a unique label
name is required but is not considered useful in documenting the source file (for example,
Label
Opcode
Operand
Opcode 2
Operand 2
X field
Y field
Comment


Writing Assembly Language Programs
Source Statement Format
2-4
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
the terminating address of a DO loop).  Note that the maximum length of a local label in-
cludes 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 lo-
cal label override operator is used; see Chapter 5). These local labels are valid for the en-
tire macro expansion and are not considered bounded by non-local labels. Therefore, all
local labels within a macro must be unique. This mechanism allows the programmer to
freely use local labels within a macro definition without regard to the number of times that
the macro is expanded. Non-local labels within a macro expansion are considered to be
normal labels and therefore cannot occur more than once unless used with the SET di-
rective (see Chapter 6).
A label may occur only once in the label field of an individual source file unless it is used
as a local label, a label local to a section, or is used with the SET directive.  If a non-local
label does occur more than once in a label field, each reference to that label after the first
will be flagged as an error.
A line consisting of a label only is a valid line and has the effect of assigning the value of
the location counter to the label.  With the exception of some directives, a label is assigned
the value of the location counter of the first word of the instruction or data being assem-
bled.
2.4.2
  Operation Field
The operation field appears after the label field, and must be preceded by at least one
space or tab.  Entries in the operation field may be one of three types:
Opcode
-
Mnemonics that correspond directly to DSP machine instructions.
Directive
-
Special operation codes known to the Assembler which control 
the assembly process.
Macro call
-
Invocation of a previously defined macro which is to be inserted 
in place of the macro call.
The Assembler first searches for operation codes in an internal macro definition table. If
no match is found, the table of machine operation codes and Assembler directives is
searched. If neither of the tables holds the specified operation code, an error message is
generated (this sequence can be altered with the MACLIB directive). Macro names can
therefore replace standard machine operation codes and Assembler directives, although
a warning will be issued if such a replacement occurs. The warning can be avoided by use
of the RDIRECT directive. See Chapter 6 for more information on the MACLIB and RDI-
RECT directives.


Yüklə 4,8 Kb.

Dostları ilə paylaş:
1   ...   6   7   8   9   10   11   12   13   ...   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ə