This chapter contains the following sections:
Operands
Operands and Addressing Modes
Expressions
Number
Expression String
Symbol
Expression Type
Memory Spaces
Operators
Addition and Subtraction
Sign Operators
Multiplication and Division
Shift Operators
Relational Operators
Bitwise Operators
Logical Operators
Functions
Mathematical Functions
Conversion Functions
String Functions
Macro Functions
Assembler Mode Functions
Detailed Description
An operand is the part of the instruction that follows the instruction opcode. There can be one, two, three or even no operands in an instruction. An operand of an assembly instruction has one of the following types:
Operands Description
expr any valid expression as described in the section Expressions.
reg any valid register as described in the section Registers.
symbol a symbolic name as created by an equate. A symbol can be an expression.
address a combination of expr, reg and symbol.
If an expression can be completely evaluated at assembly time, it is called an absolute expression; if it is not, it is called a relocatable expression. See the section 5.2, Expressions, for more details.
The DSP56xxx assembly language has several addressing modes. These are listed below with a short description. For details see the DSP56000, DSP56300 and DSP56600 Family Manuals.
The instruction specifies the register which contains the operand.
Syntax:
mnemonic register
The instruction specifies the register containing the operand address. Several forms are available.
Syntax:
mnemonic (Rn)
mnemonic (Rn)+
mnemonic (Rn)-
mnemonic (Rn)+Nn
mnemonic (Rn)-Nn
mnemonic (Rn+Nn)
mnemonic -(Rn)
mnemonic (Rn+displ)
(not for DSP5600x
)
An immediate operand is a one word number or short number, which is encoded as part of the instruction. Immediate operands are indicated
by the # sign before the expression defining the value of the operand.
Syntax:
mnemonic #number
The instruction contains the operand address. The address
can be 16 or
24 bits (absolute address), 6 bits zero extended (absolute short) or
6 bits ones extended (I/O short).
Syntax:
mnemonic direct_address
The instruction contains the 12-bit address zero extended to 16 or
24 bits, which allows addresses $000-$FFF to be accessed.
Syntax:
mnemonic jump_address
An operand of an assembler instruction or directive is either an assembler symbol, a register name or an expression. An expression is a sequence of symbols that denotes an address in a particular memory space or a number.
Expressions that can be evaluated at assembly time are called absolute expressions. Expressions where the result is unknown until all sections have been combined and located are called relocatable expressions. When any operand of an expression is relocatable the entire expression is relocatable. Relocatable expressions are emitted in the object file and evaluated by the linker or the locator. Relocatable expressions may only contain integral functions; floating point functions and numbers are not supported by the IEEE object format. An error is emitted when during object creation non-IEEE relocatable expressions are found.
An expression has a type which depends on the type of the identifiers in the expression. See section 5.2.4, Expression Type, for details.
The assembler evaluates expressions with 64-bit precision in two's complement.
The syntax of an expression can be any of the following:
- number
- expression_string
- symbol
- expression binary_operator expression
- unary_operator expression
- ( expression )
- function
Spaces are not allowed inside expressions! Example: 3 + 4 is not valid, but 3+4 is.
All types of expressions are explained below and in the following sections.
( ) You can use parentheses to control the evaluation order of the operators. What is between parentheses is evaluated first.
(3+4)*5 ; Result is 35. ; 3 + 4 is evaluated first. 3+(4*5) ; Result is 23. ; 4 * 5 is evaluated first. ; parentheses are superfluous here
Numeric constants can be used in expressions. If there is no prefix, the assembler assumes the number is decimal.
number can be one of the following:
- %bin_num
- dec_num (or `dec_num)
- $hex_num
- float_num
bin_num is a binary number formed of '0'-'1' prefixed with a '%'.
dec_num is a decimal number formed of '0'-'9', optionally prefixed with a '`'.
hex_num is a hexadecimal number formed of the characters '0'-'9' and 'a'-'f' or 'A'-'F' prefixed with a '$'.
float_num is a floating point number formed of '0'-'9' and indicated either by a preceding, following, or included decimal point or by the presence of 'E' or 'e'. Floating point numbers are always base 10.
A number may be written without a leading radix indicator if the input radix is changed using the RADIX directive. For example, a hexadecimal number may be written without the leading dollar sign ($) if the input radix is set to 16 (assuming an initial radix of 10). The default radix is 10.
An expression_string is a string with an arbitrary length evaluating to a number. The value of the string is calculated by taking the first 4 characters padded with 0 to the left.
string is a string of ASCII characters,
enclosed in single (') or double (") quotes. The starting and closing quote must
be the same. To include the enclosing quote in the string, double it. E.g. the string containing both quotes can be denoted as: " ' "" " or ' ' ' " '.
See the chapter Macro Operations for the differences between single and double quoted strings.
'A'+1 ; a 1-character ASCII string, ; result $00000042 "9C"+1 ; a 2-character ASCII string, ; result $00003944
Two strings can be concatenated with the strings concatenation operator (++). The two strings must each be enclosed by single or double quotes, and there must be no intervening blanks between the operator and the two strings:
'AB'++'CD' ; two 2-character ASCII strings ; concatenated (same as 'ABCD'), ; result $41424344
Square brackets ([ ]) delimit a substring operation in the form:
offset is the start position within string. length is the length of the desired substring. Both values may not exceed the size of string.
DEFINE ID ['DSP56000',3,5] ; ID = '56000'
A symbol is an identifier. A symbol represents the value of an identifier which is already defined, or will be defined in the current source module by means of a label declaration or an equate directive.
CON1 EQU $3 ; The variable CON1 represents ; the value of 3 MOVE CON1+$20,R1 ; Move contents of address ; $23 to register R1
When you invoke one of the assemblers, the following predefined symbol exists:
_AS56 contains a string with the name of the assembler ("as56" or "as563")
The type of an expression is either a number (floating point or integral) or an address. The result type of an expression depends on the operator and its operands. The tables below summarize all available operators.
Please note:
1. when an illegal combination (denoted as *) is found, a warning is emitted and the expression type will be undefined;
2. a label is of type 'address'; an equate symbol has the type of the equate expression;
3. the type of an untyped symbol can be an address or a number, depending on the context; the result of the operation can be determined using the tables;
4. the binary logical and relational operators (||, &&, ==, !=, <, <=, >, >=) accept any combination of operands, the result is always the integral number 0 or 1;
5. the binary shift and bitwise operators <<, >>, |, & and ^ only accept integral operands.
The following table shows the result type of expressions with unary operators.
Operator | num | addr |
~ | num | * |
! | num | * |
- | num | * |
+ | num | num |
Table 5-1: Expression type, unary operators
The following table shows the result type of expressions with binary numerical operators.
Operator | num, num | addr, num | num, addr | addr,addr |
- | num | addr | * | num |
+ | num | addr | addr | * |
* | num | * | * | * |
/ | num | * | * | * |
% | num | * | * | * |
Table 5-2: Expression type, binary numerical operators
"num <op> float" and "float <op> num" evaluates to
float
any combination of an address with a float is illegal
a string operand will be converted to an integral number
"addr - addr" is only valid when both addresses are in
the same address space, or in compatible address spaces (see Table
5-4)
The following table shows the result type of functions. num can be float and integer. A '-' in the column Operands means that the function has no operands.
Function | Operands | Result |
@ABS() | num | float |
@ACS() | num | float |
@ARG() |
symbol integer |
integer integer |
@AS56() | - | string |
@ASN() | num | float |
@AT2() | num,num | float |
@ATN() | num | float |
@CEL() | num | float |
@CNT() | - | float |
@COH() | num | float |
@COS() | num | float |
@CVF() | num | float |
@CVI() | num | integer |
@CVS() | mem,expr | mem:expr |
@DEF() | symbol | integer |
@DEFMEM() | - | string |
@DSP() | - | integer |
@FLD() |
num,num,num num,num,num,num |
integer integer |
@FLR() | num | float |
@FRC() | num | integer |
@L10() | num | float |
@LEN() | string | integer |
@LFR() | num | integer |
@LNG() | num,num | integer |
@LOG() | num | float |
@LST() | - | integer |
@LUN() | num | float |
@MAC() | symbol | integer |
@MAX() |
num,num,...,float,... integer,integer,... |
float integer |
@MIN() |
num,num,...,float,... integer,integer,... |
float integer |
@MODEL() | - | string |
@MSP() | num | integer |
@MXP() | - | integer |
@POS() |
string,string string,string,num |
integer integer |
@POW() | num,num | float |
@RND() | - | float |
@RVB() |
num num,num |
integer integer |
@SCP() | string,string | integer |
@SGN() | num | integer |
@SIN() | num | float |
@SNH() | num | float |
@SQT() | num | float |
@STKMEM() | - | string |
@TAN() | num | float |
@TNH() | num | float |
@UNF() | num | float |
@XPN() | num | float |
Table 5-3: Expression type, functions
All addresses have a memory space attribute of either X, Y, L, Program, EMI, or Unknown, to distinguish between different address spaces. A number always has the memory attribute None. When subtracting an address from another address the address spaces are combined to form the resulting type. See the table below for legal combinations and their resulting address space. The type N stands for a number. The function @CVS() can be used to change the address space of an address or to make an address of any number. The @MSP() function can be used to extract the address space from any expression. An external symbol which is declared without a memory space can be used as an address in any memory space.
Left Operand Memory Space Attribute N X Y L P E Right Operand N N X Y L P E Memory Space X * N * N * * Attribute Y * * N N * * L * N N N * * P * * * * N * E * * * * * N
* = Represents an illegal operation that will result in an error.
Table 5-4: Compatible memory types for binary '-' operator
Memory space attributes become important when an expression is used as an address. Errors will occur when the memory space attribute of the expression result does not match the explicit or implicit memory space specified in the source code. Memory spaces are explicit when the address has any of the following forms:
Attribute | Explicit Address | ||||||||
X |
X:address_expression
Y |
Y:address_expression
|
L |
L:address_expression
|
P |
P:address_expression
|
E |
E:address_expression
| |
Table 5-5: Memory space attributes
The memory space is implicitly P when an address is used as the operand of a DO, branch, or jump-type instruction.
Expressions used for immediate addressing can have any memory space attribute.
/usr/src/dsp56/op_types.asm M:LOC CODE CYCLES LINE SOURCELINE P:0200 1 org p:$200 2 plab: X:0100 3 org x:$100 4 xlab: 5 xlab2: X:0100 000100 6 dc plab-xlab as56 W123: /usr/src/dsp56/op_types.asm line 6 : expression: illegal combination of memory spaces X:0101 000200 7 dc xlab+xlab2 as56 W123: /usr/src/dsp56/op_types.asm line 7 : expression: arithmetic on an address with an address 8 X:0102 000200 9 dc xlab*2 as56 W123: /usr/src/dsp56/op_types.asm line 9 : expression: undefined arithmetic on an address X:0103 000200 10 dc @cvs(n,xlab)*2 ; use @CVS() so we can multiply 11 end
There are two types of operators:
- unary operators
- binary operators
Operators can be arithmetic operators, shift operators, relational operators, bitwise operators, or logical operators. All operators are described in the following sections.
If the grouping of the operators is not specified with parentheses, the operator precedence is used to determine evaluation order. Every operator has a precedence level associated with it. The following table lists the operators and their order of precedence (in descending order).
Operators | Type |
+, -, ~, ! | unary |
*, /, % | binary |
+, - | binary |
<<, >> | binary |
<, <=, >, >= | unary |
==, != | binary |
&, |, ^ | binary |
&&, || | binary |
Table 5-6: Operators Precedence List
Except for the unary operators, the assembler evaluates expressions with operators of the same precedence level left-to-right. The unary operators are evaluated right-to-left . So, -4+3*2 evaluates to (-4)+(3*2).
Addition: operand + operand
Subtraction: operand - operand
The + operator adds its two operands and the - operator subtracts them. The operands can be any expression evaluating to an absolute number or a relocatable operand, with the restrictions of Table 5-2 .
$a342+$23 ; addition of absolute numbers $ff1a-AVAR ; subtraction with the value of ; symbol AVAR
Plus: +operand
Minus: -operand
The + operator does not modify its operand. The - operator subtracts its operand from zero. See also the restrictions in Table 5-1 .
5+-3 ; result is 2
Multiplication: operand * operand
Division: operand / operand
Modulo: operand % operand
The * operator multiplies its two operands, the / operator performs an integer division, discarding any remainder. The % operator also performs an integer division, but discards the quotient and returns the remainder. The operands can be any expression evaluating to an absolute number or a relocatable operand, with the restrictions of Table 5-2 . Note that the right operands of the / and % operator may not be zero.
AVAR*2 ; multiplication $ff3c/COUNT ; division 23%4 ; modulo, result is 3
Shift left: operand << count
Shift right: operand >> count
These operators shift their left operand (operand) either left (<<) or right (>>) by the number of bits (absolute number) specified with the right operand (count). The operands can be any expression evaluating to an (integer) number.
AVAR>>4 ; shift right variable AVAR, 4 times
Equal: operand == operand
Not equal: operand != operand
Less than: operand < operand
Less than or equal: operand <=
operand
Greater than: operand > operand
Greater than or equal: operand
>= operand
These operators compare their operands and return an absolute number (an integer) of 1 for `true' and 0 for `false'. The operands can be any expression evaluating to an absolute number or a relocatable operand.
3>=4 ; result is 0 (false) 4==COUNT ; 1 (true), if COUNT is 4. ; 0 otherwise. 9<$0A ; result is 1 (true)
Bitwise AND: operand & operand
Bitwise OR: operand | operand
Bitwise XOR: operand ^ operand
One's complement ~ operand
The AND, OR and XOR operators take the bitwise AND, OR respectively XOR of the left and right operand. The one's complement (bitwise NOT) operator performs a bitwise complement on its operand. The operands can be any expression evaluating to an (integer) number.
$B&3 ; result is 3 %1011 %0011 & %0011
~$A ; result is $fffff5 ~ %000000000000000000001010 = %111111111111111111110101
Logical AND: operand && operand
Logical OR: operand || operand
Logical NOT: ! operand
The logical AND operator returns an integer 1 if both operands are non-zero; otherwise it returns an integer 0. The logical OR operator returns an integer 1 if either of its operands is non-zero; otherwise it returns an integer 0. The ! operator performs a logical not on its operand. ! returns an integer 1 (`true) if the operand is 0; otherwise, ! returns 0 (`false'). The operands can be can be any expression evaluating to an integer or floating point.
$B&&3 ; result is 1 (true) !$A ; result is 0 (false) !(4<3) ; result is 1 (true) ; 4 < 3 result is 0 (false)
The assembler has several built-in functions to support data conversion, string comparison, and math computations. Functions can be used as terms in any arbitrary expression. Functions have the following syntax:
Functions start with the '@' sign and have zero or more arguments, and are always followed by opening and closing parentheses. There must be no intervening spaces between the function name and the opening parenthesis and between the (comma-separated) arguments.
Assembler functions can be grouped into five types:
1. Mathematical functions
2. Conversion functions
3. String functions
4. Macro functions
5. Assembler mode functions
The mathematical functions comprise transcendental, random value, and min/max functions, among others:
ABS - Absolute value
ACS - Arc cosine
ASN - Arc sine
AT2 - Arc tangent
ATN - Arc tangent
CEL - Ceiling function
COH - Hyperbolic cosine
COS - Cosine
FLR - Floor function
L10 - Log base 10
LOG - Natural logarithm
MAX - Maximum value
MIN - Minimum value
POW - Raise to a power
RND - Random value
SGN - Return sign
SIN - Sine
SNH - Hyperbolic sine
SQT - Square root
TAN - Tangent
TNH - Hyperbolic tangent
XPN - Exponential function
The conversion functions provide conversion between integer, floating point, and fixed point fractional values:
CVF - Convert integer to floating point
CVI - Convert floating point to integer
CVS - Convert memory space
FLD - Shift and mask operation
FRC - Convert floating point to fractional
LFR - Convert floating point to long fractional
LNG - Concatenate to double word
LUN - Convert long fractional to floating point
RVB - Reverse bits in field
UNF - Convert fractional to floating point
String functions compare strings, return the length of a string, and return the position of a substring within a string:
LEN - Length of string
POS - Position of substring in string
SCP - Compare strings
Macro functions return information about macros:
ARG - Macro argument function
CNT - Macro argument count
MAC - Macro definition function
MXP - Macro expansion function
Miscellaneous functions having to do with assembler operation:
AS56 - Assembler executable name
DEF - Symbol definition function
DEFMEM - Default memory function
DSP - DSP processor type number
LST - LIST directive flag value
MODEL - Returns memory model
MSP - Memory space
STKMEM - Stack memory function
Individual descriptions of each of the assembler functions follow. They include usage guidelines, functional descriptions, and examples.
Returns the absolute value of expression as a floating point value. The memory space attribute of the result will be None.
Example:
MOVE #@ABS(VAL),A ;load absolute value
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. The memory space attribute of the result will be None.
Example:
ACOS = @ACS(-1.0) ;ACOS = 3.141593
Returns 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. A warning will be issued if this function is used when no macro expansion is active. The memory space attribute of the result will be None.
Example:
IF @ARG(TWIDDLE) ;twiddle factor provided?
Returns the name of the assembler executable. This is as56 for the DSP5600x or as563 for the DSP563xx family.
Example:
ANAME DC @AS56() ;ANAME = as563 for DSP563xx
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. The memory space attribute of the result will be None.
Example:
ARCSINE SET @ASN(-1.0) ;ARCSINE = -1.570796
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. The memory space attribute of the result will be None.
Example:
ATAN EQU @AT2(-1.0,1.0) ;ATAN = -0.7853982
Returns the arc tangent of expression as a floating point value in the range -pi/2 to pi/2. The memory space attribute of the result will be None.
Example:
MOVE #@FRC(@ATN(1.0)),A ;load arc tangent
Returns a floating point value which represents the smallest integer greater than or equal to expression. The memory space attribute of the result will be None.
Example:
CEIL SET @CEL(-1.05) ;CEIL = -1.0
Returns the count of the current macro expansion arguments as an integer. A warning will be issued if this function is used when no macro expansion is active. The memory space attribute of the result will be None.
Example:
ARGCNT SET @CNT() ;squirrel away arg count
Returns the hyperbolic cosine of expression as a floating point value. The memory space attribute of the result will be None.
Example:
HYCOS EQU @COH(VAL) ;compute hyperbolic cosine
Returns the cosine of expression as a floating point value. The memory space attribute of the result will be None.
Example:
DC -@COS(@CVF(COUNT)*FREQ) ;compute cosine value
Converts the result of expression to a floating point value. The memory space attribute of the result will be None.
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). The memory space attribute of the result will be None.
Example:
INT SET @CVI(-1.05) ;INT = -1
Converts the memory space attribute of expression to that specified by the first argument; returns expression. See section Memory Spaces for more information on memory space attributes. The expression may be relative or absolute.
Example:
LOADDR EQU @CVS(X,TARGET) ;set LOADDR to X:TARGET
Returns an integer 1 (memory space attribute N) if symbol has been defined, 0 otherwise. symbol may be any label not associated with a MACRO or SECTION 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) ;assemble if ANGLE defined
You can use the @DEFMEM() function just as the _DEFMEM function in the compiler to retrieve the selected default memory.
Example:
IF @DEFMEM()=='x' msg 'default memory x' ENDIF IF @DEFMEM()=='y' msg 'default memory y' ENDIF IF @DEFMEM()=='p' msg 'default memory p' ENDIF IF @DEFMEM()=='l' msg 'default memory l' ENDIF
Returns an integer indicating the type of DSP56xxx processor family. This value is 0 for the DSP5600x, 3 for the DSP563xx family or 6 for the DSP566xx family.
Example:
DTYPE SET @DSP() ;DTYPE = 3 for DSP563xx
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 with a memory space attribute of None.
Example:
SWITCH EQU @FLD(TOG,1,1,7) ;turn eighth bit on
Returns a floating point value which represents the largest integer less than or equal to expression. The memory space attribute of the result will be None.
Example:
FLOOR SET @FLR(2.5) ;FLOOR = 2.0
This function performs scaling and convergent rounding to obtain the fractional representation of the floating point expression as an integer. The memory space attribute of the result will be None.
Example:
FRAC EQU @FRC(FLT)+1 ;compute saturation
Returns the base 10 logarithm of expression as a floating point value. expression must be greater than zero. The memory space attribute of the result will be None.
Example:
LOG EQU @L10(100.0) ;LOG = 2
Returns the length of string as an integer. The memory space attribute of the result will be None.
Example:
SLEN SET @LEN('string') ;SLEN = 6
This function performs scaling and convergent rounding to obtain the fractional representation of the floating point expression as a long integer. The memory space attribute of the result will be None.
Example:
LFRAC EQU @LFR(LFLT) ;store binary form
Concatenates the single word expr1 and expr2 into a double word value such that expr1 is the high word and expr2 is the low word. The memory space attribute of the result will be None.
Example:
LWORD DC @LNG(HI,LO) ;build long word
Returns the natural logarithm of expression as a floating point value. expression must be greater than zero. The memory space attribute of the result will be None.
Example:
LOG EQU @LOG(100.0) ;LOG = 4.605170
Returns the value of the LIST directive flag as an integer, with a memory space attribute of None. Whenever a LIST directive is encountered in the assembler source, the flag is incremented; when a NOLIST directive is encountered, the flag is decremented.
Example:
DUP @CVI(@ABS(@LST())) ;list unconditionally
Converts the double-word expression to a floating point value. expression should represent a binary fraction. The memory space attribute of the result will be None.
Example:
DBLFRC EQU @LUN($3FE0000000000000) ;DBLFRC = 0.5
Returns an integer 1 (memory space attribute N if symbol has been defined as a macro name, 0 otherwise.
Example:
IF @MAC(DOMUL) ;expand macro
Returns the greatest of expr1,...,exprN as a floating point value. The memory space attribute of the result will be None.
Example:
MAX DC @MAX(1.0,5.5,-3.25) ;MAX = 5.5
Returns the least of expr1,...,exprN as a floating point value. The memory space attribute of the result will be None.
Example:
MIN DC @MIN(1.0,5.5,-3.25) ;Min = -3.25
The @MODEL() function returns the memory model just as the_MODEL function in the compiler. The possible values are derived from the -M option.
Example:
IF @MODEL()==24 msg '24-bit model' ENDIF
IF @MODEL()==16 msg '16-bit model' ENDIF
IF @MODEL()==1624 msg '16/24-bit model' ENDIF
IF @MODEL()==6 msg 'DSP566xx model' ENDIF
Returns the memory space attribute of expression as an integer value.
None = 0
X space = 1
Y space = 2
L space = 3
P space = 4
E space = 5
The expression may be relative or absolute.
Example:
MEM SET @MSP(ORIGIN) ;save memory space
Returns an integer 1 (memory space attribute N) if the assembler is expanding a macro, 0 otherwise.
Example:
IF @MXP() ;macro expansion active?
Returns the position 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. The memory space attribute of the result will be None.
Example:
ID EQU @POS('DSP56000','56') ;ID = 3
Returns expr1 raised to the power expr2 as a floating point value. expr1 and expr2 must be separated by a comma. The memory space attribute of the result will be None.
Example:
BUF EQU @CVI(@POW(2.0,3.0)) ;BUF = 8
Returns a random value in the range 0.0 to 1.0. The memory space attribute of the result will be None.
Example:
SEED DC @RND() ;save initial SEED value
Reverse the 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 single word integer values.
Example:
REV EQU @RVB(VAL) ;reverse all bits in value
Returns an integer 1 (memory space attribute N) 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?
Returns the sign of expression as an integer: -1 if the argument is negative, 0 if zero, 1 if positive. The memory space attribute of the result will be None. The expression may be relative or absolute.
Example:
IF @SGN(INPUT) ;is sign positive?
Returns the sine of expression as a floating point value. The memory space attribute of the result will be None.
Example:
DC @SIN(@CVF(COUNT)*FREQ) ;compute sine value
Returns the hyperbolic sine of expression as a floating point value. The memory space attribute of the result will be None.
Example:
HSINE EQU @SNH(VAL) ;hyperbolic sine
Returns the square root of expression as a floating point value. expression must be positive. The memory space attribute of the result will be None.
Example:
SQRT EQU @SQT(3.5) ;SQRT = 1.870829
You can use the @STKMEM() function just as the _STKMEM function in the compiler to retrieve the selected stack memory. @STKMEM only differs from @DEFMEM if the stack is placed in L memory for X or Y default memory.
Example:
IF @STKMEM()=='x' msg 'stack memory x' ENDIF IF @STKMEM()=='y' msg 'stack memory y' ENDIF IF @STKMEM()=='p' msg 'stack memory p' ENDIF IF @STKMEM()=='l' msg 'stack memory l' ENDIF
Returns the tangent of expression as a floating point value. The memory space attribute of the result will be None.
Example:
MOVE #@TAN(1.0),A ;load tangent
Returns the hyperbolic tangent of expression as a floating point value. The memory space attribute of the result will be None.
Example:
HTAN = @TNH(VAL) ;hyperbolic tangent
Converts expression to a floating point value. expression should represent a binary fraction. The memory space attribute of the result will be None.
Example:
FRC EQU @UNF($400000) ;FRC = 0.5
Returns the exponential function (base e raised to the power of expression) as a floating point value. The memory space attribute of the result will be None.
Example:
EXP EQU @XPN(1.0) ;EXP = 2.718282