Predefined symbols
These predefined symbols are available:
Symbol | Value |
|---|---|
The name of the base source file being assembled (string). | |
| An integer that identifies the setting of the option |
A unique integer that identifies the build number of the assembler currently in use. The build number does not necessarily increase with an assembler that is released later. | |
| An integer that identifies the chip core in use. The value reflects the setting of the |
| An integer that identifies the data model in use. The symbol reflects the |
The current date in | |
| Either |
| An integer that is set to |
The name of the current source file (string). | |
IAR assembler identifier (number). The current value is 8. Note that the number could be higher in a future version of the product. This symbol can be tested with | |
An integer that is set to | |
| Either |
The current source line number (number). | |
| An integer that identifies the setting of the option |
The current time in | |
The version number in integer format; for example, version 4.17 is returned as 417 (number). |
Including symbol values in code
Several data definition directives make it possible to include a symbol value in the code. These directives define values or reserve memory. To include a symbol value in the code, use the symbol in the appropriate data definition directive.
For example, to include the time of assembly as a string for the program to display:
name timeOfAssembly
extern printStr
public printTime
section CODE:CODE
data8 ; select data mode
; (required for big-endian)
time: dc8 __TIME__ ; String representing the
; time of assembly.
code ; select code mode
; (required for big-endian)
printTime:
mov.l #time,R1 ; Load address of time
; string in R1.
bsr printStr ; Call string output routine.
endTesting symbols for conditional assembly
To test a symbol at assembly time, use one of the conditional assembly directives. These directives let you control the assembly process at assembly time.
For example, if you want to assemble separate code sections depending on whether you are using an old assembler version or a new assembler version, do as follows:
#if (__VER__ > 300) ; New assembler version
;…
;…
#else ; Old assembler version
;…
;…
#endifFor more information, see Conditional assembly directives.