Operators

Compatible with:
DOS Maximite CMM MM150 MM170 MM+ MMX Picromite ArmiteL4 Armite F4 ArmiteH7 CMM2

The following operators are listed in order of precedence. Operators that are on the same level (for example +
and -) are processed with a left to right precedence as they occur on the program line.


Numeric Operators (Float or Integer)

NOT   INV NOT will invert the logical value on the right.
INV will perform a bitwise inversion of the value on the right.
Both of these have the highest precedence so if the value being operated on is an expression it should be surrounded by brackets. 
For example, IF NOT (A = 3 OR A = 8) THEN
^ Exponentiation (eg, b^n means b raised to the power n)
*   /   \   MOD Multiplication, division, integer division and modulus (remainder)
+   - Addition and subtraction
x << y     x >> y These operate in a special way. << means that the value returned will be the value of x shifted by y bits to the left while >> means the same only right shifted.
They are integer functions and any bits shifted off are discarded. 
For a right shift any bits introduced are set to the value of the top bit (bit 63). 
For a left shift any bits introduced are set to zero.
<>   <   >   <=   =<   >=   => Inequality, less than, greater than, less than or equal to, less than or equal to (alternative version), greater than or equal to, greater than or equal to (alternative version)
= Equality (also used in assignment to a variable, eg implied LET).
AND   OR   XOR Conjunction, disjunction, exclusive or.
These are bitwise operators and can be used on 64-bit unsigned integers.

The operators AND, OR and XOR are integer bitwise operators. For example PRINT (3 AND 6) will output 2. 
The other logical operations result in the integer 0 (zero) for false and 1 for true. 
For example the statement PRINT 4 >= 5 will print the number zero on the output and the expression A = 3 > 2 will store +1 in A.

String Operators

+ Join two strings
<>   <   >   <=   =<   >=   => Inequality, less than, greater than, less than or equal to, less than or equal to (alternative version), greater than or equal to, greater than or equal to (alternative version).
= Equality

String comparisons respect the case of the characters (ie "A" is greater than "a").

The shift operators should only be used with Integers. Floats will give unreliable results.

DIM INTEGER x , y
x = 1234
y = x << 8
PRINT "x= ";BIN$(x,64);" ";x
PRINT "y= ";BIN$(y,64);" ";y
PRINT
x = &h7FFFFFFFFFFF7F
y = x << 8
PRINT "x= ";BIN$(x,64);" ";x
PRINT "y= ";BIN$(y,64);" ";y
y = x << 9
PRINT "y= ";BIN$(y,64);" ";y

Output:
x= 0000000000000000000000000000000000000000000000000000010011010010  1234
y= 0000000000000000000000000000000000000000000001001101001000000000  315904

x= 0000000001111111111111111111111111111111111111111111111101111111  36028797018963839
y= 0111111111111111111111111111111111111111111111110111111100000000  9223372036854742784
y= 1111111111111111111111111111111111111111111111101111111000000000 -66048

Last edited: 29 September, 2020