SLAU131Y October 2004 – June 2021
Define Messages
.emsg string
.mmsg string
.wmsg string
These directives allow you to define your own error and warning messages. When you use these directives, the assembler tracks the number of errors and warnings it encounters and prints these numbers on the last line of the listing file.
The .emsg directive sends an error message to the standard output device in the same manner as the assembler. It increments the error count and prevents the assembler from producing an object file.
The .mmsg directive sends an assembly-time message to the standard output device in the same manner as the .emsg and .wmsg directives. It does not, however, set the error or warning counts, and it does not prevent the assembler from producing an object file.
The .wmsg directive sends a warning message to the standard output device in the same manner as the .emsg directive. It increments the warning count rather than the error count, however. It does not prevent the assembler from producing an object file.
This example sends the message ERROR -- MISSING PARAMETER to the standard output device.
Source file:
MSG_EX .macro parm1
.if $symlen(parm1) = 0
.emsg "ERROR -- MISSING PARAMETER"
.else
ADD parm1, r7, r8
.endif
.endm
MSG_EX R11
MSG_EX
Listing file:
1 MSG_EX .macro parm1
2 .if $symlen(parm1)=0
3 .emsg "ERROR -- MISSING PARAMETER"
4 .else
5 ADD parm1, r7
6 .endif
7 .endm
8
9 0000 MSG_EX R11
1 .if $symlen(parm1)=0
1 .emsg "ERROR -- MISSING PARAMETER"
1 .else
1 0000 5B07 ADD R11, r7
1 .endif
10
11 0002 MSG_EX
1 .if $symlen(parm1)=0
1 .emsg "ERROR -- MISSING PARAMETER"
"emsg.asm", ERROR! at line 11: [ ***** USER ERROR ***** - ] ERROR --
MISSING PARAMETER
1 .else
1 ADD parm1, r7
1 .endif
1 Assembly Error, No Assembly Warnings
In addition, the following messages are sent to standard output by the assembler:
*** ERROR! line 11: ***** USER ERROR ***** - : ERROR -- MISSING PARAMETER
.emsg "ERROR -- MISSING PARAMETER"
1 Error, No Warnings
Errors in source - Assembler Aborted