SLAU131Y October 2004 – June 2021
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 MUL_I .macro x,y
2 .if ($symlen(x) == 0)
3 .emsg "ERROR -- Missing Parameter"
4 .mexit
5 .elseif ($symlen(y) == 0)
6 .emsg "ERROR -- Missing Parameter"
7 .mexit
8 .else
9 MOV x, R11
10 MOV y, R12
11 .endif
12 .endm
13
14 0000 MUL_I #50, #51
1 .if ($symlen(x) == 0)
1 .emsg "ERROR -- Missing Parameter"
1 .mexit
1 .elseif ($symlen(y) == 0)
1 .emsg "ERROR -- Missing Parameter"
1 .mexit
1 .else
1 0000 403B MOV #50, R11
0002 0032
1 0004 403C MOV #51, R12
0006 0033
1 .endif
15
16 0008 MUL_I
1 .if ($symlen(x) == 0)
1 .emsg "ERROR -- Missing Parameter"
"macromsg.asm", ERROR! at line 16: [ ***** USER ERROR ***** - ] ERROR -- Missing Parameter
1 .mexit
17
18
1 Assembly Error, No Assembly Warnings