C3.PDF

(254 KB) Pobierz
APPENDIX C
MOTOROLA ASSEMBLER NOTES
MOTOROLA
DSP56303EVMUM/AD, Preliminary
C-1
Motorola Assembler Notes
C.1
C.2
C.3
C.4
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-3
ASSEMBLER SIGNIFICANT CHARACTERS . . . . . . . . . . . . C-3
ASSEMBLER DIRECTIVES . . . . . . . . . . . . . . . . . . . . . . . . C-13
STRUCTURED CONTROL STATEMENTS . . . . . . . . . . . . C-64
C-2
DSP56303EVMUM/AD, Preliminary
MOTOROLA
Motorola Assembler Notes
Introduction
C.1
INTRODUCTION
This appendix supplements information in
Section 3
of this document and provides
a detailed description of the following components used with the Motorola
Assembler:
• Special characters significant to the assembler
• Assembler directives
• Structure control statements
C.2
ASSEMBLER SIGNIFICANT CHARACTERS
There are several one and two character sequences that are significant to the
assembler. The following subsections define these characters and their use.
C.2.1
; 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).
Comments can occupy an entire line, or can be placed after the last
assembler-significant field in a source statement. A comment starting in the first
column of the source file will be aligned with the label field in the listing file.
Otherwise, the comment will be shifted right and aligned with the comment field in
the listing file.
Example B-1
Example of Comment Delimiter
;
THIS COMMENT BEGINS IN COLUMN 1 OF THE SOURCE FILE
LOOP
JSR
COMPUTE
;
THIS IS A TRAILING COMMENT
;
THESE TWO COMMENTS ARE PRECEDED
;
BY A TAB IN THE SOURCE FILE
MOTOROLA
DSP56303EVMUM/AD, Preliminary
C-3
Motorola Assembler Notes
Assembler Significant Characters
C.2.2
;;
Unreported Comment Delimiter Characters
Unreported comments are any number of characters preceded by two consecutive
semicolons (
;;
) that are not part of a literal string. Unreported comments are not
considered significant by the assembler, and can be included in the source statement,
following the same rules as normal comments. However, unreported comments are
never reproduced on the assembler output listing, and are never saved as part of
macro definitions.
Example B-2
Example of Unreported Comment Delimiter
;;
THESE LINES WILL NOT BE REPRODUCED
;;
IN THE SOURCE LISTING
C.2.3
\ Line Continuation Character or Macro Argument
Concatenation Character Line Continuation
C.2.3.1
Line Continuation
The backslash character (
\
), if used as the last character on a line, indicates to the
assembler that the source statement is continued on the following line. The
continuation line will be concatenated to the previous line of the source statement,
and the result will be processed by the assembler as if it were a single line source
statement. The maximum source statement length (the first line and any continuation
lines) is 512 characters.
Example B-3
Example of Line Continuation Character
; THIS COMMENT \
EXTENDS OVER \
THREE LINES
C.2.3.2
Macro Argument Concatenation
The backslash (
\
) is also used to cause the concatenation of a macro dummy
argument with other adjacent alphanumeric characters. For the macro processor to
recognize dummy arguments, they must normally be separated from other
alphanumeric characters by a non-symbol character. However, sometimes it is
desirable to concatenate the argument characters with other characters. If an
argument is to be concatenated in front of or behind some other symbol characters,
then it must be followed by or preceded by the backslash, respectively.
C-4
DSP56303EVMUM/AD, Preliminary
MOTOROLA
Motorola Assembler Notes
Assembler Significant Characters
Example B-4
Example of Macro Concatenation
Suppose the source input file contained the following macro definition:
SWAP_REG
MACRO
MOVE
MOVE
MOVE
ENDM
REG1,REG2 ;swap REG1,REG2 using D4.L as temp
R
\
REG1,D4.L
R
\
REG2,R
\
REG1
D4.L,R
\
REG2
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
R0,D4.L
R1,R0
D4.L,R1
C.2.4
? Return Value of Symbol Character
The
?
<symbol> sequence, when used in macro definitions, will be replaced by an
ASCII string representing the value of <symbol>. This operator may be used in
association with the backslash (
\
) operator. The value of <symbol> must be an
integer (not floating point).
Example B-5
Example of Use of Return Value Character
Consider the following macro definition:
SWAP_SYMMACRO
MOVE
MOVE
MOVE
ENDM
REG1,REG2;swap REG1,REG2 using D4.L as temp
R
\?
REG1,D4.L
R
\?
REG2,R
\?
REG1
D4.L,R
\?
REG2
If the source file contained the following SET statements and macro call,
AREG
BREG
SET
SET
SWAP_SYM
0
1
AREG,BREG
the resulting expansion as it would appear on the source listing would be:
MOTOROLA
DSP56303EVMUM/AD, Preliminary
C-5
Zgłoś jeśli naruszono regulamin