BTRON MicroScript Reference Manual

Symbols and Operators


_____
'
Syntax
Function
_____By surrounding a character with ' ' ' (single quotes, apostrophes), we can obtain the character code for that character. For example, the character code for a space is 0x2121, but instead of writing 0x2121, we can make it as ' '. This is called a character constant.
_____A character is only one character, and things such as variables cannot be embedded. In a case where you would like to use a character string, please refer to ' " ' (p. 3).
_____By using this in parallel with ' \ ', we can also express special characters, such as control characters. Concerning expressions with ' \ ', please refer to ' \ ' (p. 4). In a case where we have made it '', it becomes 0.
Errors that Occur at Startup Time
There is no ' at the end of the character constant
Please confirm whether ' forms a pair. Also, in handling two or more characters, please use a character string (refer to ").
2

I Reference Section

g@h J "
Syntax
Function
_____By surrounding characters with ' " ' (double quotes), we can express a character string. As for character strings, outside of being able to use them in place of array variables in which characters have been loaded in order, we substitute them in array variables by using the SET statement. It is not possible to embed variables and the like in the middle of a character string.
_____Through the parallel use of ' \ ', we can also express special characters, such as control characters. Concerning expressions based on ' \ ', please refer to ' \ ' (p. 4). By using g@h, we can express an empty character string.
Errors that Occur at Startup Time
There is no h at the end of the character string
Please confirm if you have not forgotten to insert h, or if h hasn't been escaped through the use of \h .

3

_____
\
Syntax
Function
_____' \ ' is an escape symbol. The escape symbol possesses special meanings with ' \ ' and the next character.
_____First, in a case where we have placed ' \ ' at the end of a line, it is regarded as something where we continue on as is to the next line. For example, the following two examples perform the exact same operation.
    SET a=1+2 . . . . . .  . . . Example 1
    
    SET a=1\
    +2 . . . . . . . . . . . . . Example 2
Originally, we cannot enter a line break in the middle of an expression, but by means of using ' \ ', it becomes possible to enter a line break.
_____Next, in a case where we have used it in a character constant or inside a character string, we can express such things as control characters with ' \ ' plus the next character. For example, when we describe ' \n ' inside a character string, that means a new paragraph. The next example is one in which we display three lines of character strings in a character segment.
    TEXT Charactersegment "1stline\n2ndline\n3rdline"
It's made up so that the ' \n ' part becomes a new paragraph, and then moves onto the next line. As for control characters, there are the following ones.
    ' \n ' → new paragraph ' \t ' → tab ' \0 ' → null(0)
    ' \r ' → new line      ' \b ' → back space
Outside of control characters, it is also used as a character that shows the end of a character or characters with ' ' ' and ' " ', and it is used to express ' \ ' itself.
    ' \' ' → ' ' ' ' \" ' → ' " ' ' \\ ' → ' \ '
For example, substituting ' ' ' in variable a becomes as follows:
    SET a='\''
' \' ' has been entered inside ' ' ' ', and ' ' ' has been substituted for a as a result. Likewise, in writing ' \ ' inside a character string, we describe ' \\ '.
4, 5

_____
#
Syntax
Function
_____' # ' (sharp) shows that what follows are comments. The range from ' # ' up to the line break is not interpreted as script, and is skipped over. As for comments, outside of writing down and leaving an explanation of the program, they can be used in leaving aside as comments the contents prior to revision during the revision of a program.
_____In a case where we have attached a ' \ ' at the end of a line, the next line also will be skipped over as a comment.
_____Furthermore, because ' # ' will be handled as a simple character inside a character constant (refer to ' ' ' p. 2) or a character string (refer to ' " ' p. 3), it cannot describe comments.
6

I Reference Section

;
Syntax
Function
_____The ' ; ' (semicolon) has two functions.
_____By attaching it to the end of a line, without carrying out display updates, the next line also will be executed in succession (without another procedure being made to operate). We call this continuous execution. Display updates will take place together at the stage where the continuous execution has ended. By means of continuous execution, we can smoothly carry out the clearing and display of segments, for example, in a case where we want to realize animation by changing displays in succession. This is effective even in a case where we are rewriting multiple variables in succession. In suspending display updates, outside of ' ; ', there is also the method of using the UPDATE statement.
_____Also, without entering a line change after ' ; ', we can continue and describe the next statement. With this, we can make the script easy to look at in special cases. Statements punctuated with ' ; ' also undergo continuous execution.
_____Furthermore, in a case where we are updating $GV[ ] from multiple microscripts, we cannot prevent interference due to continuous execution based on ' ; '.

7

_____
SET
Syntax
Function
_____This substitutes the value of an expression into a variable.
_____SET can be omitted. For SET A=B, it doesn't matter if you describe it as A=B.
_____In numerical variables, we can substitute the results of an expression. In symbol-type expressions, we can substitute the array variable name or segment name, the procedure name, or the function name.
_____In array variables (also possible with array sections), we can substitute in order character strings, array sections, and numerical values. For example, Array[3:6]= "ab",5,'c' becomes the same as:
Array[3]='a'
Array[4]='b'
Array[5]=5
Array[6]='c'
Array[7]='c'
Array[8]='c'
In this case, because the array side is larger, the final element ('c') becomes repeatedly substituted. In a case where there is a character string at the end, 0 is automatically added. For example, Array[:]= "ab", "cd", "ef" becomes the same as:
Array[0]='a'
Array[1]='b'
Array[2]='c'
Array[3]='d'
Array[4]='e'
Array[5]='f'
Array[6]='0'
Array[7]='0'
(In actuality, 0 is substituted up to the end of the array.)
_____We substitute in order expressions, character strings, or the values of array sections into array elements specified in array sections. In a case where the array elements we will set are insufficient, we substitute the final array element into all of the remainder.
_____As for operation in a case where the range on the left side and the right side are duplicated, please pay attention to things that are at odds with the expected results. In such a case, we recommend that you use the acopy() function.
Errors that Occur at Startup Time
This is an illegal item that cannot be interpreted
Cannot substitute array data in a variable that is not an array.
Please specify the numerical value item
Cannot substitute a character string, symbol, or segment in a numerical value variable.
The range of numerical values that can be handled has been exceeded
Cannot handle numerical values outside the range.
Please specify the array, segment, or procedure
A numerical value cannot be substituted in a symbol variable.
A value cannot be set in this item
Use the SETSEG statement in the substitution of a segment variable.
The SET format is illegal
In a case where you are substituting a character string in an array variable, please make this in the manner of Array variable name [Array specification]= character string. It's no good with Array variable= "abc", rather it's necessary to make it Array variable[:]= "abc".
An item is not defined
A declaration based on the SCRIPT statement is necessary in substituting a procedure name or function name in a symbol variable prior to the declaration of a procedure or function.
Errors that Occur During Execution (only in the case of DEBUG 1: refer to p. 39)
There was array referencing in an illegal index
There is a substitution or reference to an array that exceeds the defined range.
Errors that Are Stored in $ERR (in regard to $ERR, refer to p. 170)
0_____ When we execute this statement, 0 gets loaded.
8, 9

_____
!
Syntax
Function
_____In the case of expression = 0, this returns 1. In the case of expression 0, this returns 0.
_____What can be specified in the expression is only an integer.
Operation Priority
Level
! `@| (unary)
* / %
<< >>
+ - (binary)
< >
=
&
O
|
& &
| |

Argument

Return Value
Byte Integer
Character Integer
Integer Integer
Floating point number Integer
Symbol Error (illegal value)
Segment name Error (illegal value)
Variable segment variable Error (illegal value)
Array variable Error (illegal value)
Illegal value Integer

Errors that Occur at Startup Time
Operation impossible because it's not an integer
A symbol, segment, or the like has been specified in the expression.
Errors that Occur During Execution (only in the case of DEBUG 1: refer to p. 39)
Attempt made to operate on an item that is not an integer
A symbol, segment, or the like has been specified in the expression.
Errors Where an Illegal Value Is Returned
Case of an attempt to operate on an item that is not an integer
A symbol, segment, or the like has been specified in the expression.
10

I Reference Section

^
Syntax
Function
_____This returns an exclusive OR for Expression1 and Expression2.
_____What we call an exclusive OR refers to an integer obtained by converting expressions into 32-bit binary numbers; and then making the parts where the bits of both differ 1, and the parts where the bits of both are the same 0. For example, when we express decimal 5 in binary, it becomes:
00000000000000000000000000000101
and when we express decimal 6 in binary, it becomes:
00000000000000000000000000000110
When we make the places where they mutually differ 1, it becomes:
00000000000000000000000000000011
and when we change this into decimal, it becomes 3. Accordingly, the result of 5^U becomes 3. In the case of an integer type, the leftmost bit (MSB) expresses a sign; sign bits also are handled the same as other bits.
_____What can be specified in an expression are numerical values only; in a case where a floating point number has been specified, it will be rounded off to an integer.
Operation Priority
Level
! `@| (unary)
* / %
<< >>
+ - (binary)
< >
=
&
O
|
& &
| |

Argument

Return Value
Byte Integer
Character Integer
Integer Integer
Floating point number Integer
Symbol Error (illegal value)
Segment name Error (illegal value)
Variable segment variable Error (illegal value)
Array variable Error (illegal value)
Illegal value Integer

Errors that Occur at Startup Time
Operation impossible because it's not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors that Occur During Execution (only in the case of DEBUG 1: refer to p. 39)
Attempt made to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors Where an Illegal Value Is Returned
Case of an attempt to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.

11, 12

I Reference Section

` P
Syntax
Function
_____These return a logic inversion. ` and P are the exact same in meaning.
_____What we call logic inversion refers to an integer obtained by converting an expression into a 32-bit binary number, and then reversing the 1s and 0s in the respective bits. For example, when we express decimal 5 in binary, it becomes:
00000000000000000000000000000101
and when we reverse the 1s and 0s, it becomes:
11111111111111111111111111111010
When we change this into a decimal number, it becomes -6. Accordingly, the result of P5 becomes -6.
_____What can be expressed in an expression are numerical values only; in a case where a floating point number has been specified, it will be rounded off to an integer.
Operation Priority
Level
! `@| (unary)
* / %
<< >>
+ - (binary)
< >
=
&
O
|
& &
| |

Argument

Return Value
Byte Integer
Character Integer
Integer Integer
Floating point number Integer
Symbol Error (illegal value)
Segment name Error (illegal value)
Variable segment variable Error (illegal value)
Array variable Error (illegal value)
Illegal value Integer

Errors that Occur at Startup Time
Operation impossible because it's not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors that Occur During Execution (only in the case of DEBUG 1: refer to p. 39)
Attempt made to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors Where an Illegal Value Is Returned
Case of an attempt to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.

13, 14

I Reference Section

/
Syntax
Function
_____This returns the results of dividing Expression1 by Expression2. / and are exactly the same in meaning.
_____In a case where Expression1 and Expression2 are both bytes, characters, or integers, the results are rounded off and become an integer. In a case where either Expression1 and Expression2, or both of them, are floating point number(s), the results become a floating point number. In other words, the result of 5/2 becomes the integer value 2, but the results of 5.0/2 or 5/2.0 become the floating point value 2.5. The result of 6/2 becomes the integer value 3, but the results of 6.0/2 or 6/2.0 become the floating point value 3.0.
_____Even in a case where Expression2 is 0, the result will not become an error; in a case where Expression1 is negative, the result will become the maximum negative value; and in a case where Expression1 is 0 or positive, the result will become the maximum positive value.
Operation Priority
Level
! `@| (unary)
* / %
<< >>
+ - (binary)
< >
=
&
O
|
& &
| |

Argument

Return Value
Byte Integer
Character Integer
Integer Integer
Floating point number Integer
Symbol Error (illegal value)
Segment name Error (illegal value)
Variable segment variable Error (illegal value)
Array variable Error (illegal value)
Illegal value Integer

Errors that Occur at Startup Time
Operation impossible because it's not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors that Occur During Execution (only in the case of DEBUG 1: refer to p. 39)
Attempt made to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors Where an Illegal Value Is Returned
Case of an attempt to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.

15, 16

I Reference Section

|
Syntax
Function
_____This returns an inclusive OR for Expression1 and Expression2.
_____What we call an inclusive OR refers to an integer obtained by converting expressions into 32-bit binary numbers, and then making the parts where either or both bits are 1s into 1, and the parts where both are 0s into 0. For example, when we express decimal 5 in binary, it becomes:
00000000000000000000000000000101
and when we decimal 6 in binary, it becomes:
00000000000000000000000000000110
When we make the places where either or both are 1s into 1, it becomes:
00000000000000000000000000000111
and when we change this into decimal, it becomes 7. Accordingly, the result of 5 | 6 becomes 7. In the case of an integer type, the leftmost bit (MSB) expresses a sign; sign bits also are handled the same as other bits.
_____What can be specified in an expression are numerical values only; in a case where a floating point number has been specified, it will be rounded off to an integer.
Operation Priority
Level
! `@| (unary)
* / %
<< >>
+ - (binary)
< >
=
&
O
|
& &
| |

Argument

Return Value
Byte Integer
Character Integer
Integer Integer
Floating point number Integer
Symbol Error (illegal value)
Segment name Error (illegal value)
Variable segment variable Error (illegal value)
Array variable Error (illegal value)
Illegal value Integer

Errors that Occur at Startup Time
Operation impossible because it's not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors that Occur During Execution (only in the case of DEBUG 1: refer to p. 39)
Attempt made to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors Where an Illegal Value Is Returned
Case of an attempt to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.

17, 18

I Reference Section

| |
Syntax
Function
_____First, if Expression1 0, 1 is returned without calculating Expression2. In a case where Expression1 = 0, Expression2 is calculated. In a case where Expression2 0, 1 is returned, and in a case where Expression2 = 0, 0 is returned. As a result, if either Expression1 or Expression2 is 0, 1 is returned.
_____Because Expression2 will not be evaluated at all in a case where Expression1 0, please be careful, since even in a case where Expression2 includes a function, the function will not be executed.
_____What can be specified in an expression are integers only. However, during execution, an error will not occur, and a result will be returned by judging only whether or not an expression is 0 or not.
Operation Priority
Level
! `@| (unary)
* / %
<< >>
+ - (binary)
< >
=
&
O
|
& &
| |

Argument

Return Value
Byte Integer
Character Integer
Integer Integer
Floating point number Integer
Symbol Error (illegal value)
Segment name Error (illegal value)
Variable segment variable Error (illegal value)
Array variable Error (illegal value)
Illegal value Integer

Errors that Occur at Startup Time
Operation impossible because it's not a numerical value
A symbol, segment, or the like has been specified in the expression.

19

_____
+
Syntax
Function
_____This returns the result of adding Expression1 and Expression2.
_____In a case where both Expression1 and Expression2 are bytes, characters, or integers, the result will become an integer. In a case where both Expression1 and Expression2, or either of them, is a floating point number, then the result will become a floating point number. In other words, the result of 1 + 2 will become the integer value of 3, but the results of 1.0 + 2 or 1 + 2.0 will become the floating point value of 3.0.
Operation Priority
Level
! `@| (unary)
* / %
<< >>
+ - (binary)
< >
=
&
O
|
& &
| |

Argument

Return Value
Byte Integer
Character Integer
Integer Integer
Floating point number Integer
Symbol Error (illegal value)
Segment name Error (illegal value)
Variable segment variable Error (illegal value)
Array variable Error (illegal value)
Illegal value Integer

Errors that Occur at Startup Time
Operation impossible because it's not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors that Occur During Execution (only in the case of DEBUG 1: refer to p. 39)
Attempt made to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors Where an Illegal Value Is Returned
Case of an attempt to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.
20

I Reference Section

- (unary operator)
Syntax
Function
_____This returns the result in which the sign of an expression has been inverted.
_____In a case where an expression is a byte, character, or integer, the result becomes an integer. In a case where an expression is a floating point number, the result becomes a floating point number. In other words, when we give -2 to an expression, the result becomes the integer value of 2, but when we give -2.0 to an expression, the result becomes the floating point value of 2.0.
Operation Priority
Level
! `@| (unary)
* / %
<< >>
+ - (binary)
< >
=
&
O
|
& &
| |

Argument

Return Value
Byte Integer
Character Integer
Integer Integer
Floating point number Integer
Symbol Error (illegal value)
Segment name Error (illegal value)
Variable segment variable Error (illegal value)
Array variable Error (illegal value)
Illegal value Integer

Errors that Occur at Startup Time
Operation impossible because it's not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors that Occur During Execution (only in the case of DEBUG 1: refer to p. 39)
Attempt made to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors Where an Illegal Value Is Returned
Case of an attempt to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.

21

_____
- (binary operator)
Syntax
Function
_____This returns the results of subtracting Expression2 from Expression1.
_____In a case where both Expression1 and Expression2 are bytes characters or integers, the results become an integer. In a case where both Expression1 and Expression2, or either of them, is a floating point number, the results become a floating point number. In other words, the result of 3-2 becomes the integer value 1, but the results of 3.0-2 or 3-2.0 become the floating point numerical value value 1.0.
Operation Priority
Level
! `@| (unary)
* / %
<< >>
+ - (binary)
< >
=
&
O
|
& &
| |

Argument

Return Value
Byte Integer
Character Integer
Integer Integer
Floating point number Integer
Symbol Error (illegal value)
Segment name Error (illegal value)
Variable segment variable Error (illegal value)
Array variable Error (illegal value)
Illegal value Integer

Errors that Occur at Startup Time
Operation impossible because it's not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors that Occur During Execution (only in the case of DEBUG 1: refer to p. 39)
Attempt made to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors Where an Illegal Value Is Returned
Case of an attempt to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.
22

I Reference Section

= ==
Syntax
Function
_____If Expression1 and Expression2 are equal (if Expression1=Expression2), this returns 1, and if that's not so, it returns 0. = and == are exactly the same in meaning.
_____Besides numerical values in the expression, it is possible to specify symbols stored in general-purpose-type variables (refer to :G [p. 49]). When you specify symbol-type variables, or directly specify a symbol in an expression, it will become an error, so please be careful.
_____What can be compared are numerical values and symbols only. In the comparison of the contents of arrays (refer to [:] [p.52]), please use acmp(), and in the comparison of character strings, scmp().
Operation Priority
Level
! `@| (unary)
* / %
<< >>
+ - (binary)
< >
=
&
O
|
& &
| |

Argument

Return Value
Byte Integer
Character Integer
Integer Integer
Floating point number Integer
Symbol Error (illegal value)
Segment name Error (illegal value)
Variable segment variable Error (illegal value)
Array variable Error (illegal value)
Illegal value Integer

Errors that Occur at Startup Time
Operation impossible because it's not a numerical value
A symbol, segment, or the like has been specified in the expression.
In comparing symbols, it is necessary to compare them after storing them both in a general-purpose-type variable (refer to :G).

23

_____
!=
Syntax
Function
_____If Expression1 and Expression2 are equal (if Expression1Expression2), this returns 1, and if that's not so, it returns 0. and != are exactly the same in meaning.
_____Besides numerical values in the expression, it is possible to specify symbols stored in general-purpose-type variables (refer to :G [p. 49]). When you specify symbol-type variables, or directly specify a symbol in an expression, it will become an error, so please be careful.
_____What can be compared are numerical values and symbols only. In the comparison of the contents of arrays (refer to [:] [p.52]), please use acmp(), and in the comparison of character strings, scmp().
Operation Priority
Level
! `@| (unary)
* / %
<< >>
+ - (binary)
< >
=
&
O
|
& &
| |

Argument

Return Value
Byte Integer
Character Integer
Integer Integer
Floating point number Integer
Symbol Error (illegal value)
Segment name Error (illegal value)
Variable segment variable Error (illegal value)
Array variable Error (illegal value)
Illegal value Integer

Errors that Occur at Startup Time
Operation impossible because it's not a numerical value
A symbol, segment, or the like has been specified in the expression.
In comparing symbols, it is necessary to compare them after storing them both in a general-purpose-type variable (refer to :G).
24

I Reference Section

<
Syntax
Function
_____If Expression2 is greater than Expression1 (if Expression1<Expression2), this returns 1, and if that's not so, it returns 0. and < are exactly the same in meaning.
_____What can be compared are numerical values only. In the comparison of the contents of arrays (refer to [:] [p.52]), please use acmp(), and in the comparison of character strings, scmp().
Operation Priority
Level
! `@| (unary)
* / %
<< >>
+ - (binary)
< >
=
&
O
|
& &
| |

Argument

Return Value
Byte Integer
Character Integer
Integer Integer
Floating point number Integer
Symbol Error (illegal value)
Segment name Error (illegal value)
Variable segment variable Error (illegal value)
Array variable Error (illegal value)
Illegal value Integer

Errors that Occur at Startup Time
Operation impossible because it's not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors that Occur During Execution (only in the case of DEBUG 1: refer to p. 39)
Attempt made to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors Where an Illegal Value Is Returned
Case of an attempt to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.

25

_____
<<
Syntax
Function
_____This sends Expression1 to the left (MSB direction), and returns a bit shift value to the extent of the bit part in Expression2. and << are exactly the same in meaning.
_____What we call a bit shift refers to an integer obtained from converting an expression into a 32-bit binary number, and then moving bits left or right. For example, if we express decimal 5 in binary, it becomes:
00000000000000000000000000000101
and when we do a 2-bit shift of this to the left, it becomes:
00000000000000000000000000010100
(0s are entered into the open places). When we change this into decimal, it becomes 20. Accordingly, the result of 5<<2 becomes 20. In the case of an integer type, the leftmost bit (MSB) expresses a symbol, but symbol bits also are handled the same as other bits. Moreover, overflow bits are simply discarded. Incidentally, doing a 1-bit shift to the left is equivalent to doubling.
_____What can be specified in Expression2 are only numerical values in the range 0`31, and in a case where a floating point number has been specified, it is rounded off to an integer. Operation in a case where a numerical value outside 0`31 has been specified becomes undefined, so please be careful.
Operation Priority
Level
! `@| (unary)
* / %
<< >>
+ - (binary)
< >
=
&
O
|
& &
| |

Argument

Return Value
Byte Integer
Character Integer
Integer Integer
Floating point number Integer
Symbol Error (illegal value)
Segment name Error (illegal value)
Variable segment variable Error (illegal value)
Array variable Error (illegal value)
Illegal value Integer

Errors that Occur at Startup Time
Operation impossible because it's not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors that Occur During Execution (only in the case of DEBUG 1: refer to p. 39)
Attempt made to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors Where an Illegal Value Is Returned
Case of an attempt to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.
26, 27

_____
@>
Syntax
Function
_____If Expression2 is less than Expression1 (if Expression1>Expression2), this returns 1, and if that's not so, it returns 0. and > are exactly the same in meaning.
_____What can be compared are numerical values only. In the comparison of the contents of arrays (refer to [:] [p.52]), please use acmp(), and in the comparison of character strings, scmp().
Operation Priority
Level
! `@| (unary)
* / %
<< >>
+ - (binary)
< >
=
&
O
|
& &
| |

Argument

Return Value
Byte Integer
Character Integer
Integer Integer
Floating point number Integer
Symbol Error (illegal value)
Segment name Error (illegal value)
Variable segment variable Error (illegal value)
Array variable Error (illegal value)
Illegal value Integer

Errors that Occur at Startup Time
Operation impossible because it's not a numerical value.
A symbol, segment, or the like has been specified in the expression.
Errors that Occur During Execution (only in the case of DEBUG 1: refer to p. 39)
Attempt made to operate on an item that is not a numerical value.
A symbol, segment, or the like has been specified in the expression.
Errors Where an Illegal Value Is Returned
Case of an attempt to operate on an item that is not a numerical value.
A symbol, segment, or the like has been specified in the expression.
28

I Reference Section

@>>
Syntax
Function
_____This sends Expression1 to the right (LSB direction), and returns a bit shift value to the extent of the bit part in Expression2. and >> are exactly the same in meaning.
_____What we call a bit shift refers to an integer obtained from converting an expression into a 32-bit binary number, and then moving bits left or right. For example, if we express decimal 24 in binary, it becomes:
00000000000000000000000000011000
and when we do a 2-bit shift of this to the right, it becomes:
00000000000000000000000000000110
When we change this into decimal, it becomes 6. Accordingly, the result of 24>>2 becomes 6. With byte type and character type, 0s are entered into the open places (leftmost bits) at the time of the bit shift. In the case of integer type, because the leftmost bit (MSB) is left as is at the time of the bit shift, for example, when
10000000000000000000000000001100
is shifted 1 bit to the right, it becomes:
11000000000000000000000000000110
In either case, the overflow bits are simply discarded.
_____What can be specified in Expression2 are only numerical values in the range 0`31, and in a case where a floating point number has been specified, it is rounded off to an integer. Operation in a case where a numerical value outside 0`31 has been specified becomes undefined, so please be careful.
Operation Priority
Level
! `@| (unary)
* / %
<< >>
+ - (binary)
< >
=
&
O
|
& &
| |

Argument

Return Value
Byte Integer
Character Integer
Integer Integer
Floating point number Integer
Symbol Error (illegal value)
Segment name Error (illegal value)
Variable segment variable Error (illegal value)
Array variable Error (illegal value)
Illegal value Integer

Errors that Occur at Startup Time
Operation impossible because it's not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors that Occur During Execution (only in the case of DEBUG 1: refer to p. 39)
Attempt made to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors Where an Illegal Value Is Returned
Case of an attempt to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.

29, 30

I Reference Section

<=
Syntax
Function
_____If Expression2 is greater than or equal to Expression1 (if Expression1Expression2), this returns 1, and if that's not so, it returns 0. and <= are exactly the same in meaning.
_____What can be compared are numerical values only. In the comparison of the contents of arrays (refer to [:] [p.52]), please use acmp(), and in the comparison of character strings, scmp().
Operation Priority
Level
! `@| (unary)
* / %
<< >>
+ - (binary)
< >
=
&
O
|
& &
| |

Argument

Return Value
Byte Integer
Character Integer
Integer Integer
Floating point number Integer
Symbol Error (illegal value)
Segment name Error (illegal value)
Variable segment variable Error (illegal value)
Array variable Error (illegal value)
Illegal value Integer

Errors that Occur at Startup Time
Operation impossible because it's not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors that Occur During Execution (only in the case of DEBUG 1: refer to p. 39)
Attempt made to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors Where an Illegal Value Is Returned
Case of an attempt to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.

31

I Reference Section

>=
Syntax
Function
_____If Expression2 is less than or equal to Expression1 (if Expression1Expression2), this returns 1, and if that's not so, it returns 0. and > are exactly the same in meaning.
_____What can be compared are numerical values only. In the comparison of the contents of arrays (refer to [:] [p.52]), please use acmp(), and in the comparison of character strings, scmp().
Operation Priority
Level
! `@| (unary)
* / %
<< >>
+ - (binary)
< >
=
&
O
|
& &
| |

Argument

Return Value
Byte Integer
Character Integer
Integer Integer
Floating point number Integer
Symbol Error (illegal value)
Segment name Error (illegal value)
Variable segment variable Error (illegal value)
Array variable Error (illegal value)
Illegal value Integer

Errors that Occur at Startup Time
Operation impossible because it's not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors that Occur During Execution (only in the case of DEBUG 1: refer to p. 39)
Attempt made to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors Where an Illegal Value Is Returned
Case of an attempt to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.
32

I Reference Section

%
Syntax
Function
_____This returns the remainder (balance) of dividing Expression1 with Expression2.
_____In a case where both Expression1 and Expression2 are floating point numbers, they are operated on after being rounded off to integers. The results always become an integer.
_____The results in a case where the values of Expression1 and Expression2 are negative become undefined, so please be careful.
_____Even in a case where Expression2 is 0, it will not become an error; in a case where Expression1 is negative, the result will become the maximum negative value; and in a case where Expression1 is 0 or positive, the result will become the maximum positive value.
Operation Priority
Level
! `@| (unary)
* / %
<< >>
+ - (binary)
< >
=
&
O
|
& &
| |

Argument

Return Value
Byte Integer
Character Integer
Integer Integer
Floating point number Integer
Symbol Error (illegal value)
Segment name Error (illegal value)
Variable segment variable Error (illegal value)
Array variable Error (illegal value)
Illegal value Integer

Errors that Occur at Startup Time
Operation impossible because it's not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors that Occur During Execution (only in the case of DEBUG 1: refer to p. 39)
Attempt made to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors Where an Illegal Value Is Returned
Case of an attempt to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.

33

_____
&
Syntax
Function
_____This returns the logical product of Expression1 and Expression2.
_____What we call a logical product refers to an integer obtained by converting expressions into 32-bit binary numbers, and then making the parts where the bits are 1 in both expressions 1, and the parts where that isn't so 0. For example, if we express decimal 5 in binary, it becomes:
00000000000000000000000000000101
and when we express decimal 6 in binary, it becomes:
00000000000000000000000000000110
When we make 1 only the places where both are 1, it becomes:
00000000000000000000000000000100
and when we change this into decimal, it becomes 4. Accordingly, the result of 5&6 becomes 4. In the case of integer type, the leftmost bit (MSB) expresses a sign, but even sign bits are handled the same as other bits.
_____What can be specified in the expressions are numerical values only. In a case where a floating point number has been specified, it will be rounded off into an integer.
Operation Priority
Level
! `@| (unary)
* / %
<< >>
+ - (binary)
< >
=
&
O
|
& &
| |

Argument

Return Value
Byte Integer
Character Integer
Integer Integer
Floating point number Integer
Symbol Error (illegal value)
Segment name Error (illegal value)
Variable segment variable Error (illegal value)
Array variable Error (illegal value)
Illegal value Integer

Errors that Occur at Startup Time
Operation impossible because it's not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors that Occur During Execution (only in the case of DEBUG 1: refer to p. 39)
Attempt made to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors Where an Illegal Value Is Returned
Case of an attempt to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.
34, 35

_____
& &
Syntax
Function
_____First, if Expression1=0, then this returns 0 without calculating Expression2. In a case where Expression10, this calculates Expression2. In a case where Expression2=0, this returns 0, and in a case where Expression20, this returns 1.
_____Because Expression2 will not be will not be evaluated at all in a case where Expression1=0, functions will not be executed even in a case where a function is included in Expression2, so please be careful.
_____What can be specified in an expression are integers only. However, during execution, errors will not occur, and results will be returned after judging only whether or not an Expression is 0.
Operation Priority
Level
! `@| (unary)
* / %
<< >>
+ - (binary)
< >
=
&
O
|
& &
| |

Argument

Return Value
Byte Integer
Character Integer
Integer Integer
Floating point number Integer
Symbol Error (illegal value)
Segment name Error (illegal value)
Variable segment variable Error (illegal value)
Array variable Error (illegal value)
Illegal value Integer

Errors that Occur at Startup Time
Operation impossible because it's not a numerical value
A floating point number, or a symbol, segment, or the like has been specified in the expression.
36

I Reference Section

* ~
Syntax
Function
_____This returns the result of multiplying Expresson1 and Expression2. * and ~ are exactly the same in meaning.
_____In a case where both Expression1 and Expression2 are bytes, characters, or integers, the results will become integers. In a case where both Expression1 and Expression2, or either of them, is a floating point number, the results become a floating point number. In other words, the result of 5*2 will become the integer value of 10, but the results of 5.0*2 or 5*2.0 will become the floating point value of 10.0.
Operation Priority
Level
! `@| (unary)
* / %
<< >>
+ - (binary)
< >
=
&
O
|
& &
| |

Argument

Return Value
Byte Integer
Character Integer
Integer Integer
Floating point number Integer
Symbol Error (illegal value)
Segment name Error (illegal value)
Variable segment variable Error (illegal value)
Array variable Error (illegal value)
Illegal value Integer

Errors that Occur at Startup Time
Operation impossible because it's not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors that Occur During Execution (only in the case of DEBUG 1: refer to p. 39)
Attempt made to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.
Errors Where an Illegal Value Is Returned
Case of an attempt to operate on an item that is not a numerical value
A symbol, segment, or the like has been specified in the expression.

37


The above contents of BTRON MicroScript Reference Manual were translated and loaded onto this Web page with the permission of Personal Media Corporation.

Copyright (c) 1997 Personal Media Corporation

Copyright (c) 2009 Sakamura Laboratory, University Museum, University of Tokyo