SPRU513Y August 2001 – June 2022 SM320F28335-EP
The macro language supports three directives that enable you to define your own assembly-time error and warning messages. These directives are especially useful when you want to create messages specific to your needs. The last line of the listing file shows the error and warning counts. These counts alert you to problems in your code and are especially useful during debugging.
.emsg | sends error messages to the listing file. The .emsg directive generates errors in the same manner as the assembler, incrementing the error count and preventing the assembler from producing an object file. |
.mmsg | sends assembly-time messages to the listing file. The .mmsg directive functions in the same manner as the .emsg directive but does not set the error count or prevent the creation of an object file. |
.wmsg | sends warning messages to the listing file. The .wmsg directive functions in the same manner as the .emsg directive, but it increments the warning count and does not prevent the generation of an object file. |
Macro comments are comments that appear in the definition of the macro but do not show up in the expansion of the macro. An exclamation point in column 1 identifies a macro comment. If you want your comments to appear in the macro expansion, precede your comment with an asterisk or semicolon.
Producing Messages in a Macro shows user messages in macros and macro comments that do not appear in the macro expansion. For more information about the .emsg, .mmsg, and .wmsg assembler directives, see Define Messages.
1 testparam .macro x, y
2 !
3 ! This macro checks for the correct number of parameters.
4 ! It generates an error message if x and y are not present.
5 !
6 ! The first line tests for proper input.
7 !
8 .if ($symlen(x) == 0)
9 .emsg "ERROR --missing parameter in call to TEST"
10 .mexit
11 .else
12 MOV ACC, #2
13 MOV AL, #1
14 ADD ACC, @AL
15 .endif
16 .endm
17
18 000000 testparam 1, 2
1 .if ($symlen(x) == 0)
1 .emsg "ERROR --missing parameter in call to TEST"
1 .mexit
1 .else
1 000000 FF20 MOV ACC, #2
000001 0002
1 000002 9A01 MOV AL, #1
1 000003 A0A9 ADD ACC, @AL
1 .endif