Everything
5.3.4 Extended Function Directives

These directives do not affect code generation.

Table 5.34

Extended Function Directives

Directive

Function

.ASSERT

Outputs a string specified in an operand to the standard error output or a file.

?

Defines and references a temporary label.

@

Concatenates strings specified before and after @ so that they are handled as one string.

..FILE

Indicates the name of the assembly-language file being processed by the assembler.

.STACK

Defines a stack value for a specified symbol.

.LINE

Changes line number.

.DEFINE

Defines a replacement symbol.

.ASSERT

This directive outputs a string specified in the operand to the standard error output at assembly.

[Format]

.ASSERTΔ"<string>"

.ASSERTΔ"<string>">Δ<file name>

.ASSERTΔ"<string>">>Δ<file name>

[Description]

This directive outputs a string specified in the operand to the standard error output at assembly.

When a file name is specified, the assembler outputs the string written in the operand to the file.

When an absolute path is specified as a file name, the assembler creates a file in the specified directory.

When no absolute path is specified as a file name;

(1) if no directory information is included in the file name specified by the output option, the assembler creates the file specified by this directive in the current directory.

(2) if directory information is included in the file name specified by the output option, the assembler creates the file specified by this directive and adds the directory information for the file specified by the output option.

(3) if the output option is not specified, the assembler creates the file in the same directory containing the file specified in the command line at assembler startup.

When the ..FILE directive is specified as a file name, the assembler creates a file in the same directory as the file specified in the command line at assembler startup.

[Examples]

To output a message to the sample.dat file:

.ASSERT "string" > sample.dat

To add a message to the sample.dat file:

.ASSERT "string" >> sample.dat

To output a message to a file with the same name as the current processing file but without a file extension:

.ASSERT "string" > ..FILE

[Remarks]

Be sure to insert a space character or a tab between the directive and the operand.

Be sure to enclose the string in the operand within double-quotes.

To output a string to a file, specify the file name after > or >>.

The symbol > directs the assembler to create a new file and output a message to the file. If a file with the same name exists, the file is overwritten.

The symbol >> directs the assembler to add the message to the contents of the specified file. If the specified file is not found, the assembler creates a new file.

Space characters or tabs can be specified before and after > and >>.

The ..FILE directive can be specified as a file name.

 

?

This directive defines a temporary label.

[Format]

?:

Δ<mnemonic >Δ?+

Δ<mnemonic >Δ?-

[Description]

This directive defines a temporary label.

It also references the temporary label defined immediately before or after an instruction.

Definitions and references are allowed within the same file.

Up to 65,535 temporary labels can be defined in a file. In this case, if .INCLUDE is used in the file, the maximum number (65,535) of temporary files includes the labels in the include file.

The temporary labels converted by the assembler are output to the source list file.

[Examples]

[Remarks]

Write "?:" in the line that is to be defined as a temporary label.

To reference the temporary label defined immediately before an instruction, write "?-" as an operand of the instruction.

To reference the temporary label defined immediately after an instruction, write "?+" as an operand of the instruction.

Only the label defined immediately before or after an instruction can be referenced from the instruction.

 

@

This directive concatenates macro arguments, macro variables, reserved symbols, an expanded file name of directive ..FILE, and specified strings.

[Format]

<string>@<string>[@<string> ...]

[Description]

This directive concatenates macro arguments, macro variables, reserved symbols, an expanded file name of directive ..FILE, and specified strings.

[Examples]

Example of file name concatenation:

When the name of the currently processed file is sample1.src, a message is output to the sample.dat file in the following example.

.ASEERT "sample" > [email protected]

Example of string concatenation:

mov_nibble .MACRO p1,src,dest

MOV.@p1 src,dest

.ENDM

 

mov_nibble W,R1,R2 ; Macro call

 

MOV.W R1,R2 ; Macro-expanded code

[Remarks]

Space characters and tabs inserted before and after this directive are concatenated as a string.

Strings can be written before and after this directive.

To use @ as character data (40H), enclose it within double-quotes ("). When a string including @ is enclosed within single-quotes ('), the strings before and after @ are concatenated.

This directive can be used multiple times in one line.

To use the concatenated string as a name, do not insert space characters or tabs before or after this directive.

 

..FILE

This directive is expanded to the name of the file that the assembler is currently processing (assembly-language file name or include file name).

[Format]

..FILE

[Description]

This directive is expanded to the name of the file that the assembler is currently processing (assembly-language file name or include file name).

[Examples]

When the assembly-language file name is sample.src, a message is output to the sample file in the following example.

.ASSERT "sample" > ..FILE

When the assembly-language file name is sample.src, the sample.inc file is included in the following example.

When the above line is written in the incl.inc file included in the sample.src file, a string is output to the incl.mes file in most cases.

.ASSERT "sample" > [email protected]

[Remarks]

This directive can be used in the operand of the .ASSERT and .INCLUDE directives.

Only the file name body with neither file extension nor path is used for replacement.

 

.STACK

This directive defines the stack size to be used for a specified symbol referenced through the Call Walker.

[Format]

.STACKΔ<name>=<numeric value>

[Description]

This directive defines the stack size to be used for a specified symbol referenced through the Call Walker.

[Examples]

.STACK SYMBOL=100H

[Remarks]

The stack value for a symbol can be defined only once; any later definitions for the same symbol are ignored. A multiple of 4 in the range from 0H to 0FFFFFFFCH can be specified for a stack value, and a definition with any other value is ignored.

<numeric value> must be a constant specified without using a forward reference symbol, an externally referenced symbol, or a relative address symbol.

 

.LINE

This directive changes the line number and file name referred to in assembler error messages or at debugging.

[Format]

.LINEΔ<file name>,<line number>

.LINEΔ<line number>

[Description]

This directive changes the line number and file name referred to in assembler error messages or at debugging.

The line number and the file name specified with .LINE are valid until the next .LINE in a program.

The compiler generates .LINE corresponding to the line in the C source file when the assembly source program is output with the debugging option specified.

When the file name is omitted, the file name is not changed, but only the line number is changed.

[Examples]

.LINE "C:\asm\test.c",5

.DEFINE

This directive defines a symbol for a string.

[Format]

<symbol name>Δ.DEFINEΔ<string>

<symbol name>Δ.DEFINEΔ'<string>'

<symbol name>Δ.DEFINEΔ"<string>"

[Description]

This directive defines a symbol for a string. Defined symbols can be redefined.

[Examples]

X_HI .DEFINE R1

MOV.L #0, X_HI

[Remarks]

To define a symbol for a string including a space character or a tab, be sure to enclose it within single-quotes (') or double-quotes (").

The symbols defined through this directive cannot be declared as external references.

When this directive and the .EQU directive declare the same symbol name, the directive to make the declaration first is given priority.