This chapter contains the following sections:
Introduction
Built-in Assembly Functions
Overview of Built-in Assembly Functions
Detailed Description of Built-in Assembly Functions
Assembler Directives and Controls
Overview of Assembler Directives
Detailed Description of Assembler Directives
Overview of Assembler Controls
Detailed Description of Assembler Controls
This chapter contains a detailed description of all built-in assembly functions directives and controls. For a description of the TriCore instruction set, refer to the TriCore Architecture v1.3 Manual [2000, Infineon].
The built-in assembler functions are grouped into the following types:
The following tables provide an overview of all built-in assembler functions.
Function | Description |
@ABS (expr) | Absolute value |
@ACS (expr) | Arc cosine |
@ASN (expr) | Arc sine |
@AT2 (expr1,expr2) | Arc tangent |
@ATN (expr) | Arc tangent |
@CEL (expr) | Ceiling function |
@COH (expr) | Hyperbolic cosine |
@COS (expr) | Cosine |
@FLR (expr) | Floor function |
@L10 (expr) | Log base 10 |
@LOG (expr) | Natural logarithm |
@MAX (expr,[,...,exprN]) | Maximum value |
@MIN (expr,[,...,exprN]) | Minimum value |
@POW (expr1,expr2) | Raise to a power |
@RND () | Random value |
@SGN (expr) | Returns the sign of an expression as -1, 0 or 1 |
@SIN (expr) | Sine |
@SNH (expr) | Hyperbolic sine |
@SQT (expr) | Square root |
@TAN (expr) | Tangent |
@TNH (expr) | Hyperbolic tangent |
@XPN (expr) | Exponential function (raise e to a power) |
Function | Description |
@CVF (expr) | Convert integer to floating-point |
@CVI (expr) | Convert floating-point to integer |
@FLD
(base,value, width[,start]) | Shift and mask operation |
@FRACT(expr) | Convert floating-point to 32-bit fractional |
@SFRACT(expr) | Convert floating-point to 16-bit fractional |
@LNG (expr) | Concatenate to double word |
@LUN (expr) | Convert long fractional to floating-point |
@RVB (expr1[,expr2]) | Reverse order of bits in field |
@UNF (expr) | Convert fractional to floating-point |
@LSB (expr) | Get least significant byte of a word |
@MSB (expr) | Get most significant byte of a word |
Function | Description |
@CAT(str1,str2) | Concatenate strings |
@LEN (string) | Length of string |
@POS (str1,str2[,strt]) | Position of substring in string |
@SCP (str1,str2) | Returns 1 if two strings are equal |
@SUB (str1,expr,expr) | Returns a sbustring |
Function | Description |
@ARG (symbol|expr) | Test if macro argument is present |
@CNT () | Return number of macro arguments |
@MAC (symbol) | Test if macro is defined |
@MXP () | Test if macro expansion is active |
Function | Description |
@HI (expr) | Returns upper 16 bits of expression value |
@HIS (expr) | Returns upper 16 bits of expression value, adjusted for signed addition |
@LO (expr) | Returns lower 16 bits of expression value |
@LOS (expr) | Returns lower 16 bits of expression value, adjusted for signed addition |
Function | Description |
@ASPCP() | Returns the name of the pcp assembler executable |
@ASTC () | Returns the name of the assembler executable |
@CPU (string) | Test if CPU type is selected |
@DEF (symbol) | Returns 1 if symbol has been defined |
@EXP (expr) | Expression check |
@INT (expr) | Integer check |
@LST () | LIST control flag value |
Returns the absolute value of expression as an integer value.
Example:
AVAL .SET @ABS(-2.1) ; AVAL = 2
Returns the arc cosine of expression as a floating-point value in the range zero to pi. The result of expression must be between -1 and 1.
Example:
ACOS .SET @ACS(-1.0) ;ACOS = 3.1415926535897931
Returns an integer 1 if the macro argument represented by symbol or expression is present, 0 otherwise. If the argument is a symbol it must be single-quoted and refer to a dummy argument name. If the argument is an expression it refers to the ordinal position of the argument in the macro dummy argument list. The assembler issues a warning if this function is used when no macro expansion is active.
Example:
.IF @ARG('TWIDDLE') ;twiddle factor provided?
Returns the arc sine of expression as a floating-point value in the range -pi/2 to pi/2. The result of expression must be between -1 and 1.
Example:
ARCSINE .SET @ASN(-1.0) ;ARCSINE = -1.570796
Returns the name of the PCP assembler executable. This is 'aspcp' for the PCP assembler.
Example:
ANAME: .byte @ASPCP() ; ANAME = 'aspcp'
Returns the name of the assembler executable. This is 'astc' for the TriCore assembler.
Example:
ANAME: .byte @ASTC() ; ANAME = 'astc'
Returns the arc tangent of expr1/expr2 as a floating-point value in the range -pi to pi. Expr1 and expr2 must be separated by a comma.
Example:
ATAN2 .EQU @AT2(-1.0,1.0) ;ATAN2 = -0.7853982
Returns the arc tangent of expression as a floating-point value in the range -pi/2 to pi/2.
Example:
ATAN .SET @ATN(1.0) ;ATAN = 0.78539816339744828
Concatenates the two strings into one string. The two strings must be enclosed in single or double quotes.
Example:
.DEFINE ID "@CAT('Tri','Core')" ;ID = 'TriCore'
Returns a floating-point value which represents the smallest integer greater than or equal to expression.
Example:
CEIL .SET @CEL(-1.05) ;CEIL = -1.0
Returns the number of arguments of the current macro expansion as an integer. The assembler issues a warning if this function is used when no macro expansion is active.
Example:
ARGCNT .SET @CNT() ;reserve argument count
Returns the hyperbolic cosine of expression as a floating-point value.
Example:
HYCOS .EQU @COH(VAL) ;compute hyperbolic cosine
Returns the cosine of expression as a floating-point value.
Example:
.WORD -@COS(@CVF(COUNT)*FREQ) ;compute cosine value
Returns an integer 1 if string corresponds to the selected CPU type; 0 otherwise. See also the assembler option -C (Select CPU).
Example:
IF @CPU("tc2") ;TriCore 2 specific part
Converts the result of expression to a floating-point value.
Example:
FLOAT .SET @CVF(5) ;FLOAT = 5.0
Converts the result of expression to an integer value. This function should be used with caution since the conversions can be inexact (e.g., floating-point values are truncated).
Example:
INT .SET @CVI(-1.05) ;INT = -1
Returns an integer 1 if symbol has been defined, 0 otherwise. symbol may be any label not associated with a .MACRO or .SDECL directive. If symbol is quoted it is looked up as a .DEFINE symbol; if it is not quoted it is looked up as an ordinary label.
Example:
.IF @DEF('ANGLE') ;is symbol ANGLE defined? .IF @DEF(ANGLE) ;does label ANGLE exist?
Returns 0 if the evaluation of expression would normally result in an error. Returns 1 if the expression can be evaluated correctly. With the @EXP function, you prevent the assembler of generating an error if expression contains an error. No test is made by the assembler for warnings. The expression may be relative or absolute.
Example:
.IF !@EXP(3/0) ;Do the IF on error ;assembler generates no error .IF !(3/0) ;assembler generates an error
Shift and mask value into base for width bits beginning at bit start. If start is omitted, zero (least significant bit) is assumed. All arguments must be positive integers and none may be greater than the target word size. Returns the shifted and masked value.
Example:
VAR1 .EQU @FLD(0,1,1) ;turn bit 0 on, VAR1=1 VAR2 .EQU @FLD(0,3,1) ;turn bit 0 on, VAR2=1 VAR3 .EQU @FLD(0,3,2) ;turn bits 0 and 1 on, VAR3=3 VAR4 .EQU @FLD(0,3,2,1) ;turn bits 1 and 2 on, VAR4=6 VAR5 .EQU @FLD(0,1,1,7) ;turn eighth bit on, VAR5=0x80
Returns a floating-point value which represents the largest integer less than or equal to expression.
Example:
FLOOR .SET @FLR(2.5) ;FLOOR = 2.0
This function returns the 32-bit fractional representation of the floating point expression. The expression must be in the reange [-1,+1>.
Example:
.WORD @FRACT(0.1), @FRACT(1.0)
Returns the upper 16 bits of a value. @HI(expression) is equivalent to ((expression>>16) & 0xffff).
Example:
mov.u d2,#@LO(COUNT) addih d2,d2,#@HI(COUNT) ; upper 16 bits of COUNT
Returns the upper 16 bits of a value, adjusted for a signed addition. @HIS(expression) is equivalent to (((expression+0x800)>>16) & 0xffff).
Example:
movh.a a3,#@HIS(label) lea a3,[a3]@LOS(label)
Returns an integer 1 if expression has an integer result; otherwise, it returns a 0. The expression may be relative or absolute.
Example:
.IF @INT(TERM) ;Test if result is an integer
Returns the base 10 logarithm of expression as a floating-point value. expression must be greater than zero.
Example:
LOG .EQU @L10(100.0) ;LOG = 2
Returns the length of string as an integer.
Example:
SLEN .SET @LEN('string') ;SLEN = 6
Concatenates the 16-bit expr1 and expr2 into a 32-bit word value such that expr1 is the high half and expr2 is the low half.
Example:
LWORD .WORD @LNG(HI,LO) ;build long word
Returns the lower 16 bits of a value. @LO(expression) is equivalent to expression & 0xffff).
Example:
mov.u d2,#@LO(COUNT) ;lower 16 bits of COUNT addih d2,d2,#@HI(COUNT)
Returns the natural logarithm of expression as a floating-point value. expression must be greater than zero.
Example:
LOG .EQU @LOG(100.0) ;LOG = 4.605170
Returns the lower 16 bits of a value, adjusted for a signed addition. @LOS(expression) is equivalent to (((expression+0x8000) & 0xffff) - 0x8000).
Example:
movh.a a3,#@HIS(label) lea a3,[a3]@LOS(label)
Returns the least significant byte of the result of the expression.
expression is interpreted as a half word (16 bit).
Example:
VAR1 .SET @LSB(0x34) ;VAR1 = 0x34 VAR2 .SET @LSB(0x1234) ;VAR2 = 0x34 VAR3 .SET @LSB(0x654321) ;VAR3 = 0x21
Returns the value of the $LIST ON/OFF control flag as an integer. Whenever a $LIST ON control is encountered in the assembler source, the flag is incremented; when a $LIST OFF control is encountered, the flag is decremented.
Example:
.DUP @ABS(@LST()) ;list unconditionally
Converts the 32-bit expression to a floating-point value. expression should represent a binary fraction.
Example:
DBLFRC1 .EQU @LUN(0x40000000) ;DBLFRC1 = 0.5 DBLFRC2 .EQU @LUN(3928472) ;DBLFRC2 = 0.007354736 DBLFRC3 .EQU @LUN(0xE0000000) ;DBLFRC3 = -0.75
Returns an integer 1 if symbol has been defined as a macro name, 0 otherwise.
Example:
.IF @MAC(DOMUL) ;does macro DOMUL exist?
Returns the greatest of expr1,...,exprN as a floating-point value.
Example:
MAX: .BYTE @MAX(1,-2.137,3.5) ;MAX = 3.5
Returns the least of expr1,...,exprN as a floating-point value.
Example:
MIN: .BYTE @MIN(1,-2.137,3.5) ;MIN = -2.137
Returns the most significant byte of the result of the expression.
expression is interpreted as a half word (16 bit).
Example:
VAR1 .SET @MSB(0x34) ;VAR1 = 0x00 VAR2 .SET @MSB(0x1234) ;VAR2 = 0x12 VAR3 .SET @MSB(0x654321) ;VAR3 = 0x43
Returns an integer 1 if the assembler is expanding a macro, 0 otherwise.
Example:
.IF @MXP() ;macro expansion active?
Returns the position of str2 in str1 as an integer, starting at position start. If start is not given the search begins at the beginning of str1. If the start argument is specified it must be a positive integer and cannot exceed the length of the source string. Note that the first position in a string is position 0.
Example:
ID .EQU @POS('TriCore','Core') ;ID = 3 ID2 .EQU @POS('ABCDABCD','B',2) ;ID2 = 5
Returns expr1 raised to the power expr2 as a floating-point value. expr1 and expr2 must be separated by a comma.
Example:
BUF .EQU @CVI(@POW(2.0,3.0)) ;BUF = 8
Returns a random value in the range 0.0 to 1.0.
Example:
SEED .EQU @RND() ;save initial SEED value
Reverse the order of bits in expr1 delimited by the number of bits in expr2. If expr2 is omitted the field is bounded by the target word size. Both expressions must be 16-bit integer values.
Example:
VAR1 .SET @RVB(0x200) ;reverse all bits, VAR1=0x40 VAR2 .SET @RVB(0xB02) ;reverse all bits, VAR2=0x40D0 VAR3 .SET @RVB(0xB02,2) ;reverse bits 0 and 1, ;VAR3=0xB01
Returns an integer 1 if the two strings compare, 0 otherwise. The two strings must be separated by a comma.
Example:
.IF @SCP(STR,'MAIN') ;does STR equal MAIN?
This function returns the 16-bit fractional representation of the floating point expression. The expression must be in the reange [-1,+1>.
Example:
.WORD @SFRACT(0.1), @SFRACT(1.0)
Returns the sign of expression as an integer: -1 if the argument is negative, 0 if zero, 1 if positive. The expression may be relative or absolute.
Example:
VAR1 .SET @SGN(-1.2e-92) ;VAR1 = -1 VAR2 .SET @SGN(0) ;VAR2 = 0 VAR3 .SET @SGN(28.382) ;VAR3 = 1
Returns the sine of expression as a floating-point value.
Example:
.WORD @SIN(@CVF(COUNT)*FREQ) ;compute sine value
Returns the hyperbolic sine of expression as a floating-point value.
Example:
HSINE .EQU @SNH(VAL) ;hyperbolic sine
Returns the square root of expression as a floating-point value. expression must be positive.
Example:
SQRT1 .EQU @SQT(3.5) ;SQRT1 = 1.870829 SQRT2 .EQU @SQT(16) ;SQRT2 = 4
Returns the substring from string as a string. Expression1 is the starting position wihtin string, and expression2 is the length of the desired string. The assembler issues an error if either expression1 or expression2 exceeds the length of string. Note that the first position in a string is position 0.
Example:
.DEFINE ID "@SUB('TriCore',3,4)" ;ID = 'Core'
Returns the tangent of expression as a floating-point value.
Example:
TANGENT .SET @TAN(1.0) ;TANGENT = 1.5574077
Returns the hyperbolic tangent of expression as a floating-point value.
Example:
HTAN .SET @TNH(1) ;HTAN = 0.76159415595
Converts expression to a floating-point value. expression should represent a 16-bit binary fraction.
Example:
FRC .EQU @UNF(0x4000) ;FRC = 0.5
Returns the exponential function (base e raised to the power of expression) as a floating-point value.
Example:
EXP .EQU @XPN(1.0) ;EXP = 2.718282
Assembler directives are grouped in the following categories:
The following tables provide an overview of all assembler directives.
Directive | Description |
.COMMENT | Start comment lines |
.DEFINE | Define substitution string |
.END | End of source program |
.FAIL | Programmer generated error message |
.INCLUDE | Include secondary file |
.MESSAGE | Programmer generated message |
.NAME | Identification for object file (instead of file name) |
.ORG | Initialize memory space and location counters to create a nameless section |
.SDECL | Declare a section with name, type and attributes |
.SECT | Activate a declared section |
.UNDEF | Undefine DEFINE symbol |
.WARNING | Programmer generated warning |
Directive | Description |
.EQU | Assign permanent value to a symbol |
.EXTERN | External symbol declaration |
.GLOBAL | Global section symbol declaration |
.LOCAL | Local symbol declaration |
.SET | Set temporary value to a symbol |
.SIZE | Set size of symbol in the ELF symbol table |
.TYPE | Set symbol type in the ELF symbol table |
Directive | Description |
.ALIGN | Define alignment |
.ACCUM | Define 64-bit constant of 18 + 46 bits format |
.ASCII / .ASCIIZ | Define ASCII string without / with ending NULL byte |
.BYTE | Define constant byte |
.FLOAT / .DOUBLE | Define a 32-bit / 64-bit floating point constant |
.FRACT / .SFRACT | Define a 16-bit / 32-bit constant fraction |
.SPACE | Define storage |
.WORD / .HALF | Define a word / half-word constant |
Directive | Description |
.DUP / .ENDM | Duplicate sequence of source lines |
.DUPA / .ENDM | Duplicate sequence with arguments |
.DUPC / .ENDM | Duplicate sequence with characters |
.DUPF / .ENDM | Duplicate sequence in loop |
.EXITM | Exit macro |
.IF / .ELIF / .ELSE / .ENDIF | Conditional assembly |
.MACRO/ENDM | Define macro |
.PMACRO | Purge macro definition |
Function | Description |
.CALLS | Passes call information to object file. Used by the linker to build a call graph. |
.SYMB | Passes debug information to object file. Used by CrossView Pro for debugging. |
Some assembler directives can be preceeded with a label. If you do not preceede an assembler directive with a label, you must use white space instead (spaces or tabs). The assembler recognizes both upper and lower case for directives.
[label:] .ACCUM argument[,argument]...
With the .ACCUM directive (Define 64-bit Constant) the assembler allocates and initializes two words of memory (64 bits) for each argument. Use commas to separate multiple arguments.
An argument can be:
Multiple arguments are stored in successive address locations in sets of two bytes. If an argument is NULL its corresponding address location is filled with zeros.
If the evaluated expression is out of the range [-217, 217>, the assembler issues a warning and saturates the fractional value.
ACC: .ACCUM 0.1,0.2,0.3
.FRACT / .SFRACT (Define 32-hit / 16-bit constant fraction)
With the ALIGN directive you instruct the assembler to align the location counter. Default the assembler aligns on one byte.
When the assembler encounters the ALIGN directive, it advances the location counter to an address that is aligned as specified by expression and places the next instruction on that address. The assembler fills the 'gap' with NOP instructions. If the location counter is already aligned on the specified alignment, it remains unchanged.
The expression must be a power of two: 2, 4, 8, 16, ... If you specify another value, the assembler changes the alignment to the next higher power of two and issues a warning.
The assembler aligns sections automatically to the largest alignment value occurring in that secton.
A label is not allowed with this directive.
.ALIGN 16 ; the assembler aligns add d2,d2,d4 ; this instruction at 16 bytes and ; fills the 'gap' with NOP instructions
.ALIGN 12 ; WRONG: not a power of two, the add d2,d2,d4 ; assembler aligns this instruction at ; 16 bytes and issues a warning
-
[label:] .ASCII string[,string]...
[label:] .ASCIIZ string[,string]...
With the .ASCII or .ASCIIZ directive the assembler allocates and initializes memory each string.
The .ASCII
directive does not add a NULL byte to the end of the
string.
The .ASCIIZ
directive does add a NULL byte to the end of the string. Use commas to separate multiple strings.
STRING: .ASCII "Hello world"
STRING: .ASCIIZ "Hello world"
With the .BYTE directive you can obain exactly the same effect:
STRING: .BYTE "Hello world" ; without a NULL byte STRING: .BYTE "Hello world",0 ; with a NULL byte
,BYTE (Define a constant byte)
.WORD / .HALF (Define a word / halfword)
[label] .BYTE argument[ ,argument]...
With the .BYTE directive (Define Constant Byte) the assembler allocates and initializes a byte of memory for each argument.
An argument can be:
Multiple arguments are stored in successive byte locations. If an argument is NULL its corresponding byte location is filled with zeros.
If you specify label, it gets the value of the location counter at the start of the directive processing.
Integer arguments are stored as is, but must be byte values (within the range 0-255); floating-point numbers are not allowed. If the evaluated expression is out of the range [-256, +255] the assembler issues an error. For negative values within that range, the assembler adds 256 to the specified value (for example, -254 is stored as 2).
In case of single and multiple character strings, each character is stored in consecutive bytes whose lower seven bits represent the ASCII value of the character. The standard C escape sequences are allowed:
.BYTE 'R' ; = 0x52 .BYTE 'AB',,'D' ; = 0x41420043
TABLE .BYTE 'two',0,'strings',0 CHARS .BYTE 'A','B','C','D'
.ASCII / .ASCIIZ (Define ASCII string without ending NULL)
.WORD / .HALF (Define a word / halfword)
Create a flow graph reference between caller and callee. The linker needs this information to build a call graph. Caller and Callee are names of functions.
When you compile with the option -g (include debugging information), the compiler inserts these directives to pass call tree information. Normally it is not necessary to use the .CALLS directive in hand coded assembly.
A label is not allowed with this directive.
To indicate that the function main calls the function nfunc:
.CALLS 'main', 'nfunc'
-
With the COMMENT directive (Start Comment Lines) you can define one or more lines as comments. The first non-blank character after the .COMMENT directive is the comment delimiter. The two delimiters are used to define the comment text. The line containing the second comment delimiter will be considered the last line of the comment. The comment text can include any printable characters and the comment text will be produced in the source listing as it appears in the source file.
A label is not allowed with this directive.
.COMMENT + This is a one line comment + .COMMENT * This is a multiple line comment. Any number of lines can be placed between the two delimiters. *
-
With the .DEFINE directive you define a substitution string that you can use on all following source lines. The assembler searches all succeeding lines for an occurrence of symbol, and replaces it with string.
This directive is useful for providing better documentation in the source program. Symbol must adhere to the restrictions for labels. That is, a symbol can consist of letters, digits and underscore characters (_), and the first character cannot be a digit.
The assembler issues a warning if you redefine an existing symbol.
Macros represent a special case. .DEFINE directive translations are applied to the macro definition as it is encountered. When the macro is expanded any active .DEFINE directive translations will again be applied.
A label is not allowed with this directive.
If the following .DEFINE directive occurred in the first part of the source program:
.DEFINE SIZE '32'
then the source line below:
.SPACE SIZE
would be transformed by the assembler to the following:
.SPACE 32
.UNDEF (Undefine .DEFINE symbol)
.SET (Set temporary value to a symbol)
[label] .DUP expression
.
.
.ENDM
The sequence of source lines between the .DUP and .ENDM directives will be duplicated by the number specified by the integer expression. If the expression evaluates to a number less than or equal to 0, the sequence of lines will not be included in the assembler output. The expression result must be an absolute integer and cannot contain any forward references to address labels (labels that have not already been defined). You can nest the .DUP directive to any level.
If you specify label, it gets the value of the location counter at the start of the DUP directive processing.
Consider the following source input statements,
COUNT .SET 3 .DUP COUNT ; NOP BY COUNT NOP .ENDM
This is expanded as follows:
COUNT .SET 3 NOP NOP NOP
.DUPA (Duplicate Sequence with Arguments),
.DUPC (Duplicate Sequence with Characters),
.DUPF (Duplicate Sequence in Loop),
.MACRO (Define Macro)
[label] .DUPA dummy
,argument[,argument]...
.
.
.ENDM
With the .DUPA and .ENDM directives (Duplicate Sequence with Arguments) you can repeat a block of source statements for each argument. For each repetition, every occurrence of the dummy parameter within the block is replaced with each succeeding argument string. If an argument includes an embedded blank or other assembler-significant character, it must be enclosed with single quotes.
If you specify label, it gets the value of the location counter at the start of the DUPA directive processing.
Consider the following source input statements,
.DUPA VALUE,12,,32,34 .BYTE VALUE .ENDM
This is expanded as follows:
.BYTE 12 .BYTE VALUE .BYTE 32 .BYTE 34
.DUP (Duplicate Sequence of Source Lines),
.DUPC (Duplicate Sequence with Characters),
.DUPF (Duplicate Sequence in Loop),
.MACRO (Define Macro)
[label] .DUPC dummy
,string
.
.
.ENDM
With the .DUPC and .ENDM directives (Duplicate Sequence with Characters) you can repeat a block of source statements for each character of string. For each repetition, every occurrence of the dummy parameter within the block is replaced with each succeeding character in the string. If the string is empty, then the block is skipped.
If you specify label, it gets the value of the location counter at the start of the DUPC directive processing.
Consider the following source input statements,
.DUPC VALUE,'123' .BYTE VALUE .ENDM
This is expanded as follows:
.BYTE 1 .BYTE 2 .BYTE 3
.DUP (Duplicate Sequence of Source Lines),
.DUPA (Duplicate Sequence with Arguments),
.DUPF (Duplicate Sequence in Loop),
.MACRO (Define Macro)
[label] .DUPF dummy
,[start],end[,
increment]
.
.
.ENDM
With the .DUPF and .ENDM directives (Duplicate Sequence in Loop) you can repeat a block of source statements (end - start) + 1 times when increment is 1. Start is the starting value for the loop index; end represents the final value. Increment is the increment for the loop index; it defaults to 1 if omitted (as does the start value). The dummy parameter holds the loop index value and may be used within the body of instructions.
If you specify label, it gets the value of the location counter at the start of the DUPF directive processing.
Consider the following source input statements,
.DUPF NUM,0,7 MOV D\NUM,#0 .ENDM
This is expanded as follows:
MOV D0,#0 MOV D1,#0 MOV D2,#0 MOV D3,#0 MOV D4,#0 MOV D5,#0 MOV D6,#0 MOV D7,#0
.DUP (Duplicate Sequence of Source Lines),
.DUPA (Duplicate Sequence with Arguments),
.DUPC (Duplicate Sequence with Characters),
.MACRO (Define Macro)
With the optional END directive you tell the assembler that the logical end of the source program is reached. If the assembler finds assembly source lines beyond the .END directive, it ignores those lines and issues a warning.
The expression is only permitted here for compatibility reasons. It is ignored during assembly.
You cannot use the END directive in a macro expansion.
A label is not allowed with this directive.
.END ;End of source program
-
symbol .EQU expression
With the .EQU directive you assign the value of expression to symbol permanently. Once defined, you cannot redefine the symbol.
The expression can be relative or absolute and forward references are allowed.
To assign the value 0x4000 permanently to the symbol A_D_PORT:
A_D_PORT .EQU 0x4000
You cannot redefine the symbol A_D_PORT after this.
.SET (Set temporary value to a symbol)
With the .EXITM directive (Exit Macro) the assembler will immediately terminate a macro expansion. It is useful when you use it with the conditional assembly directive .IF to terminate macro expansion when, for example, error conditions are detected.
A label is not allowed with this directive.
CALC .MACRO XVAL,YVAL .IF XVAL<0 .FAIL 'Macro parameter value out of range' .EXITM ;Exit macro .ENDIF . . . .ENDM
.DUP (Duplicate Sequence of Source Lines),
.DUPA (Duplicate Sequence with Arguments),
.DUPC (Duplicate Sequence with Characters),
.DUPF (Duplicate Sequence in Loop),
.MACRO (Define Macro)
With the .EXTERN directive (External Symbol Declaration) you specify that the list of symbols is referenced in the current module, but is not defined within the current module. These symbols must either have been defined outside of any module or declared as globally accessible within another module with the .GLOBAL directive.
If you do not use the .EXTERN directive to specify that a symbol is defined externally and the symbol is not defined within the current module, the assembler issues a warning and inserts the .EXTERN directive for that symbol.
A label is not allowed with this directive.
.EXTERN AA,CC,DD ;defined elsewhere
.GLOBAL (Global symbol declaration)
.LOCAL (Local symbol declaration)
With the .FAIL directive (Programmer Generated Error) you tell the assembler to output an error message during the assembling process.
The total error count will be incremented as with any other error. The .FAIL directive is for example useful in combination with conditional assembly for exceptional condition checking. The assembly process proceeds normally after the error has been printed.
Optionally, you can specify an arbitrary number of strings and expressions, in any order but separated by commas, to describe the nature of the generated error. The assembler outputs a space between each argument.
A label is not allowed with this directive.
.FAIL 'Parameter out of range'
.MESSAGE (Programmer Generated Message),
.WARNING (Programmer Generated Warning)
[label] .FLOAT argument[ ,argument]...
[label] .DOUBLE argument[,argument]...
With the .FLOAT or .DOUBLE directive the assembler allocates and initializes one word (32 bits) or a double-word (64 bits) of memory for each argument.
An argument can be:
You can represent a constant as a signed whole number with fraction or with the 'e' format as used in the C language. 12.457 and +0.27E-13 are legal floating-point constants.
If you specify label, it gets the value of the location counter at the start of the directive processing.
If the evaluated argument is too large to be represented in a single word / double-word, the assembler issues an error.
FLT: .FLOAT 12.457,+0.27E-13
DBL: .DOUBLE 12.457,+0.27E-13
[label:] .FRACT argument[,argument]...
[label:] .SFRACT argument[,argument]...
With the .FRACT or .SFRACT directive the assembler allocates and initializes one word of memory (32 bits) or a halfword (16 bits) for each argument. Use commas to separate multiple arguments.
An argument can be:
Multiple arguments are stored in successive address locations in sets of two bytes. If an argument is NULL its corresponding address location is filled with zeros.
If the evaluated argument is out of the range [-1, +1> , the assembler issues a warning and saturates the fractional value.
FRCT: .FRACT 0.1,0.2,0.3
SFRCT: .SFRACT 0.1,0.2,0.3
,ACCUM (Define 64-bit constant in 18+46 bits format)
With the .GLOBAL directive (Global Section Symbol Declaration) you declare one of more symbols as global. This means that the specified symbols are defined within the current section or module, and that those definitions should be accessible by all modules.
Only symbols that are defined with the .EQU directive can be made global.
If the symbols that appear in the operand field are not used in the module, the assembler gives a warning.
A label is not allowed with this directive.
.SDECL ".data.io",DATA .SECT ".data.io" .GLOBAL LOOPA ; LOOPA will be globally ; accessible by other modules LOOPA .HALF 0x100 ; assigns the value 0x100 to LOOPA
.EXTERN (External symbol declaration)
.LOCAL (Local symbol declaration)
With the .IF/ .ENDIF directives you can create a part of conditional assembly code. The assembler assembles only the code that it reaches.
The expression must evaluate to an absolute integer and cannot contain forward references. If expression evaluates to zero, the .IF-condition is considered FALSE. Any non-zero result of expression is considered as TRUE.
You can nest .IF directives to any level. The .ELSE, .ELIF and .ENDIF directives always refer to the nearest previous .IF directive.
A label is not allowed with this directive.
Suppose you have an assemble source file with specific code for a test version, for a demo version and for the final version. Within the assembly source you define this code conditionally as follows:
.IF TEST ... ; code for the test version .ELIF DEMO ... ; code for the demo version .ELSE ... ; code for the final version .ENDIF
Before assembling the file you can set the values of the symbols .TEST and .DEMO in the assembly source before the .IF directive is reached. For example, to assemble the demo version:
TEST .SET 0 DEMO .SET 1
You can also define the symbols on the command line with the option -D:
astc -DDEMO -DTEST=0 test.src
-
With the .INCLUDE directive you direct the assembler to include another file before the resulting file is assembled. The .INCLUDE directive works similarly to the #include statement in C.
The string specifies the filename of the secondary file. The filename must be compatible with the operating system and can include a directory specification.
The order in which the assembler searches for include files is:
1. The current directory if only a filename is given, unless the <string> syntax is used, or in the directory specified in string if you specify both a pathname and a filename.
2. The path that is specified with the assembler option -I.
3. The path that is specified in the environment variable ASTCINC when the product was installed.
4. The default directory ...\ctc\include.
A label is not allowed with this directive.
.INCLUDE 'storage\mem.asm' ; include file .INCLUDE <data.asm> ; Do not look in ; current directory
Assembler option -I (Add directory to include file search path) in section 4.2,
Assembler Options, of Chapter Tool Options.
By default, labels in a module are defined "global". With the .LOCAL directive (Local Section Symbol Declaration) you declare one of more symbols as local. This means that the specified symbols are explicitly local to the section or module in which you define them.
If the symbols that appear in the operand field are not used in the module, the assembler gives a warning.
A label is not allowed with this directive.
.SDECL ".data.io",DATA .SECT ".data.io" .LOCAL LOOPA ; LOOPA is local to this section LOOPA .HALF 0x100 ; assigns the value 0x100 to LOOPA
.EXTERN (External symbol declaration)
.GLOBAL (Global symbol declaration)
macro_name .MACRO [dumarg[,dumarg]...]
.
macro_definition_statements
.
.
.ENDM
With the .MACRO directive you define a macro. Macros provide a shorthand method for handling a repeated pattern of code or group of instructions. You can define the pattern as a macro, and then call the macro at the points in the program where the pattern would repeat. The .ENDM directive indicates the end of the macro.
The definition of a macro consists of three parts:
The dummy arguments are symbolic names that the macro processor replaces with the literal arguments when the macro is expanded (called). Each dummy argument must follow the same rules as symbol names. Dummy argument names cannot start with a percent sign (%).
Macro definitions can be nested but the nested macro will not be defined until the primary macro is expanded.
The macro definition:
CONSTD .MACRO reg,value ;header mov.u reg,#lo(value) ;body addih reg,reg,#hi(value) .ENDM ;terminator
The macro call:
.SDECL ".data",DATA .SECT ".data"
CONSTD d4,0x12345678
.END
The macro expands as follows:
mov.u d4,#lo(0x12345678) addih d4,d4,#hi(0x12345678)
.DUP (Duplicate Sequence of Source Lines),
.DUPA (Duplicate Sequence with Arguments),
.DUPC (Duplicate Sequence with Characters),
.DUPF (Duplicate Sequence in Loop)
Section 4.9, Macro Operations, in Chapter Assembly Language of the User's Guide.
With the .MESSAGE directive (Programmer Generated Message) you tell the assembler to output an information message durring assembly.
The error and warning counts will not be affected. The .MESSAGE directive is for example useful in combination with conditional assembly for informational purposes. The assembly proceeds normally after the message has been printed.
Optionally, you can specify an arbitrary number of strings and expressions, in any order but separated by commas, to describe the nature of the message. The assembler outputs a space between each argument.
A label is not allowed with this directive.
.DEFINE LONG "SHORT" .MESSAGE 'This is a LONG string' .MESSAGE "This is a LONG string"
Within single quotes, the defined symbol LONG is not expanded. Within double quotes the symbol LONG is expanded. So, the actual message is printed as:
This is a LONG string This is a SHORT string
.FAIL (Programmer Generated Error)
.WARNING (Programmer Generated Warning)
With the .NAME directive you give an identification to the generated object file. The linker and or debugger uses this identification (instead of the file name) to refer to the file.
When you use the control program cctc, this name may become a random name.
Suppose the assembler assembles the file test.src and generates test.o. To change the identification (used by the linker and debugger) from the name "test" into "strcat":
.NAME "strcat"
With the .ORG directive you can specify an absolute location (abs_loc) in memory of a section. This is the same as a .SDECL/.SECT without a section name.
This directive uses the following arguments:
abs-loc Initial value to assign to the run-time location counter. abs-loc must be an absolute expression. If abs_loc is not specified, then the value is zero.
sect_type An optional section type:
code code section
data data section
attribute An optional section attribute:
Code attibutes:
init section is copied from ROM to RAM at startup
noread section can be executed from but not read
Data attibutes:
noclear section is not cleared during startup
max data overlay with other parts with the same
name, is implicit a type of 'noclear'
rom data section remains in ROM
A label is not allowed with this directive.
; define a section on location 100 decimal .org 100
; define a relocatable nameless section .org
; define a relocatable data section .org ,data
; define a data section on 0x8000 .org 0x8000,data
.SDECL (Declare section name and attributes)
.SECT (Activate a declared section)
With the .PMACRO directive you tell the assembler to purge the specified macro from the macro table, reclaiming the macro table space.
A label is not allowed with this directive.
.PMACRO MAC1,MAC2
This statement causes the macros named MAC1 and MAC2 to be purged.
With the .SDECL directive you can define a section with a name, type and optional attributes. Before any code or data can be placed in a section, you must use the .SECT directive to activate the section.
This directive uses the following arguments:
type: A section type:
code code section
data data section
attribute: An optional section attribute:
Code attibutes:
init section is copied from ROM to RAM at startup
noread section can be executed from but not read
Data attibutes:
noclear section is not cleared during startup
max data overlay with other parts with the same
name, is implicit a type of 'noclear'
rom data section remains in ROM
Sections with attribute noclear are not zeroed at startup. This is a default attribute for data sections. You can only use this attribute with a data type section. This attribute is only useful with BSS sections, which are cleared at startup by default.
The attribute init defines that the code section contains initialization data, which is copied from ROM to RAM at program startup.
Sections with the attribute rom contain data to be placed in ROM. This ROM area is not executable.
When data sections with the same name occur in different object modules with the attribute max, the linker generates a section with a size that is the largest of the sizes in the individual object modules. The attribute max only applies to data sections.
The name of a section can have a special meaning for locating sections. The name of code sections should always start with ".text" (or ".pcptext" for PCP code). With data sections, the prefix in the name is important. The prefix determines if the section is initialized, constant or uninitialized and which addressing mode is used.
Name prefix | Type of DATA section |
.data | initialized |
.zdata | initialized, abs 18 addressing |
.sdata | initialized, a0 addressing |
.data_a8 | initialized, a8 addressing |
.data_a9 | initialized, a9 addressing |
.rodata | constant data |
.zrodata | constant data, abs 18 addressing |
.srodata | constant data, a0 addressing |
.rodata_a8 | constant data, a8 addressing |
.rodata_a9 | constant data, a9 addressing |
.bss | uninitialized |
.zbss | uninitialized, abs 18 addressing |
.sbss | uninitialized, a0 addressing |
.bss_a8 | uninitialized, a8 addressing |
.bss_a9 | uninitialized, a9 addressing |
.ldata | a1 addressing (read only constants, literal data) |
.pcpdata | pcp data |
Table 3-1: Data section name prefixes
Note that the compiler uses the following name convention:
.sdecl ".text.t.main", CODE ; declare code section .sect ".text.t.main" ; activate section
.sdecl ".data.t.var1", DATA ; declare data section .sect ".data.t.var1" ; activate section
.sdecl ".text.intvec.00a", CDOE ; declare interrupt ; vector table entry for interrupt 10 .sect ".text.intvec.00a" ; activate section
.SECT (Activate a declared section)
.ORG (Initalize a nameless section)
With the .SECT directive you activate a previously declared section with the name name. Before you can activate a section, you must define the section with the .SDECL directive. You can activate a section as many times as you need.
With the section attribute RESET you can reset counting storage allocation in data sections that have section attribute max.
.sdecl ".zdata.t.var2", DATA ; declare data section .sect ".zdata.t.var2" ; activate section
.SDECL (Declare a section with name, type and attributes)
.ORG (Initalize a nameless section)
symbol .SET expression
.SET symbol expression
With the .SET directive you assign the value of expression to symbol temporarily. If a symbol was defined with the .SET directive, you can redefine that symbol in another part of the assembly source, using the .SET.
The .SET directive is useful in establishing temporary or reusable counters within macros. Expression must be absolute and forward references are allowed.
COUNT .SET 0 ; Initialize COUNT. Later on you can ; assign other values to the symbol COUNT.
.EQU (Assign permanent value to a symbol)
With the .SIZE directive you set the size of the specified symbol to the value represented by expression.
The .SIZE directive may occur anywhere in the source file unless the specified symbol is a function. In this case, the .SIZE directive must occur after the function has been defined.
main: . ; function main . ret .SIZE main,(*-main)
[label] .SPACE expression
With the .SPACE directive (Define Storage) the assembler reserves a block of bytes in memory. The reserved block of memory is not initialized to any value.
With expression you specify the number of bytes you want to reserve, and how much the location counter will advance. The expression must be an integer greater than zero and cannot contain any forward references to address labels (labels that have not yet been defined).
If you specify label, it gets the value of the location counter at the start of the directive processing.
S_BUF .SPACE 12 ; Sample buffer
.ASCII / .ASCIIZ (Define ASCII string without ending NULL)
,BYTE (Define a constant byte)
,FLOAT / .DOUBLE (Define a 32-bit / 64-bit floating point constant)
.WORD / .HALF (Define a word / halfword)
When you compile with the option -g (include debugging information), the compiler inserts the .SYMB directives to pass high-level language symbolic debug information via the assembler (and linker) to the debugger.
Expression can be any expression. Abs_expr can be any expression resulting in an absolute value.
The .SYMB directive is not meant for hand coded assembly and is documented here for completeness only.
If you compile a C file test.c with the -g option, you might find the following .SYMB directives in your assembly listing file:
.symb TOOL, "TASKING TriCore C compiler vx.y", 1 .symb TYPE, 256, "bit", 'g', 0, 1 .symb FILE, "test.c"
-
symbol .TYPE typeid
With the .TYPE directive you set a symbol's type to the specified value in the ELF symbol table. Valid symbol types are:
FUNC The symbol is associated with a function or other executable code.
OBJECT The symbol is associated with an object such as a variable, an array, or a structure.
FILE The symbol name represents the filename of the compilation unit.
Afunc .TYPE FUNC
With the .UNDEF directive you can undefine a substitution string that was previously defined with the .DEFINE directive. The substitution string associated with symbol is released, and symbol will no longer represent a valid .DEFINE substitution.
A label is not allowed with this directive.
.UNDEF SIZE ; Undefines the SIZE substitution string ; that was previously defined with the ; .DEFINE directive
.DEFINE (Define Substitution String)
With the .WARNING directive (Programmer Generated Warning) you tell the assembler to output a warning message during the assembling process.
The total warning count will be incremented as with any other warning. The .WARNING directive is for example useful in combination with conditional assembly for exceptional condition checking. The assembly process proceeds normally after the warning has been printed.
Optionally, you can specify an arbitrary number of strings and expressions, in any order but separated by commas, to describe the nature of the generated warning. The assembler outputs a space between each argument.
A label is not allowed with this directive.
.WARNING 'parameter too large'
.FAIL (Programmer Generated Error),
.MESSAGE (Programmer Generated Message)
[label] .WORD argument[ ,argument]...
[label] .HALF argument[ ,argument]...
With the .WORD or .HALF directive the assembler allocates and initializes one word (32 bits) or a halfword (16 bits) of memory for each argument.
An argument can be:
Multiple arguments are stored in successive byte locations. If an argument is NULL its corresponding byte location is filled with zeros.
If you specify label, it gets the value of the location counter at the start of the directive processing.
In case of single and multiple character strings, each character is stored in consecutive bytes whose lower seven bits represent the ASCII value of the character. The standard C escape sequences are allowed:
.WORD 'R' ; = 0x52 .WORD 'ABCD' ; = 0x41424344
.HALF 'R' ; = 0x52 .HALF 'AB' ; = 0x4142 .HALF 'ABCD' ; = 0x4142 0x4344
If the evaluated argument is too large to be represent in a word / halfword, the assembler issues an error.
WRD: .WORD 14,1635,0x34266243,'ABCD'
HLF: .HALF 14,1635,0x2662,'AB'
With the .BYTE directive you can obain exactly the same effect:
WRD: .BYTE 14,0,0,0,1635%256,6,0,0, 0x43,0x62,0x26,0x34,'D','C','B','A'
HLF: .BYTE 14,0,1635%256,6,0x62,0x26,'B','A'
.ASCII / .ASCIIZ (Define ASCII string without ending NULL)
,BYTE (Define a constant byte)
The following tables provide an overview of all assembler controls.
Function | Description |
$LIST ON / OFF | Generation of assembly list file temporary ON/OFF |
$LIST "flags" | Exclude / include lines in assembly list file |
$PAGE | Generate formfeed in assembly list file |
$PAGE settings | Define page layout for assemly list file |
Specify alternative name for assembly list file | |
$NOPRINT | Disable list file generation |
$PRCTL | Send control string to printer |
$STITLE | Set program subtitle in header of assembly list file |
$TITLE | Set program title in headerof assembly list file |
Function | Description |
$CASE ON / OFF | Case sensitive user names ON/OFF |
DEBUG ON / OFF | Generation of symbolic debug ON/OFF |
DEBUG flags | Select debug information |
$FPU | Allow single precision floating point instructions |
$HW_ONLY | Prevent substitution of assembly instructions by smaller or faster instructions |
$IDENT LOCAL / GLOBAL | Assembler treats labels by default as local or global |
$MMU | Allow memory management instructions |
$OBJECT | Alternative name for the generated object file |
$TCdefect ON / OFF | Enable/disable assembler check for specified functional problem |
$TC2 | Allow TriCore 2 instructions |
$WARNING OFF | Suppress all or some warnings |
The assembler recognizes both upper and lower case for controls.
With the $CASE ON and $CASE OFF controls you specify whether the assembler operates in case sensitive mode or not. Default the assembler operates in case sensitive mode.
;begin of source $CASE OFF ; assembler in case insensitive mode
Assembler option -c (Switch to case insensitive mode) in section 4.2,
Assembler Options, of Chapter Tool Options.
-
With the $DEBUG ON and $DEBUG OFF controls you turn the generation of debug infomation on or off. ($DEBUG ON is similar to the assembler option -gl).
If you use $DEBUG control with flags, you can set the following flags:
Debug information that is generated by the C compiler,
is always passed to the object file.
;begin of source $DEBUG ON ; generate local symbols debug information
Assembler option -g (Select debug information) in section 4.2,
Assembler Options, of Chapter Tool Options.
-
With the $FPU control you instruct the assembler to accept and encode single precision floating point instructions in the assembly source file.
When you use this control, the define __FPU__ is set to 1. Default the define __FPU__ is set to 0 which tells the assembler not to accept single precision floating point instructions.
;begin of source $FPU ; the use of single precision FPU instructions ; in this source is allowed.
Assembler option --fpu-present (Allow the use of single precision floating point instructions)
in section 4.2, Assembler
Options, of Chapter Tool Options.
-
Normally the assembler replaces instructions by other, smaller or faster instructions. For example, the instruction jeq d0,#0,label1 is replaced by jz d0,label1.
With the $HW_ONLY control you instruct the assembler to encode all instruction as they are. The assembler does not substitute instructions with other, faster or smaller instructions.
;begin of source $HW_ONLY ; the assembler does not substitute ; instructions with other, smaller or ; faster instructions.
Assembler option -Og (Allow generic instructions) in section 4.2,
Assembler Options, of Chapter Tool Options.
-
With the controls $IDENT LOCAL and $IDENT GLOBAL you tell the assembler how to treat symbols that you have not specified explicitly as local or global with the assembler directives .LOCAL or .GLOBAL.
Default the assembler treats all symbols as local symbols unless you have defined them explicitly as global.
;begin of source $IDENT GLOBAL ; assembly labels are global by default
Assembler option -i (Treat labels by default local / global) in section 4.2,
Assembler Options, of Chapter Tool Options.
Assembler directive .LOCAL (Local symbol declaration)
Assembler directive .GLOBAL (Global symbol declaration)
If you generate a list file with the assembler option - l, you can use the $LIST ON and $LIST OFF controls to specify which source lines the assembler must write to the list file. Without the command line option -l, the $LIST ON and $LIST OFF controls have no effect.
The $LIST ON control actually increments a counter that is checked for a positive value and is symmetrical with respect to the $LIST OFF control. Note the following sequence:
; Counter value currently 1 $LIST ON ; Counter value = 2 $LIST ON ; Counter value = 3 $NOLIST OFF ; Counter value = 2 $NOLIST OFF ; Counter value = 1
The listing still would not be disabled until another NOLIST control was issued.
A label is not allowed with this control.
Suppose you assemble the following assembly source with the assembler option -l:
.SDECL ".text",CODE .SECT ".text" ... ; source line in list file $LIST ON ... ; source line not in list file $LIST ... ; source line also in list file .END
The assembler generates a list file with the following lines:
.SDECL ".text",CODE .SECT ".text" ... ; source line in list file $LIST ON ... ; source line also in list file .END
Assembler option -l (Generate list file) in section 4.2,
Assembler Options, of Chapter Tool Options.
Assembler control $LIST (Exclude / include lines in assembly list file)
Assembler function @LST() in section 3.2, Built-in Asembly Functions.
If you generate a list file with the assembler option - l, you can use the $LIST controls to specify which type of source lines the assembler must exclude from the list file. Without the command line option -l, the $LIST control has no effect.
You can set the following flags to remove or include lines:
If you do not specify this control or the assembler option -Lflag, the assembler uses the default: -LcDEGilMnPqsVWXy.
To exclude assembly files with controls from the list file:
;begin of source $LIST "c"
Assembler option -L (List file formatting options) in section 4.2,
Assembler Options, of Chapter Tool Options.
Assembler control $LIST ON / OFF (Assembly list file ON / OFF)
Assembler function @LST() in section 3.2, Built-in Asembly Functions.
With the $MMU control you instruct the assembler to accept and encode memory management instructions in the assembly source file.
When you use this control, the define __MMU__ is set to 1.
;begin of source $MMU ; the use of memory management instructions ; in this source is allowed.
Assembler option --mmu-present (Allow the use of memory management instructions) in section 4.2, Assembler
Options, of Chapter Tool Options.
-
With the $OBJECT control you can specify an alternative name for the generated object file. With the $OBJECT OFF control, the assembler does not generate an object file at all.
;Begin of source $object "x1.o" ; generate object file x1.o
Assembler option -o (Define output filename) in section 4.2,
Assembler Options, of Chapter Tool Options.
-
If you generate a list file with the assembler option - l, you can use the $PAGE control to format the generated list file.
width Number of characters on a line (1-255). Default is 132.
length Number of lines per page (10-255). Default is 66. As a special case a page length of 0 (zero) turns off all headers, titles, subtitles, and page breaks.
blanktop Number of blank lines at the top of the
page. Default = 0.
Specify a value so that blanktop + blankbtm
<= length - 10.
blankbtm Number of blank lines at the bottom of
the page. Default = 0.
Specify a value so that blanktop + blankbtm
<= length - 10.
blankleft Number of blank columns at the left of the page. Default = 0. Specify a value smaller than width.
If you use the $PAGE control without arguments, it causes a 'formfeed': the next source line is printed on the next page in the list file. The $PAGE control itself is not printed.
You can omit an argument by using two adjacent commas. If the remaining arguments after an argument are all empty, you can omit them.
$PAGE ; formfeed, the next source line is printed ; on the next page in the list file.
$PAGE 96 ; set page width to 96. Note that you can ; omit the last four arguments.
$PAGE ,,3,3; use 3 line top/bottom margins.
-
Assembler control $STITLE (Set program subtitle in header of list file)
Assembler control $TITLE (Set program title in header of list file)
Assembler option -l (Generate list file) in Section 4.2, Assembler Options, of Chapter Tool Options.
Assembler option -L (List file formatting options) in Section 4.2, Assembler Options, of Chapter Tool Options.
If you generate a list file with the assembler option - l, you can use the $PRCTL control to send control strings to the printer.
The $PRCTL control simply concatenates its arguments and sends them to the listing file (the control line itself is not printed unless there is an error).
You can specify the following arguments:
exp a byte expression which may be used to encode non-printing control characters, such as ESC.
string an assembler string. which may be of arbitrary length, up to the maximum assembler-defined limits.
The $PRCTL control can appear anywhere in the source file; the assembler sends out the control string at the corresponding place in the listing file.
If a $PRCTL control is the last line in the last input file to be processed, the assembler insures that all error summaries, symbol tables, and cross-references have been printed before sending out the control string. In this manner, you can use a PRCTL control to restore a printer to a previous mode after printing is done.
Similarly, if the $PRCTL control appears as the first line in the first input file, the assembler sends out the control string before page headings or titles.
$PRCTL $1B,'E' ; Reset HP LaserJet printer
-
Assembler option -l (Generate list file) in Section 4.2,
Assembler Options, of Chapter Tool Options.
If you generate a list file with the assembler option - l, you can use the $PRINT control to specify an alternative name for the assembly list file.
With the $NOPRINT control, you overrule the assembler option -l and no list file is generated at all.
$PRINT(mylist.lst) ; generate an assembler list file with the name 'mylist.lst'.
-
Assembler option -l (Generate list file) in Section 4.2,
Assembler Options, of Chapter Tool Options.
If you generate a list file with the assembler option - l, you can use the $STITLE control to specify the program subtitle which is printed at the top of all succeeding pages in the assembler list file below the title.
The specified subtitle is valid until the assembler encouters a new STITLE control. Default, the subtitle is empty.
The $STITLE control itself will not be printed in the source listing.
If the page width is too small for the title to fit in the header, it will be truncated.
$TITLE 'This is the title' $STITLE 'This is the subtitle'
The header of the second page in the list file will now be:
TASKING TriCore Assembler vx.yrz Build nnn SN 00000000 This is the title Page 2 This is the subtitle
-
Assembler control $TITLE (Set program title in header of list file)
Assembler option -l (Generate list file) in Section 4.2, Assembler Options, of Chapter Tool Options.
With this control you can enable or disable specific CPU functional problem checks.
To enable the assembler checks for all TriCore CPU TC112 problems (respectively TC113 problems) at once, use the control $TC112_DEFECTS (respectively $TC113_DEFECTS).
$TC112_COR1 ON ; enable assembler check for CPU functional problem TC112_COR1
Assembler option --silicon-bug (Check on CPU functional defect) in section 4.2,
Assembler Options, of Chapter Tool Options.
See Chapter 8
, CPU Functional Problems, for more information about the individual problems.
With the $TC2 control you instruct the assembler to accept and encode TriCore 2 instructions in the assembly source file.
When you use this control, the define __TC2__ is set to 1.
;begin of source $TC2 ; the use of TriCore 2 instructions ; in this source is allowed.
Assembler option --is-tricore2 (Allow the use of TriCore 2 instructions) in section 4.2,
Assembler Options, of Chapter Tool Options.
-
If you generate a list file with the assembler option - l, you can use the $TITLE control to specify the program title which is printed at the top of each page in the assembler list file.
Default, the title is empty.
If the page width is too small for the title to fit in the header, it will be truncated.
TITLE 'This is the title'
The header of the list file will now be:
TASKING TriCore Assembler vx.yrz Build nnn SN 00000000 This is the title Page 1
-
STITLE (Set program subtitle in assembly list file)
With the $WARNING OFF control you can suppresses all warning messages or specific warning messages.
$WARNING OFF ; all warning messages are suppressed
$WARNING OFF 135 ; suppress warning message 135
Assembler option -w (Suppress some or all warnings) in section 4.2,
Assembler Options, of Chapter Tool Options.
-