FAIL - Generate Error message

Syntax
FAIL  <arg>|<string>

Synonym

None

Description

There are three modes of the FAIL directive, depending upon the operand that is specified:

Examples

The assembly code in the following listing generates the error messages in the next listing. The value of the operand associated with the `FAIL  200' or `FAIL  600'directives determines (1) the format of any warning or error message and (2) whether the source code segment will be assembled.

Listing: Example source code

cpChar: MACRO
          IFC "\1", ""

            FAIL 200

            MEXIT

          ELSE

            LD D6, \1

          ENDIF

          IFC "\2", ""

            FAIL 600

          ELSE

            ST D6, \2

          ENDIF

        ENDM

codSec: SECTION

Start:

        cpChar char1
Listing: Error messages resulting from assembling the source code

>> in "C:\Freescale\demo\warnfail.asm", line 9, col 0, pos 99
        FAIL  600

              ^

WARNING A2332: FAIL found

INFORMATION Macro Expansion    FAIL 600

The following listing is another assembly code example which again incorporates the FAIL  200 and the FAIL  600 directives.

Listing: Example source code

cpChar: MACRO
         IFC "\1", ""

                   FAIL 200

         MEXIT

         ELSE

                   LD D6, \1

         ENDIF

         IFC "\2", ""

                   FAIL 600

         ELSE

                   ST D6, \2

         ENDIF

         ENDM

codeSec: SECTION

Start:

 cpChar ,char2

The following listing is the error message that was generated as a result of assembling the source code in the above listing.

Listing: Error messages resulting from assembling the source code

>> in "C:\Freescale\err.asm", line 3, col 0, pos 41
    FAIL 200

         ^

ERROR A2329: FAIL found

INFORMATION Macro Expansion                 FAIL 200

The following listing has additional uses of the FAIL directive. In this example, the FAIL  string and FAIL  600 directives are used.

Listing: Example source code

cpChar: MACRO
         IFC "\1", ""

               FAIL "A character must be specified as first parameter"

         MEXIT

         ELSE

                   LD D6, \1

         ENDIF

         IFC "\2", ""

                   FAIL 600

         ELSE

                   ST D6, \2

         ENDIF

         ENDM

codeSec: SECTION

Start:

         cpChar  ,char2

The following listing shows the error messages generated from the assembly code as a result of the FAIL directive.

Listing: Error messages resulting from assembling the source code

>> in "C:\Freescale\test.asm", line 3, col 0, pos 37
  FAIL "A character must be specified as first parameter"

      ^

ERROR A2338: A character must be specified as first parameter

INFORMATION Macro Expansion                FAIL "A character must be 
specified as first parameter"